2 weeks ago
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.
a week ago
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
2 weeks ago
Hi @shefali,
You can do it using Execute Python Action:
input variable : num_list = list with string values
output variable : int_list = list with integer values
def main(input):
string_list = input["num_list"]
int_list = [int(x) for x in string_list]
return {"int_list": int_list}
Regards,
Prudvi
2 weeks ago
Hi Prudvi,
I was wondering if this can be achieved using native formulas/functions, like List or String functions, instead of writing custom Python code?
a week ago
Anyone has an idea if this can be done with help of existing functions/formulas in Workato?
a week ago
Hi @shefali ,
Here is my answer to your question. What would be your next step after receiving the required response?
Please let me know so that I can refine my answers.
Thanks and Regards,
Shivakumara K A