i try to update a counter in a Nintex workflow (similar like i = i + 1) but the result is not correct. Instead of add 1 to the variable it adds 10 or 11 or 12 or ...
could you post setup of your math action?
what's datatype of your counter?
The Counter is Number. Each time when a change in a record (list entry) happens, the counter should be incremented by 1 and stored in that record.
so you have a workflow that automatically starts with every item change, right?
have you checked workflow's history log or item's versions whether workflow is not started multiple times?
still I would need to know how do you have set up math action to see what might be a problem.
Thanks, but where can I see the history log?
The process should only start once per record, independent if there was changed one attribute or multiple, but this I cannot control in the workflow, correct?
right click on a list item in list view and choose 'Workflows' from menu. (make sure you select an item that a workflow has already ran or is still running)
you should get page with running, completed and errored workflows.
click on a workflow name (link) and you should see history log.
but to see anything usefulness here you have to use 'log in history list' action in your workflow to write debugging messages
have a look here for further insights Demystifying Workflow History (Part 1)
In fact it seems that the calculation is executed 10 times (for each attribute?) instead of only once per changed record. How can I define that the workflow should only once per record run if an attribute of the record has changed?
Can you provide a screenshot of your workflow or logic? It sounds like you have your operation in a loop, just in the wrong spot
It seems that the workflow is executed for each attribute instead only once per record (independently if one or multiple attributes has changed). I have not found where I can define that the workflow execution is per record.
Hmmm... I am not seeing what you are when I run it.
I recreated it and added log to history steps and I am seeing it do the Math operation once.
What are you updating in your action? I assume this is a list workflow and not a site workflow, correct? Are you triggering the workflow on update, new, or both? Any conditions?
Just trying to understand the full picture
just to be sure:
do you see 10 workflow instances for item change started that update your counter by 1?
or do you see math action executed 10 times within single workflow instance?
or do you just see your counter updated by 10 within single workflow instance and single math action invocation?
do you have by any change more then 1 workflows that is automatically started on item change?
it shouldn't matter how many fields do you change, if you post all the changes at once it's just single update and workflow should be started once.
I have as well tried a scenario Philipp Lucas describes below, and even if I set to start workflow automatically on a change, it got fired just once for me. so update action within workflow haven't caused one another instance to be started, which is quite reasonable, otherwise it would mean infinite loop.
It can depend on the nintex configuration. In the central administration (nintex global settings) you can allow/disallow your system account to trigger conditional workflows.
Philipp, do you mean it applies even if I haven't made changes with system account (and so haven't run workflow with system account), neither I haven't set a condition?
Marian Hatala, no I was just talking generally about that configuration, not about your specific case. However, I've seen weird workflow behaviour regarding the system account triggering workflows which I couldn't explain even regarding this configuration. So I think it's never a bad idea to double check that.
Are you setting the variable before using it or are you performing a math operation on it first?
If you want to start at 0, use a Set variable action and set it equal to 0 as your first step, that way you know every time the workflow runs it is reset to 0 and there is not leftover junk data in it.
Hope this helps!
Thanks, but this I already did.
your workflow starts when an item is edited? Don't forget that your workflow updates the item as well and could therefore trigger itself.
Make sure the workflow won't trigger itself by configuring the start options. You can configure to start the workflow only when an item is edited and additional conditions are met.
So you can put your workflow in an action set and configure the action set to "run as workflow owner" (workflow owner = user who published the workflow). Afterwards you can configure a start condition like "if modified by != workflow owner" to keep this workflow from triggering itself.
If that doesn't work for you, create an additional column in your list like "calculated" and set this column to true at the end of your workflow. Afterwards you configure it to only start if that column is set to false.
Retrieving data ...