西班牙
斯潘4
你好,
我会尽量解释清楚。我使用带有xquery的jsontemplater插入csv文件中的属性值。
我的json的结构是:
{“snips”:{“人口”:115900,“活产”:1305,“死亡”:1234,“年龄:0-17”:23400,“bmepercent”:9.7,“家庭”:50900,“nocarervanpercent”:21.5,“不合格百分比”:25,“年龄65%:20},“总人口”:{“年”:“2015年我”,“sourcelink”:“http://www.ons.gov.uk”,“专栏”:“[“所有人”,“男性总人口”,“女性总人口”],“该地区”:{“名称”:“格德林”,“数据”:[115900,56400,59500]},“比较者”:[{“名称”:“诺丁汉郡”,“数据”:[805800,396700,409200]},{“名称”:“诺丁汉和诺丁汉郡”,“数据”:[1124700,557800,567000]},{“名称”:“英格兰”,“数据”:[5478630,27029300,27757000]}我的jsontemplater根表达式是:
{“snips”:fme:process features(“snips”),“totalpopulation”:fme:process features(“totalpop”)}
我的snips子模板表达式是:
{“population”:fme:get attribute(“population”),“liveborings”:fme:get attribute(“liveborings”),“death”:fme:get attribute(“death”),“age0-17”:fme:get attribute(“age0-17”),“bmepercent”:fme:get attribute(“bmepercent”),“houses”:fme:get attribute(“houses”),“nocarervanpercent”:fme:get attribute(“nocarervanpercent”),“noformalqualificationsPercent”:fme:get attribute(“noformalqualificationsPercent”),“aged65plusPercent”:fme:get attribute(“aged65plusPercent”)}
我的totalPop子模板表达式是:
{“year”:fme:get attribute(“year”),“sourcelink”:fme:get attribute(“sourcelink”),“columns”:[fme:get list attribute(“columns{}.col0”)],“thisrea”:fme:process features(“thisrea”)}
我的ThisArea子模板是:
{“name”:fme:get attribute(“name”),“data”:[fme:get list attribute(“columns{}.data”)]}
到目前为止,我已经成功地完成了大部分jsontemplate,但是现在我必须构建比较器部分,需要放在TOTALPOP子模板中是的。这就是我被困的地方…
保存比较器数据的csv数据如下所示:
Gedling | 诺丁汉郡 | 诺丁汉大学和诺丁汉郡 | 英格兰 | |
所有人(2015) | 115900 | 805800 | 1124700 | 54786300 |
总男性人口(2015) | 56400 | 396700 | 557800 | 27029300 |
女性人口 | 59500 | 409200 | 567000 | 27757000 |
如您所见,我几乎需要两个属性值,一个名为name,它作为3个记录出现在英国的诺丁汉郡、诺丁汉郡和诺丁汉郡。另一个属性称为data,并将值存储为列表。除此之外,我需要排除第一列(gedle),因为这是焦点区域,并且已经在“thisrea”子模板中定义。
解决方案需要是动态的,所以如果我引入一个有更多区域的阅读器,比如Ward级别,它需要创建一个类似上面的JSON,然后在Comparators部分的列表中列出所有Ward和数据值。
我想这可能是一个高级fme用户的圣诞拼图?是吗?
XmlTemplater列表属性1个答案
JSON模板-支持布尔值?2个答案
?2019安全亚搏在线软件公司|合法的