Nintex subtract the amount.

  • 2 November 2015
  • 8 replies
  • 8 views

Badge +2

I am having a list where users can request certain amount either full or in 2 installment, can Nintex read from same list if user has request any amount and only allow him to use subtract amount.

For example, all user are allowed to request 100, if user has requested 50 first then its only allowed to request 50, if user request 100 then he will not be allowed to request any amount.


8 replies

Badge +9

Hi Rizwan,

Do you want to validate that in the Form or in a Workflow?

Regards,

Christophe

Badge +2

it would be great if its validate in form but fine to have even in workflow, then workflow can send message to user that request can't be proceed due to amount, please re-request. user's can be monitor by their login ID (person and group).

Badge +9

So the easiest way then: a Workflow

You need three steps:

1. A Query List action

2. A loop to sum the retrieved amounts for the initiator (user)

3. You test the sum again your allowed amount

1. Query List

For the Query part of the action: Keep Query Builder

For Fields: This is the name of the column containing the Amount

For Filters, Select items only when the following is true:

For Show the items when column, enter the name of the column containing the Employee name

Keep is equal to

Then select on the right, under Workflow Context, if this is for the initiator of the request, Initiator Display Name

For First Column, create a Collection variable: collAmount

2. Use a For Each loop in which you insert a Do Calculation to sum the content of collAmount

3. You use a If Action to test the sum again your allowed amount

Hope it helps,

Regards,

Christophe Raucq

Userlevel 7
Badge +17

Christophe provides a great approach, for a completely different option that is just to share some ideas, you could have a list with a few fields (Title, Amount - as number or currency, user - as person). In one item have the values of ("Total", 100, {blank}). Then create a Nintex Form for the list and put this form on a home page using the Nintex Form webpart for Lists and have it show the New form.

In the list form, Have a lookup to the same list filtering by Title equals to "Total" - and it can be disabled. Then have another single line of text control for the user to enter their amount. Add a Rule for validation to show an error message if the users amount is greater than the Total amount.

When the user submits a successful response, have a workflow update the item Total by subtracting the amount the user just entered. The workflow can also change the current item (users submission) Title field to the users display name and insert the initiators login name to the person field to help query later.

So the user doesn't necessarily have to interact with the list, just the form on the page to make submissions.

I can think of several ways to improve on this idea, but just wanted to share the many ways to look at the problem.

Badge +2

seems i am missing something , i am sharing the screenshots please correct me , as suggested i have create the query builder with all details, in second screenshot i add the variable, can you see the last screenshot i am not able to pick any thing "store result in" as its blank.

Capture1.PNG

Capture2.PNG

Capture3.PNG

Capture4.PNG

Userlevel 7
Badge +17

If the CollAmount collection variable is a collection of single line of text values, then the Store Result in is looking for a variable of type single line of text.

Badge +9

Hi,

intAmount is integer

intIndex is integer

If collAmount contains 50 and 25

For Each will run 2 times and intAmount will contain 50 the first time and 25 the second time

Capture.PNG

Userlevel 7
Badge +17

He's exactly right! Rizwan, does this help? Were you able to get the result you wanted?

Reply