Dynamic Array Count | Community
Skip to main content
August 10, 2023
Solved

Dynamic Array Count

  • August 10, 2023
  • 1 reply
  • 839 views

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

Source Module: Highlighted languages array.

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

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

 

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,

 

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

The input my third party application accept is,

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

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ChrisStephens

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

1 reply

ChrisStephens
Community Advisor
ChrisStephensCommunity AdvisorAccepted solution
Community Advisor
August 10, 2023

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
ElanR1Author
August 10, 2023

you are the best, it worked!