span8
span4
span8
span4
Hello,
我有四个记录有三个属性。Their values are:
GB172783.TXTPAG 8138
GB172783.TXTPAG 8135
GB467715.TXTSNC 4129
GB467715.TXTPAG 4131
I want to merge the first + second to:
GB172783.TXTPAG 8135,8138
and the third+fourth to:
GB467715.TXTSNC,PAG 4129,4131
I use the aggregator and merge (concatenate) the last attribute grouped by the first attribute.How I can set the second attribute?In the case of the 3rd + 4th I want to keep both (SNC,PAG),for the 1st + 2nd I only want to keep the value PAG once and not PAG,PAG.Thanks!
I recently discovered an interesting usage of XQeury expressions with a JSONTemplater and this might be a typical case where the usage can be applied effectively.I would like to share the potential with all of you.
See this workspace example:aggregate-records-with-json.fmwt(FME 2017.0)
JSONTemplater ROOT Template Expression: Aggregate the XML elements created by the SUB expression grouping by field1,and return a JSON object which contains desired values created with XQuery functions.
let $t :={fme:process-features("SUB")} return { "field1": fme:get-attribute("field1"),"field2": fn:string-join(fn:distinct-values({for $v in $t/s/@f2 return $v}),","),"field3": fn:string-join(fn:distinct-values({for $v in $t/s/@f3 return $v}),",")}
JSONTemplater SUB Template Expression: Create an XML element containing the values of field2 and field3 as XML attributes for each record.
{ "field1": fme:get-attribute("field1"),"field2": fn:string-join(fn:distinct-values(fme:get-list-attribute("_list{}.field2")),","),"field3": fn:string-join(fn:distinct-values(fme:get-list-attribute("_list{}.field3")),",")}
You can select both the second and third attributes for concatenation.
Then to remove duplicate use the AttributeSplitter,ListDuplicateRemover and ListConcatenator in sequence.
Not a really charming way,but it works.
Merge/combine attributes of the biggest geometry within target dataset feature only3 Answers
FME Desktop geometry matching1 Answer
How do I make a multipoint feature from 2 points2 Answers
Key Value Row Groupings2 Answers
Combine overlapping/touching lines into one long simple geometric line3 Answers
© 2019 亚搏在线Safe Software Inc |Legal