It is possible to create variables with the same name and type in Optimize not only via different scopes as described in OPT-3893 but also when users delete and subsequently create variables with the same name and type on the same process instance. This leads to instance data within Optimize that has multiple entries for the same variable name and type (but with a different ID). Since reports and filters differentiate variables based on name and type (and not ID), this can lead to confusing results - see linked support ticket for an example. Also, a sample process to reproduce the issue is attached.
Steps to reproduce:
- Deploy process with three tasks:
- Task 1 sets a Variable, eg "Variable1" with type Integer to value 100
- Task 2 removes this variable
- Task 3 adds another Variable with the same name and type but different value, eg "Variable1" with value 200
- Run a few process instances through this process
- Import data into Optimize
- Create a report to inspect variable data, eg a raw data report on this process
- Observe that some instances will have variable value null and some the value 200. Also observe that filters work on both values (instances that display value 200 will still be within filters that filter for null data only because they do have a variable with that same name and value null)
From the user perspective, the expected result is that all instances have the value 200 for "Variable1", even though technically there are two "Variable1"s, one with value 200 and one with value null. We could consider identifying variable updates by name and type only instead of ID when importing, which would lead to Optimize overwriting the value of Variable1 to 200 instead of creating a separate variable entry. This needs further evaluation though as we are not sure if this would have any unintended side effects. Alternatively, we could consider displaying multiple variables with the same name, eg by adding the ID in FE.
We could also consider just accepting that this is a limitation within Optimize and document this. In general, users should not delete and create duplicate variables, since simply setting the variable value to null instead of removing it in step 1.2 would also resolve the issue.