cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Glebenerd
Frequent Visitor

Convert text to number

Greetings:

 

I am using an MS Forms form to trigger an MS Flow which will transfer the input into a new list item in sharepoint.  Even though MS Forms allows you to specify that a field has to be a number, it seems to pass to flow as a text.  Is there a way to convert the text into a number in a number field? 

 

Thank you

 

John

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @Glebenerd,

 

Yes, there is a way to convert it into Number in Microsoft Flow.

An easy way for you to manage,

1. Add one compose Action, choose the field (Dynamic content from the form actions) that you would like to convert as the Compose Input, 

2. Add another Compose Action, under the Input, copy and paste the following:

"@int(outputs('Compose'))"      //for integer

Or

"@float(outputs('Compose'))"   // for floating-point number

Function reference: WorkFlow Definition Language.

3. Then use the Dynamic outputs of Compose 2 for the atcual field.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-micsh-msft
Community Support
Community Support

Hi @Glebenerd,

 

Yes, there is a way to convert it into Number in Microsoft Flow.

An easy way for you to manage,

1. Add one compose Action, choose the field (Dynamic content from the form actions) that you would like to convert as the Compose Input, 

2. Add another Compose Action, under the Input, copy and paste the following:

"@int(outputs('Compose'))"      //for integer

Or

"@float(outputs('Compose'))"   // for floating-point number

Function reference: WorkFlow Definition Language.

3. Then use the Dynamic outputs of Compose 2 for the atcual field.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you:

 

That answer opened up a world possibilities,  I had no idea that compose allowed you to reach into the workflow language.

 

John

Michael,

Thanks for your solution. Unfortunately, I wasn't able to get the Flow to work for me. With the two (2) compose functions, I attemped to convert my 'Total Cost' value from a string to an integer per your instructions. However, when I use the dynamic output of Compose 2 (i.e., this is  the compose titled 'Total Cost' for me) in a 'greater than or equal to' function, I get an error. See the screenshots below. I'd greatly appreciate your help. Thank you.

1.png

 

 

 

2.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I figured it out. I used the 'float' conversion function: 

float(triggerBody()?['Total_x0020_Cost'])
 
Thanks anyway.
LMeister
New Member

Another possible way to convert string to int:

first initialize a empty string variable at the start of the flow using the intialize variable, in my case i named it 'deletionID'.

Then add in the text you want using the set variable function down in the flow

Then you can use the compose with the input as "@int(variables('deletionID'))". The output from the compose will be an int value.

What variables does is that it takes in the name of any variable and gives you the value of the variable. Int function will only take in a value so the output of variables sits nicely in the formula

Just wanted to share this as an alternative if error occurs when there are multiple compose needed in parallel branch

Hi @v-micsh-msft ,

 

Can you please tell me how to convert the integer to be the string? Ex: 123 converts to "123"

Because I just use the "Select" action to make my data like this:

string capture.JPG

But I need to use "0" to be the unique key for filter array, but filter array can't recognize the integer content, so I need to convert to be the string, how can I get this? I already try String(item()[0]) in Select action, but not workable.

 

Please give me any advice.

Regards,

ilu989

Hi Mates,

 

Just remove here double quotes means just use like below its working charming

@int(outputs('Compose'))

Thanks

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (11,828)