Integer VARIABLE_1 = 0
field formula: @add(^VARIABLE_1^,1)
getting following error in ARD Datapainter window after clicking resolution operation
@add(^VARIABLE_1^,1)@MetaFunctions : uf_resolve_meta_data_item : Column references loop in AgD_Test_Data.VARIABLE_1
I guess the error that you are seeing is self-explanatory, right? You are creating a loop in the assignment of a value to a variable. You want to increment VARIABLE_1 and assign that new value back to VARIABLE_1
For an explanation why that wouldn't work we need to talk about why you want this data painter function. My guess is that you have a loop in your requirements model. I am assuming that you need a variable to use inside your automation snippets that indicates which iteration of the loop you are in.
The flow you build with ARD is a requirements flow and it is not a substitute for an algorithm flow or a procedural flow.
The resolution of the test data is separate from the creation of the testpaths. The testdata is resolved only after the test paths have been created. The values of the variables are not calculated during the creation of the test paths. The definitions of the variables - i.e. their expressions - can be re-assigned while the test path is traversed but it is just a definition of an expression for a variable. These expresssions are not evaluated during testpath creation.
(It is a different discussion why that is the case)
So, this means that for your VARIABLE_1 you just end up at the end with one expression : VARIABLE_1 = VARIABLE_1 + 1;
If I just give you this function and ask you what is the value of VARIABLE_1 you would say 'cannot do that, there is a loop' and that is exactly what ARD tells you.
Workaround for this: it might work if you do the increment inside your automation snippets.
You have a object called "integer_incrementer"
- you have an action "initialize" which might have code like this:
~variable_name~ = ~variable_initial_value~ ;
you add this to some process block before the loop
- you have an action "increment" which might have code like this:
~variable_name~ = ~variable_name~ + 1 ;
you add this to some process block inside the loop
So, now in your testdata you only define the name of the variable you want to use to store the incremented value. Anywhere inside your automation where you need the value you just pass the name, most automation functions will work just as well with the name of a variable (which exists in the current scope) as with an actual value passed in.
Hope this helps,