I currently have JSON objects that are returning in FME very well. During the migration there are approx. 1,500 updates that need to be ran changing coded values to a description for storage in a data warehouse. This can be accomplished running an update that is prepopulated then passed to the "Update" port on the updater.
The issue is running 1,500 updates on 2,000 records takes 12+ minutes. The question is, is there a way to get the JSON Updater to updated multiple replacements at the same time. I have attempted to use the JSON Node updates and get errors.
Attached is a simplified version where I am attempting to change json["features"]["attributes"]/ASSETGROUP from 1,2,3,4 to One, Two, Three, Four where there is a match.
Thanks in advanced!!
Best answer by dellerbeck
All, thanks to the wonderful people at Safe I now have the answer to this!!! It's possible to pass in multiple JSON updates under a single statement using a list and a JSON_Templater. The following assumes you have a list named domain.codedValues{}. The code is the value in the JSON attribute and the name is the description to decode to.
{|
for $c at $i in fme:get-list-attribute("domain.codedValues{}.code")
let $names := fme:get-list-attribute("domain.codedValues{}.name")
return { $c : $names[$i] }
|}
This creates a decoding table that can be applied to an attribute in JSON using the JSON Updater with the following statement. The FIELD_NAME and code_map columns need to be supplied in the update record in order to use this statement. But once done any number of updates can be passed to the same field reducing the number of updates to a single JSON package.
Note that this is not being applied to individual records containing JSON but to a single FME Object with a JSON containing 2,000 different records. The performance went from 12 minutes per 2k to 8 seconds.
All, thanks to the wonderful people at Safe I now have the answer to this!!! It's possible to pass in multiple JSON updates under a single statement using a list and a JSON_Templater. The following assumes you have a list named domain.codedValues{}. The code is the value in the JSON attribute and the name is the description to decode to.
{|
for $c at $i in fme:get-list-attribute("domain.codedValues{}.code")
let $names := fme:get-list-attribute("domain.codedValues{}.name")
return { $c : $names[$i] }
|}
This creates a decoding table that can be applied to an attribute in JSON using the JSON Updater with the following statement. The FIELD_NAME and code_map columns need to be supplied in the update record in order to use this statement. But once done any number of updates can be passed to the same field reducing the number of updates to a single JSON package.
Note that this is not being applied to individual records containing JSON but to a single FME Object with a JSON containing 2,000 different records. The performance went from 12 minutes per 2k to 8 seconds.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.