Hi @aworker , I think there might be a flaw in your logic
This is about this:
substr($PSP-Element$, 6, 6 * (indexOfChars($PSP-Element$, "L") + 1))
You will get the expected results only if there is no L, or it’s at the first position. Not seeing all the data, it cannot be guaranteed that it will work for all the data.
For example, if I have these values, you won’t get the expected results:
PSP-Element
A.L677-01
A.77L36-01
F5454L12345
Basically anything with L but not at the first position will not work.
Of course, I don’t know if these data can even occur, but if they do, I don’t think the logic will work.
To enforce substr($PSP-Element$, 6, 6 * (indexOfChars($PSP-Element$, "L") + 1))
to apply only if L is at the beginning, you could modify it to:
substr($PSP-Element$, 6, 6 * (indexOfChars(substr($PSP-Element$, 0, 1), "L") + 1))
I haven’t tested any of this, so I could be wrong all the way . But executing this in my head, that’s what I think will happen.
But brilliant way to apply some conditions indirectly