Hello,
The data in my database is of form yyyy-mm-dd. While filtering data, I want to ignore the year. How can I do it?
Thanks.
Discussion posts and replies are publicly visible
That is not possible out of the box. I suggest to implement a view in database which puts day, month and year into separate columns. Then you can filter on this. In case your data volume is large, consider performance tests.
Thank you so much for the advice.
I'd argue that using an a!queryLogicalExpression() with an "OR" operator and some looping logic could work for this use case, OOB, for a "brute force" approach, assuming there is a finite-and-discernable number of years "back" the query needs to reach (and assuming it's not a large number).
Example:
a!localVariables( /* number of years to look back */ local!numYears: 10, local!month: 6, local!day: 27, a!queryLogicalExpression( operator: "OR", filters: { a!forEach( enumerate(local!numYears), a!queryFilter( field: "myDate", operator: "=", value: date( year(today()) - fv!item, local!month, local!day ) ) ) } ) )
result:
Note if the database side VIEW method is utilized on a datetime value, any DB-side calculations to return DAY, MONTH and YEAR separately will be done on those GMT values and may be incorrect depending on the time of day in the value, as Appian's time zone conversions are bypassed with this method. To resolve this, we implemented the solution from mssqltips.com to convert GMT, with daylight savings, and it works great as we always report in Eastern time. The datetime values are wrapped in that function call, within SQL's DATEPART() function.