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

Identify an output is float or integer?

Our organisation is leveraging MS Forms for various approvals process with the help of Flow.  On one particular form, people are instructed to round up to the nearest pound (£) for 5 entries, which meant I was able to convert the form inputs to Integers.  My flow was working great until one person didn't read instructions on the MS Form and used a decimal figure.

 

MS Forms doesn't let me limit the number of decimal places on an answer (wish they'd bring out a currency setting or something).  So now I need to detect if the output from MS Forms connector contains decimals and convert / round-up to an integer.  I've read a few posts, but I'm struggling to get it to work.  The check / conversion would need to check 5 MS Forms outputs.

1 ACCEPTED SOLUTION

Accepted Solutions
JenLavery
Frequent Visitor

Wondering if something like this might work...?

if(contains(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'],'.'),float(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012']),if(equals(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'],''),int(0),
int(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'])))

 

Sure there's probably not enough close brackets on that, but we'll see how it goes.

View solution in original post

4 REPLIES 4
PrasadAthalye
Super User
Super User

Can you try something like following? Convert output to float using compose and then use Format Number.

 

PrasadAthalye_0-1621355801805.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Thanks for your suggestion, this would only work if everything incoming is Float.  If they follow instructions, the number should come as an integer.  This means integrating an If statement or variable, and I've tried some variations without success. 

JenLavery
Frequent Visitor

Wondering if something like this might work...?

if(contains(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'],'.'),float(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012']),if(equals(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'],''),int(0),
int(outputs('Get_response_details')?['body/r44f329f6c5a84d0d99d610fd97646012'])))

 

Sure there's probably not enough close brackets on that, but we'll see how it goes.

Yup, this formula works a treat.  I should probably give myself more time to figure these things out on my own before panicking and bothering everyone. 🙂

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.

Users online (2,691)