cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Emily_Pollard
Helper I
Helper I

Power Automate Flow - Microsoft Forms and SQL Database

Hello All, 

 

I am creating a Survey for users to be able to take, and I am trying to create a flow that

#1 Takes the answer the user chose as TEXT

#2 Convert's it to a NUMBER/DECIMAL(score)

#3 NUMBER/DECIMAL is sent to the database.

Is something like this possible?

 

If so, how would one convert a text value to a number using Power Automate?

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Emily_Pollard 

Since the answers don't have a numerical value, you will have to use an if() expression. For example, you have the field where you need to enter the numerical value. You would do an expression as follows:

if(equals(ScoreField, 'High-Outstanding'), 3, if(equals(ScoreField, 'Mid', 2, 1)))

 If the ScoreField is equals to 'High-Outstanding', the expression will set its value to 3, but if not, the nested if statement will check if ScoreField is equals to 'Mid', the expression will set its value to 2, and if the last 2 conditions don't match, then it will set it to 1. I would try this expression in a Compose action to test it first and then do it in the actual action once it's good.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

View solution in original post

5 REPLIES 5
faustocapellanj
Memorable Member
Memorable Member

Hi @Emily_Pollard 

This is possible. If you want to convert a string to an integer or a decimal, you can use an expression to do either. For integer, you can use the int() function and for decimal, you can use the float() function. I have added links below to each function explaining what they do along with some examples. Please check them out and let us know.
https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#i... 
https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f... 

Regards,

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

With this Survey, people will be selecting an answer for each question like 'High - Outstanding' converting that to be a score of 3, or 'Medium - ...' to be a score of 1.5, etc. when they get sent to a database, is that still possible with the same type of converting or is there a better way to weight the questions in Power Automate? Thanks!

@faustocapellanj 

@Emily_Pollard 

Since the answers don't have a numerical value, you will have to use an if() expression. For example, you have the field where you need to enter the numerical value. You would do an expression as follows:

if(equals(ScoreField, 'High-Outstanding'), 3, if(equals(ScoreField, 'Mid', 2, 1)))

 If the ScoreField is equals to 'High-Outstanding', the expression will set its value to 3, but if not, the nested if statement will check if ScoreField is equals to 'Mid', the expression will set its value to 2, and if the last 2 conditions don't match, then it will set it to 1. I would try this expression in a Compose action to test it first and then do it in the actual action once it's good.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

View solution in original post

@faustocapellanj 

Thank you so much for your help! That was another option I was going to try!

But I was able to successfully convert the text to a variable another way! 

That's awesome!!! If you don't mind or have time, can you please post your solution in case other folks might be looking for something similar?

Thanks,

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

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 (55,333)