Retrieve DB list filtered by current year

0
I have a microflow that retrieves a db list from an entity,  filter criteria is based on current year. The year attribute is an enumeration with values in format ‘yyyy’ In the microflow I have created a variable VAR_YEAR with the condition: if(parseInteger(formatDateTime([%CurrentDateTime%],'yyyy'))=2022) then Testapp.Enum_Year._2022 else empty   Next, in the Retrieve object, I have added xpath constraint:   [attribute1 = $VAR_YEAR] The list should populate only when Year=2022, but the list containing rows with year = empty, and not 2022 is populating as well.   What am I missing here? Please advise    
asked
4 answers
1

Your logic seems correct, so I wonder if the problem is actually with your data.

How are you verifying that the data being returned is incorrect? Are you looking specifically at this attribute or are you looking at another attribute that is more display friendly?

I wonder if the objects have all been set to ‘_2022’ somehow, but you are looking at other data that says it’s for another year.

One way to test this would be to put a breakpoint after the retrieve and specifically check attribute1 for every returned object. I suspect they are all ‘_2022’.

answered
3

Hi Nagashree,

There’s an easier approach for that. You could have used a getyear function for than and then you could have used that function’s result in the Xpath, this way you could easily have retrieved the data from the database.

Just try doing that, 

Hope it helps!

answered
1

Hi Nagashri,

 

The expression: 

$date >= [%BeginOfCurrentYear%]  and $date <= [%EndOfCurrentYear%]

wil retrun all the dates in the current year.

 

Hope this will help,

Jan

answered
0

In your microflow retrieve use

  [attribute1 = ‘_2022’] 

See what happens

answered