我对公司的财务报表信息有以下架构:
FinancialsSchema = new SimpleSchema({ revenue: { type: Number, label: "Revenue", min: 0, optional: true } }); TimeSchema = new SimpleSchema({ period: { type: String, label: "Period", optional: true }, financials: { type: FinancialsSchema, optional: true } }); CompanySchema = new SimpleSchema({ name: { type: String, label: "Company Name" }, time: { type: TimeSchema, optional: true } }); Companies.attachSchema(CompanySchema);我试图引用LTM,FY + 1和FY + 2收入数据,使用空格键显示在表格中。 我的收藏中已经有以下内容,并通过控制台测试了收入和EBITDA数据都是在LTM下捕获的。
Companies.insert({ name: "Example", sector: "Industrial", status: "Public", time: { period: "LTM", financials: { revenue: "200", ebitda: "100" } } });我原以为{{period(“LTM”)。revenue}}会起作用,但已经尝试过几十种变化,无法将数字显示在表格中。 谢谢。
I have the following schema for a company's financial statement information:
FinancialsSchema = new SimpleSchema({ revenue: { type: Number, label: "Revenue", min: 0, optional: true } }); TimeSchema = new SimpleSchema({ period: { type: String, label: "Period", optional: true }, financials: { type: FinancialsSchema, optional: true } }); CompanySchema = new SimpleSchema({ name: { type: String, label: "Company Name" }, time: { type: TimeSchema, optional: true } }); Companies.attachSchema(CompanySchema);I am trying to reference the LTM, FY+1 and FY+2 revenue figures using spacebars to display in a table. I already have the following in my collection and tested through the console that the revenue and EBITDA numbers have both been captured under LTM.
Companies.insert({ name: "Example", sector: "Industrial", status: "Public", time: { period: "LTM", financials: { revenue: "200", ebitda: "100" } } });I would have thought {{period("LTM").revenue}} would work but have tried dozens of variations and can't get the figures to appear in the table. Thanks.
最满意答案
您可能需要查看Spacebars自述文件 ,因为我不相信{{period("LTM").revenue}}是一个有效的空格键标签。 通过空格将函数名称与其参数分开来调用函数,如下所示: {{functionName arg1 arg2}} 。
为了得到你想要的东西,你需要先得到感兴趣的公司,可能还有一个帮助Companies.findOne({period: "LTM"})返回Companies.findOne({period: "LTM"}) 。
将公司作为数据上下文后,您需要使用{{time.financials.revenue}}和{{time.financials.ebitda}}来获取收入和EBITDA值。 您编写架构的方式,每个公司条目只能有一个收入和EBITDA值,并且它们存储在time.financials对象中。
You might want to review the Spacebars Readme, because I don't believe {{period("LTM").revenue}} is a valid spacebars tag. Functions are called by separating the function name from its arguments by a space, like so: {{functionName arg1 arg2}}.
To get what you're after, you'll need to first get the copany of interest, probably with a helper that returns Companies.findOne({period: "LTM"}).
Once you have the Company of interest as the data context, you'll need to use {{time.financials.revenue}} and {{time.financials.ebitda}} to get the revenue and EBITDA values. The way you've written your schema, each company entry can only have one revenue and EBITDA value, and they are stored in the time.financials object.
更多推荐
发布评论