I am trying to generate a JSON message to update editing templates on an AGOL Feature Service. I've got most of it complete. I am having trouble with the last piece though.
Each Editing Template has a list of fields and defaults like this:
I am trying to generate 27 unique editing templates based on unique pairs of 2 attributes. The portion of the JSON text I am struggling with is the ["types"]["templates"]["prototype"]["attributes"] section. I have the correct number of "types" (27). I have the correct fields and corresponding default values.
As you can see, I am getting an extra pair of "},{" between each field as compared to the example above. Almost like each row is it's own unique element. I am sending 594 features into the "EDITEMPLATEFIELDS" sub template and grouping the process by '_editTemplatePairs' attribute as these contain 27 unique field configurations for all 22 fields in the editing template.
I am leveraging Sub Templates in the JSONTemplater. Here's how I currently have this section set up:
ROOT: (Number of Incoming Features: 1)
Sub Template: EDITTYPES (Number of Incoming Features: 27)
Sub Template: EDITEMPLATEFIELDS (Number of Incoming Features: 594)
I can't seem to get the JSONTemplator to ignore the 'array' function. Ultimately, I have 27 different variations of these sets of fields:
Any suggestions on how to remove the 'Array' syntax in the ["prototype"]["attributes"] section? I've tried playing around with lists and pre-formatting JSON text, but have gotten no where. I'm sure I'm missing some very simple here.
Unfortunately, I won't be able to upload my workspace as the services I am trying to update cannot be shared publicly.
FME Version: 2020.1.3.0 (20201001 - Build 20632)
Thanks in advance!
-Mark



Next, in the aggregator, I had to set the GroupBy parameter and I did not include the "\\n" in the Separator Character like this:
Next, I had to append a "{" to the beginning of the aggregator output and a "}" to the end of the same output like this in an AttributeCreator as the JSONTemplater wasn't putting them in the correct position.
The final JSON text looks like this before going to the JSON Templater:
Next, I modified the "EDITTYPES" & "EDITTEMPLATEFIELDS Sub Templates in the JSONTemplater as shown below:
The final result looks like this:
Thanks again for your help