cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rensalzado
New Member

Problems converting string to int/float in an Apply to Each Step

Hi, 

I am trying to multiply two quantities, from a SharePoint List. In the SharePoint List, these values are numeric, but when referenced in the flow, they seem to be a string. I tried to apply the function float() or int(), but when I do, I get a 0. Any ideas? The pictures are a simplify step of what I need. 

I need this number (FTE) to be later multiply with another. However, because this step returns 0, then the multiplication yields also 0. I would appreciate any hints you could provide. Many thanks! In the pictures I show that the field FTE = 2, but when I apply float(outputs('Get_item')?['body/FTE']) this yields 0

SharePoint1.pngSharePoint2.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @rensalzado :

Please try this expression:

float(items('Apply_to_each')?['FTE'])

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @rensalzado :

Please try this expression:

float(items('Apply_to_each')?['FTE'])

Best Regards,

Bof

View solution in original post

Hi @v-bofeng-msft

Yeap, right on spot. I had to make a small change, because I renamed my "Apply to each" step to "Apply to each Eng Software Item": 

items('Apply_to_each_Eng_Software_Item')?['FTE']

 so, for whoever out there, consider that in your solution. 

 

Another things, at the end I did not need the float conversion. I could confirm that my field inherited the properties from the list (all along a float). In SharePoint lists, for calculated fields, even if you declare them as float/number, you have to use the conversion using "float". In this case, my problem was in the iterator.  

 

@v-bofeng-msft  where in the documentation can I find these small subtleties, at least with this action? I thought it had to do with the iterator, but honestly could not find any explanation to a special treatment for items when you are in the "Apply to each" steps.  

 

In any case, thanks for the help! I was scratching my head for one day because of that. I ended up do it manually ☹️

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,706)