Skip to main content

Hi,

I am having list (say list1) with column Amount

Title     Amount

abc     1,200

xyz     2,500

aaa     1,000

Now, I need summation of above 3 rows using Nintex WF. I have used collection variable and then looped the collection. However, Amount having comma is not calculated precisely. Seems, it is considered as string. Can anybody let me know better alternative ?

Hello Chintan,

Can't you get the correct sum value when you use plus operation in Math operation action? And Amount in the above example is a column of type Currency right?


Hi Soni,

Though Amount column is Number type in SharePoint. But, SharePoint put comma in Number field when saved.


Yes Chintan,

But I do have a workflow I'm just summing up the Currency column data.

Can you let us know, What exactly are you trying to do. I will try to replicate the requirement and try to help you!


Hi Soni,

I am summing up the Amount column in list1. I have used below action sequentially.

  1. Query list to query list1 and taking ALL amount values in collection variable. lets say col1
  2. For each loop to loop col1
  3. in for each loop. using math operation to doing PLUS operation to sum amount. error comes in this step.
  4. thats it.

Hi Adam,

In math operation (in for each loop), I tried your step on vSingleAmtOfInv Integer variable and it has only 1 dropdown value in it shown in screen below.

vSingleAmtOfInv is Integer type

vAmtOfInvSum is Integer type

180057_pastedImage_0.png


Hello Chintan,

Can you try as follows:

Declare variables: ColID - collection type; ItemID - List Item ID type; Sum - Number type with default value 0

1) Query List: get the IDs to ColID variable of type collection

2) Foreach ColI, store result if ItemID variable. Here ItemID is a workflow variable of type List Item ID

3) Math operation

With this you can achieve the sum of all Numbers in your list into the Sum variable.


Hi Soni,

I tried your approach earlier, but its error again. Because, Number column in your case should be having comma in thousand currency e.g. 1,200 or 2,000. Calculation in Nintex will surely work for hundreds currency like 350, 500 etc. So, in my case even numeric column (Amount column in my case) is having comma in currency which Nintex assume it to be string and not a numerics. Check below scenerio how SP does for hundreds and thousands currency. Number field in Number type. Now, here too Nintex will throw error while summing Number column.

180078_pastedImage_0.png


I too have the same in my case confused.png

These are the SP column of type Number


I tried having 100s 1000s 10K figures in my list; even now workflow got succeeded.


Lets me try this once again Soni.


Hi Soni,

Great! It worked with your approach. Lots of thanks happy.png. However, this may impact performance because every time for single Amount, I am querying WHOLE list. Is there any alternative?


By getting all Number column data at once approach, Nintex is not summing up the data. As you said it is throwing the error. Let me go back and check if we can have any other alternative approaches. Do you need to have amount in Number type column only or Currency type SP column also works in your case?


Number field is what I needed. I have never tried Currency type and not sure how Nintex will handle it.


Hey Chintan,

We can have the data into a Collection variable and do the math operation as follows.

Variables: ColID (collection), ColNumber (collection), IntCount (Integer), Number (Numebr), Sum (Number)

1) Query the list

2) Collection operation to get the count of items

3) Loop till IntCount > 0

4) Inside the loop have a math operation to minus 1 value from IntCount variable

5) Next use collection operation to get the Number data (inside the loop)

6) And have one more math operation to to sum the Number values (inside the loop)

This way the issues I faced are:

-> If you have null (empty) entries for any of Items in Amount column, the workflow is going to fail; as it is not able to retrieve the data

-> And this workflow is taking lot of time in my environment to complete the looping. Only I have 5 items in the list and it took like 15 min to complete the process.

Just give it a try and choose the best way you feel.


Excellent Soni Reddy. Its working. Very help full to me


Reply