I'm iterating a DataTable of Excel values.
I have two columns, and for each row, I want to summarize those two into a third column, but I concatenate them.
This is the expression I use:
% CurrentItem['Column1'] + CurrentItem['Column2'] %
How do I get the result as a sum and not a concatenation (in the expression)?
Column1 Column2 Column3
I want the result 4 (and not 22)
I think your numbers are getting stored as text, I ran some quick tests to see if I could duplicate your issue:
If reading from Excel, I would check to make sure the 'Advanced' option to read as text is disabled, and if so there might be some whitespace in the original excel file to fool PAD into thinking its text.
I would then try "Covert text to number" and refer to your table value with a .trimmed property, just don't have text in your cells like I tested with my variable above 😛
Another idea to pinpoint your root cause: Set a variable to store just one of your values, and then check its type in Flow Variables once it runs (look to see if identifies as Text, or anything other than "Numeric Value", which is what you would want it to be.
Hope this helps!
Thanks a lot, @tc_procare
It happens in all flows I create, like the one below. I make an Excel sheet with three columns (A, B, and C) and here two rows. I haven't got the "Read as text" and when inspecting the value, it comes out as a text as you suggest.
If I use the convert text to number before the expression, it works, but I would like to know how it can be solved within an expression (to save time over and over in the future).
This is my expression, which doesn't work: %CurrentItem['A'] + CurrentItem['B']%
I also tried to format the excel data as numbers, and no difference. I would love not to format Excel data, as that will make my PAD flows inefficient.
My other thought is storing each cell to its own variable for each row of the loop... I think since its being stored to a DataTable, the contents of which are probably all set to the same type when read (I cant find anything to confirm or deny this on MS Docs).
I personally give each cell read its own Variable and haven't run across any math operations issues, but I'm not sure if its considered the 'right' way to do it since it adds more steps 😛
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.