Hi @lisasays, do you have an example of the output you'd like to see? Would you have elevation as a field name once or multiple times? How would the Y/N be populated?
Hi @lisasays, do you have an example of the output you'd like to see? Would you have elevation as a field name once or multiple times? How would the Y/N be populated?
Thank you Tia. I want elevation as a field name only once.. The output i want is as below
Hi @lisasays, this workflow example might help you.
The point is to use the value of an attribute as a new attribute name to create desired attributes that store the value "Y".
Result
Hope this helps.
Hi @lisasays, this workflow example might help you.
The point is to use the value of an attribute as a new attribute name to create desired attributes that store the value "Y".
Result
Hope this helps.
Another thought. JSON operations could be effective in this case.
JSON Template Expression:
{
fme:get-attribute("Field 1") : "Y",
fme:get-attribute("Field 2") : "Y",
fme:get-attribute("Field 3") : "Y"
}
Another thought. JSON operations could be effective in this case.
JSON Template Expression:
{
fme:get-attribute("Field 1") : "Y",
fme:get-attribute("Field 2") : "Y",
fme:get-attribute("Field 3") : "Y"
}
Thanks a lot Takashi. Since my lookup table is quite big, is there a way it can automatic get the list for "Attribute to expose" in JSONFlattener?
Thanks a lot Takashi. Since my lookup table is quite big, is there a way it can automatic get the list for "Attribute to expose" in JSONFlattener?
Unfortunately there is no way to expose attribute names automatically. However, if you have an external table (e.g. CSV or Excel spreadsheet) that contains all possible field names, you can add the AttributeExposer instead of setting the Attributes to Expose parameter in the JSONFlattener and import the field names from the table.
Hi @lisasays, this workflow example might help you.
The point is to use the value of an attribute as a new attribute name to create desired attributes that store the value "Y".
Result
Hope this helps.
This workflow would be robuster. Assuming that names of the target attributes are formatted in "Field<space><one or more digits>". Note: If "Field *" attribute can contain <empty> or <null>, remove them (i.e. change them to <missing>) with the NullAttributeMapper before the ListExpressionPopulator.
JSON Template Expression
{|
for $name in fme:get-list-attribute("_list{}")
return {$name : "Y"}
|}
This workflow would be robuster. Assuming that names of the target attributes are formatted in "Field<space><one or more digits>". Note: If "Field *" attribute can contain <empty> or <null>, remove them (i.e. change them to <missing>) with the NullAttributeMapper before the ListExpressionPopulator.
JSON Template Expression
{|
for $name in fme:get-list-attribute("_list{}")
return {$name : "Y"}
|}
Great thanks a lot! This perfectly solved my problem :)