I have this local variable
local!variable: {2017,2018,2019,2020} local!variable2: a!forEach( items: local!variable, expression: if(fv!item<2018,"PRE-YEAR",fv!item) ),
I wanted a result like:
{"PRE-YEAR",2018,2019,2020}
Error:
Please help me
Discussion posts and replies are publicly visible
arshbirs0002 said:{"PRE-YEAR",2018,2019,2020}
You said this is what your result needed to be like...by definition it cannot be a list of numbers since your code is outputting "PRE-YEAR" when the item in your list is < 2018.
...just trying to understand your response...are you saying that the input to your rule is a list of Dictionary, but that you want to examine the value of each item as per your original code...that is, something like this:
a!localVariables( local!variable: { { EOMYear: 2017 }, { EOMYear: 2018 }, { EOMYear: 2019 }, { EOMYear: 2020 }, { EOMYear: 2021 } }, a!forEach( items: local!variable, expression: if( fn!tointeger(fv!item.EOMYear) < 2018, "PRE-YEAR", fv!item.EOMYear ) ) )
...which results in: