Use of `GLOBAL_ITERATION_INDEX` to filter a loop
romaintailhurat opened this issue · comments
I'm trying to use GLOBAL_ITERATION_INDEX
in a condition filter.
The use case is:
- i collect travel information in a standard loop (4 iterations)
- in a linked and paginated loop i display only the 1st and 4th travels.
I have written this condition in Pogues:
GLOBAL_ITERATION_INDEX <> "1" and GLOBAL_ITERATION_INDEX <> "4"
Which translates in Lunatic model as:
"conditionFilter": {
"type": "VTL",
"value": "(GLOBAL_ITERATION_INDEX <> \"1\" and GLOBAL_ITERATION_INDEX <> \"4\")"
}
In the TrevasJS storybook, with the translated VTL expression:
(GLOBAL_ITERATION_INDEX <> "1" and GLOBAL_ITERATION_INDEX <> "4")
the following use cases gives:
{"GLOBAL_ITERATION_INDEX": "2"}
=> true{"GLOBAL_ITERATION_INDEX": "1"}
=> false
So, given the semantic of the "Except" field in Pogues and the "conditionFilter" object in Lunatic, i should see the 1st and 4th iteration of the loop but i get the opposite! 😓
Why do i do wrong?
Trevas storybook is: https://inseefr.github.io/Trevas-JS/storybook/?path=/story/interpretor--default
Lunatic storybook used is: https://inseefr.github.io/Lunatic/storybook-2.6
Test questionnaire =>
lunatic-725.zip
This should work on lunatic 2.6
But it wasn't ported when refactoring the variable system in lunatic 2.7
I'm working on a 2.7 fix
I'm a bit confused, when trying to test on this storybook (Lunatic version is apparently 2.7.0-rc.1
) i get another kind of misfunctionning: now, when iterating over the loop, the display of GLOBAL_ITERATION_INDEX
is always null
. The questionnaire is still the same.
I'm a bit confused, when trying to test on this storybook (Lunatic version is apparently
2.7.0-rc.1
) i get another kind of misfunctionning: now, when iterating over the loop, the display ofGLOBAL_ITERATION_INDEX
is alwaysnull
. The questionnaire is still the same.
👉 The storybook needs to be updated to 2.7.1, will be done next week.