cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anshul
Regular Visitor

How to extract elements from array and assign it to a string?

Hi All i have an array Results as below:

[
  "Customer Name",
  "AAA111222DEF",
  "2"
]
 
I need to extract the first and last element and assign it to a new String CustomerName and CustomerID, can someone please suggest as i am new to this development.
 
Appreciate any help.
Regards
 
1 ACCEPTED SOLUTION

Accepted Solutions

@anshul ,

Here is what I have in mind ... 

 

gabibalaban_1-1636103875001.png

"where do i type this variables('Results')[0] ? in expression window?"

Being a formula you need to used add dynamic contents -> expression.

 

gabibalaban_0-1636103848116.png

 

View solution in original post

4 REPLIES 4
gabibalaban
Dual Super User
Dual Super User

@anshul ,

You can refer to a particular item of an array with:

variables('Results')[0] - first item from Results array ;

variables('Results')[1] - second item from Results array;

and so on ...

To set a value of CustomerName variable you can use either initialize variable or set variable action (depends of the scenario) and use as value the first element of the array: variables('Results')[0]. 

Hope it helps !

my question, where do i type this variables('Results')[0] ? in expression window? can you please explain in detail on typing this in which action or which window?

@anshul ,

Here is what I have in mind ... 

 

gabibalaban_1-1636103875001.png

"where do i type this variables('Results')[0] ? in expression window?"

Being a formula you need to used add dynamic contents -> expression.

 

gabibalaban_0-1636103848116.png

 

@gabibalaban thank you so much 🙂

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,143)