want to add all arrays,

Hi all,
I have a requirement to add all arrays (say array1,array2, and array3 ) and display them in 3 lines,


Exmple : 
Country:{"India","china","USA"},
State:{"Bangalore","Fujian","Texas"}
Language:{"Kannada","Mandarin","English"}

I used merge and joinarray functions,
joinarray(merge(local!Country,local!state,local!language),"-")

required op in three separate lines as below:
india - bangalore - kannada 
china - Fujian - Mandarin
usa - texas - English


How this can be achieved. Any suggestions will be appreciated.

  Discussion posts and replies are publicly visible

Parents
  • There seem to be some assumptions here you're not stating.  Is the ordering / length of the 3 arrays expected to always be matching / consistent?  I.e. the first entry in the "countries" array will always match the first one in "states" and likewise with "languages", etc?

    If so, it seems like your initial setup might be improved (if possible) - instead of a random assortment of arrays, why aren't we starting out with a list of dictionary / CDT / map, with structured data?  i.e.

    local!dataList: { a!map(country: "USA", state: "Texas", language: "English), a!map(country: "China"....), ... },

    That'd make it quite a bit more straightforward to display the info you want to have displayed, without the necessary guesswork and (imho) sloppy merge() operations necessary.

Reply
  • There seem to be some assumptions here you're not stating.  Is the ordering / length of the 3 arrays expected to always be matching / consistent?  I.e. the first entry in the "countries" array will always match the first one in "states" and likewise with "languages", etc?

    If so, it seems like your initial setup might be improved (if possible) - instead of a random assortment of arrays, why aren't we starting out with a list of dictionary / CDT / map, with structured data?  i.e.

    local!dataList: { a!map(country: "USA", state: "Texas", language: "English), a!map(country: "China"....), ... },

    That'd make it quite a bit more straightforward to display the info you want to have displayed, without the necessary guesswork and (imho) sloppy merge() operations necessary.

Children
No Data