I'm trying to implement a simple feat with a duration string, that is extracting the month value for:
P100Y11M
We don't have yet a duration type implemented in Trevas JS, i'm trying to simply parse the string*.
One way to do it is to use substr and instr (here DD is a string with value P100Y11M):
substr(
DD,
instr(DD, "Y") + 1,
(instr(DD, "M")-instr(DD, "Y"))-1
)
But i'm getting the following error:
Type errors: Error: extraneous input '-1' expecting ')'
If i try the same formula using a scalar as the length param, it works:
substr(
DD,
instr(DD, "Y") + 1,
2
)
It's probably not a problem with substr, because this is also raising the same error as previously:
instr(DD, "M")-(instr(DD, "Y")-1)
@NicoLaval we can discuss that and even pair programming over this when you find time 😃
I'm trying to implement a simple feat with a duration string, that is extracting the month value for:
P100Y11MWe don't have yet a
durationtype implemented in Trevas JS, i'm trying to simply parse the string*.One way to do it is to use
substrandinstr(hereDDis a string with valueP100Y11M):But i'm getting the following error:
Type errors: Error: extraneous input '-1' expecting ')'If i try the same formula using a scalar as the
lengthparam, it works:It's probably not a problem with
substr, because this is also raising the same error as previously:instr(DD, "M")-(instr(DD, "Y")-1)@NicoLaval we can discuss that and even pair programming over this when you find time 😃