Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
GouthamDevaraj
Partner - Contributor II
Partner - Contributor II

How to merge results of two Variable?

Hello,
I need your expert advice on this,

I have two list variables having results as shown below
 
Variable 1 Result

[
"80554050",
"80554025"
]

Variable 2 Result

[
"80554065",
"80554075"
]

I want to merge these two results and put them in one array as shown below. I have used the merge list block but it's asking for some unique fields which I don't have in the result, So is this possible to achieve in any other ways?

[
"80554065",
"80554075",
"80554050",
"80554025"
]
 
Thanks,
Goutham
Labels (1)
1 Solution

Accepted Solutions
Shai_E
Support
Support

Hi @GouthamDevaraj ,

One way you could do this is set a merge operation on the second list variable:

Shai_E_0-1703670624770.png


It seems like this option would be viable for you since the lists only contain strings in them.
Judging by what is written in the user guide for the "Merge Lists" block it seems like its for lists with objects in them.

View solution in original post

11 Replies
Shai_E
Support
Support

Hi @GouthamDevaraj ,

One way you could do this is set a merge operation on the second list variable:

Shai_E_0-1703670624770.png


It seems like this option would be viable for you since the lists only contain strings in them.
Judging by what is written in the user guide for the "Merge Lists" block it seems like its for lists with objects in them.

salmankojar
Partner - Creator
Partner - Creator

solution provided by @Shai_E is perfect..

GouthamDevaraj
Partner - Contributor II
Partner - Contributor II
Author

Hi Team, thanks for your suggestions, I already tried it, but when I do a merger this is how I get the result, 

Screenshot 2024-01-03 at 13.20.03.png

but I want my results to be in a single array something like this. 

[
"80554065",
"80554075",
"80554050",
"80554025"
]

Shai_E
Support
Support

Hi @GouthamDevaraj ,

For me it worked, you most likely did something wrong.
Did you do it like how i did in the picture?

Updated to 10:49AM: Check out Afeefas example it merges the two variables into a third one using the merge operation.

Best Regards

AfeefaTk
Support
Support

Hi @GouthamDevaraj 

I have created a demo automation that might suit your use case.

Please take a look and let me know if that works for you.

Thanks

salmankojar
Partner - Creator
Partner - Creator

can you show me your flow so that i can see what you did?

AfeefaTk
Support
Support

Hi @GouthamDevaraj 

I have already shared the automation json file.

Please try to import it into your workspace and see if that helps.

Follow the instructions here to import the automation.

Thanks

GouthamDevaraj
Partner - Contributor II
Partner - Contributor II
Author

Hi @AfeefaTk , 

Thanks for sharing the json, in my case the both variables has arrays and I need to make it as a single array.  I am sharing an automatin josn file here for youre refeence. 

Shai_E
Support
Support

Hi @GouthamDevaraj ,

There are two issues:

1. Is the addition of a list in the form of a string to a list variable

2. Even if you convert that list string into a list you will still have a list inside a list as a variable.

What you are currently doing is adding a list as a string to a list variable.

You have


Add item to list1 :

"["12354456","123434563","8765676875"]"

 

So you will get a value for list1 as:

["["12354456","123434563","8765676875"]"]

Best thing to do would be to add the strings separately to each variable (list1, list2).

And then use two merge operations to merge (list1, list2) values into a third list variable.

 

Best Regards