Hi,
I'm starting to learn Canvas but struggling with a few concepts in the expression editor. I hope someone can point me in the correct direction.
I'm trying to filter a table, using the current date. My table contains a column called iso_date which I want to filter on. I'm using mapColumn to simplify the column, ensuring it contains only "YYYY-MM-DD" as I don't want the time included in the source data.
Afterwards I'm trying to use filterrows
to match the current date within the table.
The below example works if I hard code a date string, ie 2022-12-14
filters
| esdocs index="team_shift*"
fields="iso_date, shift_pattern.early_analyst"
| mapColumn "iso_date" fn={getCell "iso_date" | formatdate "YYYY-MM-DD"}
|filterrows {getCell "iso_date" | any {eq "2022-12-14" }}
| render
However if I'm failing if I try and do this dynamically for example;
filters
| esdocs index="soc_shift*"
fields="iso_date, shift_pattern.early_analyst"
| mapColumn "iso_date" fn={getCell "iso_date" | formatdate "YYYY-MM-DD"}
|filterrows {getCell "iso_date" | any {eq date | formatdate "YYYY-MM-DD" }}
| render
Any advice on how to achieve this would be appreciated, I feel I'm close but not quite there.
Thanks