cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daniel-Kendall
Frequent Visitor

Why aren't these two equivalent String() and variable as string

So I have an Array (userListAttach) of multiples links i.e. 

 

{
  "Name": "@{items('Apply_to_each')['name']}",
  "ContentBytes": "@{body('Get_file_content_using_path')}",
  "link": "@{items('Apply_to_each')['link']}"
}

 

 

To add as a property if I do:

variables('userListAttach')?[0]?['link'] after initialising a string variable it works.


HOWEVER if I do:
string(variables('userListAttach')?[0]?['link'])

it fails.

Why?!
1 ACCEPTED SOLUTION

Accepted Solutions
Daniel-Kendall
Frequent Visitor

userListAttach is an Array.
It contains multiple 'links' keys I want to treat the value of as strings to pass as a URL to sharepoint.
if I do:
variables('userListAttach')?[0]?['link'] after initialising a string variable it works.
HOWEVER if I do:
string(variables('userListAttach')?[0]?['link'])

It wasn't working

Weird it is working now, I just flan the flow again.


Technology gremlins

View solution in original post

2 REPLIES 2
abm
Super User
Super User

Hi @Daniel-Kendall 

 

What error you getting using this expression?

 

string(variables('userListAttach')?[0]?['link'])

 

Variable 'userListAttach' is already a string? Believe you already declared that as a variable so why you need to convert to string again?

 

A screenshot of your flow will be helpful to analyse?

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Daniel-Kendall
Frequent Visitor

userListAttach is an Array.
It contains multiple 'links' keys I want to treat the value of as strings to pass as a URL to sharepoint.
if I do:
variables('userListAttach')?[0]?['link'] after initialising a string variable it works.
HOWEVER if I do:
string(variables('userListAttach')?[0]?['link'])

It wasn't working

Weird it is working now, I just flan the flow again.


Technology gremlins

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,723)