Forum Discussion
Thanks for the help! That didn’t get me all the way there, but after looking at it I realized I could use another map to get the values I needed. In the end I did this
$Key.split(',').map(x=>{"id":x}).map(x=>{"key":x})
which got me the exact output I was looking for
- alex_panganiban5 years agoContributor
YES! So much more elegant!! Thank you so much. This helps in a big way.
There is an experimental API here. Given one or more input documents and the same number of desired output documents, the API tries to generate an expression that does the desired transformation.
In this case, change the input to
[ { "washCare": [ "Machine Wash, WARM", "Hand Wash Only" ] } ]
and output to
[ { "washCare": [ { "instruction": "Machine Wash, WARM" }, { "instruction": "Hand Wash Only" } ] } ]
and click on Synthesize. The generated result is
{ washCare: $.washCare.map(elem => { instruction: elem }) }
Note: This is experimental right now and works for limited inputs only
- alex_panganiban5 years agoContributor
Well, I played around. Not the most elegant solution, but this is what I came up with. There has to be a better way, but this worked. If anyone has a better solution, I’d love to see it. See my photo attachment.
- SpiroTaleski5 years agoValued Contributor
Please check the attached solution:
Test_Community_2021_05_27.slp (4.7 KB)
Hope this will help !
Regards,
Spiro Taleski
Related Content
- 7 years ago
- 5 months ago
- 11 months ago