Pogues
Pogues copied to clipboard
Comments in VTL expressions prevent execution
This valid VTL expression doesn't work in Pogues (warning i removed in this issue the $
that are mandatory in Pogues in order to have a pure VTL code):
// Verif SIREN
mod(
cast(substr(SIRET, 1, 1), integer) +
(
if cast(substr(SIRET, 2, 1), integer) > 4
then cast(substr(SIRET, 2, 1), integer) * 2 - 9
else cast(substr(SIRET, 2, 1), integer) * 2
) +
cast(substr(SIRET, 3, 1), integer) +
(
if cast(substr(SIRET, 4, 1), integer) > 4
then cast(substr(SIRET, 4, 1), integer) * 2 - 9
else cast(substr(SIRET, 4, 1), integer) * 2
) +
cast(substr(SIRET, 5, 1), integer) +
(
if cast(substr(SIRET, 6, 1), integer) > 4
then cast(substr(SIRET, 6, 1), integer) * 2 - 9
else cast(substr(SIRET, 6, 1), integer) * 2
) +
cast(substr(SIRET, 7, 1), integer) +
(
if cast(substr(SIRET, 8, 1), integer) > 4
then cast(substr(SIRET, 8, 1), integer) * 2 - 9
else cast(substr(SIRET, 8, 1), integer) * 2
) +
cast(substr(SIRET, 9, 1), integer)
, 10) = 0
// Verif SIRET
and
mod(
(
if cast(substr(SIRET, 1, 1), integer) > 4
then cast(substr(SIRET, 1, 1), integer) * 2 - 9
else cast(substr(SIRET, 1, 1), integer) * 2
) +
cast(substr(SIRET, 2, 1), integer) +
(
if cast(substr(SIRET, 3, 1), integer) > 4
then cast(substr(SIRET, 3, 1), integer) * 2 - 9
else cast(substr(SIRET, 3, 1), integer) * 2
) +
cast(substr(SIRET, 4, 1), integer) +
(
if cast(substr(SIRET, 5, 1), integer) > 4
then cast(substr(SIRET, 5, 1), integer) * 2 - 9
else cast(substr(SIRET, 5, 1), integer) * 2
) +
cast(substr(SIRET, 6, 1), integer) +
(
if cast(substr(SIRET, 7, 1), integer) > 4
then cast(substr(SIRET, 7, 1), integer) * 2 - 9
else cast(substr(SIRET, 7, 1), integer) * 2
) +
cast(substr(SIRET, 8, 1), integer) +
(
if cast(substr(SIRET, 9, 1), integer) > 4
then cast(substr(SIRET, 9, 1), integer) * 2 - 9
else cast(substr(SIRET, 9, 1), integer) * 2
) +
cast(substr(SIRET, 10, 1), integer) +
(
if cast(substr(SIRET, 11, 1), integer) > 4
then cast(substr(SIRET, 11, 1), integer) * 2 - 9
else cast(substr(SIRET, 11, 1), integer) * 2
) +
cast(substr(SIRET, 12, 1), integer) +
(
if cast(substr(SIRET, 13, 1), integer) > 4
then cast(substr(SIRET, 13, 1), integer) * 2 - 9
else cast(substr(SIRET, 13, 1), integer) * 2
) +
cast(substr(SIRET, 14, 1), integer)
, 10) <> 0
If we remove the two comment lines, it works.
You can check in the Trevas storybook that the code is valid and well parsed by the engine. So, there must be something between the Pogues VTL editor and the engine that doesn't handle well comments.