Hi,
I'm trying to read a text field from a sharepoint list, cast it to an integer, do some math with it and cast it back to a string.
I have fetched the item from SharePoint and put the value of the string field in a Compose operation.
In the following compose operation I use the function in the Compose_9 action:
"@int('@{outputs(''Opstellen_8'')}')" where Opstellen_8 is the compose action that holds the string value. When the Flow has run, this string value is filled with 00001 which is correct. NB: Notice how I used double single quotes '' to escape the inner quotes around Opstellen_8 in order fo the function to validate successfully.
However, the cast to int action fails with the message: 'Cannot cast to targettype'.
Should this cast to int work for the value 00001? I would expect an Integer with value 1 from it.
What I'm trying to achieve is save a tracking number that is always 5 digits long with leading zero's, and increment it by one and save it back to SharePoint. I guess I could use a number field in the SP list but I would like to store the actual text presentation of the number including leading zero's). There are probably a ton of ways to do it, but I'd still like to know why the cast to integer fails.
Kind Regards.
Solved! Go to Solution.
Hi @Anonymous
Your compose function should contains this text: "@int('outputs('Opstellen_8')')" instead "@int('@{outputs(''Opstellen_8'')}')".
Best Regards,
Gustavo Moraes
Gustavo Moraes, o astronauta brasileiro do Flow!
Hi @Anonymous
Your compose function should contains this text: "@int('outputs('Opstellen_8')')" instead "@int('@{outputs(''Opstellen_8'')}')".
Best Regards,
Gustavo Moraes
Gustavo Moraes, o astronauta brasileiro do Flow!
Correct way is "@int(outputs('Opstellen_8'))" . Pretty simple really 🙂