โ02-27-2025 12:49 AM
Is there a formula that can be used to convert list of String variables to a list of integers ?
I/P is ["1","100","50", "4"]
O/P [1,100,50,4]
Solved! Go to Solution.
โ03-02-2025 06:09 AM
Hi @shefali,
If you observe my screenshots:
1๏ธโฃ In the 2nd and 3rd images,
I used Variable_name: List and Datatype: String. When applying the pluck("v") formula, it automatically converts to List_of_Numbers, so there's no need to explicitly set the data type as List.
2๏ธโฃ I have a small curiosity: Why do we need to create two variables with Integer or Number data types to parse a number list?
Answer: There's no need to use two variables. As I suggested, when we apply the pluck("v") formula, it automatically takes care of converting to List_of_Numbers.
3๏ธโฃ However, when using list functions, it still treats the variable as a list. Shouldn't it actually be recognized as a number instead?
Could you please share a screenshot? I didnโt fully understand your point here.
Looking forward to your insights! ๐
Thanks and Regards,
Shivakumar K A
โ02-28-2025 12:09 AM
Hi Shivakumara,
Thanks for the response. The function you've used appears to return a string variable containing integers. However, I need to first extract a list of integers. Then, I can use existing list functions to determine the minimum and maximum values from the list.
I am able to perform this operation on a list of numeric strings. However, the issue is that the min and max functions are returning values based on ASCII character order rather than numerical values.
If you feel there is an alternate way to handle this using existing functions, please guide me
โ02-28-2025 04:36 AM - edited โ02-28-2025 04:38 AM
Hi @shefali ,
I found another way doing it is
1. when the input is "List of String" pass it to another variable where it should of data type "Integer"
2. Workato will take care of your "List_of_String" to "List_of_Integer"
3. Apply formulae "MAX" or "MIN" whichever you needed as per your requirement
Here are some screenshots for your reference:
โ02-28-2025 04:45 AM
Thanks @shivakumara
โ02-28-2025 04:47 AM
Happy to help. @Prudvi ๐ค
โ02-28-2025 05:00 AM
HI Shiva,
I tried passing a list of string to a new variable of type integer. O/P is still a list of string. The auto -conversion is not working for me.