Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!
SOLVED

Dynamic Array Count

Avatar

Level 2

Hi Everyone, I am feeding languages info from Workfront custom form to an external application through JSON module. 

Source Module: Highlighted languages array.

ElanR1_0-1691649654197.png

I've created a set variable to fetch the Translate to: 

ElanR1_2-1691650916881.png

And using the above variable in JSON module. If I have three languages, I've to give like below

ElanR1_4-1691651252738.png

ElanR1_5-1691651435336.png

 

The about output works fine (and my third party application is accepting this as input), but I will NOT know how many languages will come as output in my previous module, so I want this language count to be auto set as per the number of outputs from my source module. 

 

So In JSON module, If I give the object like below,

ElanR1_6-1691651671185.png

 

Then I am getting the below output which my third party application is NOT accepting as input. 

ElanR1_1-1691649879965.png

The input my third party application accept is,

ElanR1_7-1691651768900.png

Please help on how I can capture the dynamic languages count and its values to get the desired output. 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Just so I can make sure I am understanding your question, the problem is that when you need help on building out the targetLanguageInfos array dynamically, correct?

 

If so, here is an option.

  1. Create an iterator module, and map in your DE:Translate To - Dropdown
  2. add in a set multiple variable module, and make a variable called targetLanguage
  3. Map in the value from the iterator in line 1 into your variable value
  4. Add in aggregator module, pair it to your iterator in line 1, and map the variable you created in 2
  5. In your JSON builder, toggle the "map" button on the targetLanguageInfos array, and map in the output from the aggregator in line 4

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Just so I can make sure I am understanding your question, the problem is that when you need help on building out the targetLanguageInfos array dynamically, correct?

 

If so, here is an option.

  1. Create an iterator module, and map in your DE:Translate To - Dropdown
  2. add in a set multiple variable module, and make a variable called targetLanguage
  3. Map in the value from the iterator in line 1 into your variable value
  4. Add in aggregator module, pair it to your iterator in line 1, and map the variable you created in 2
  5. In your JSON builder, toggle the "map" button on the targetLanguageInfos array, and map in the output from the aggregator in line 4