• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Recipe Building Formula Mode Questions
M

Michael Kuhl

started a topic almost 5 years ago

Map! for arrays in formula fields

Having a column in a source CSV like this: 

"(Developer) Sergio Smith, (Developer) Sudhir Jones, (QA Engineer) Pavankumar White"


I need to extract the set of names for each role so I can look up the names in a LookUp Table to find a value to use in a field.  In the case above I will have two developers and on QA Engineer to lookup.


In the formula below I am using scan to extract the developers from the string.  I then want to use map! to perform a lookup against each item in the array returned by scan so that I end up with the array containing the substitute values from the lookup. 

"(Developer) Sergio Smith, (Developer) Sudhir Jones, (QA Engineer) Pavankumar White".scan(/\(Developer\) (\w+ \w+)/).map! {|x|lookup('Cox Comet User Mapping','Full name':x)['I-username'] }.to_s.gsub(/[\[\"\]]/,"")

 It appears Workato doesn't let me use map!  Any suggestions on how I can iterate on an array so I can perform operations on each element and get back an array?

Amanda Wong

said almost 5 years ago

Hi Michael,


Since you have a CSV, you can use Workato's CSV parser to obtain an array that you could iterate on. There is a limit of maximum 50000 lines. You can add conditional actions to determine which items should be processed. Next, you can use Workato Lists to append the substitute values to create an array.


You can take a look at this recipe example here.

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count