https://slingdata.io logo
Hi, Im trying to define state in api
# sling-help
m
Hi, Im trying to define state in api spec as referenced in the docs: state: page: 1 limit: 1000 from_date: '2023-12-01 00:00:00' to_date: "{date_format(now(), '%Y-%m-%d')}" But receive next error: could not render state var (to_date) => {date_format(now(), '%Y-%m-%d')} Example from docs: state: start_date: "{date_format(date_add(now(), -1, 'day'), '%Y-%m-%d')}" Another question. Do we have access to the sync value between runs to check what the value?
f
hey @marikt94 yes, the expression evaluator does not support single quotes. try:
to_date: '{date_format(now(), "%Y-%m-%d")}'
m
Hi, thanks! There is other issue that I though that I mentioned in this thread, Im trying to use sync in api spec, but in the definition receive error: could not render state var (from_date) => { coalesce( sync.from_date, '2023-12-01 00:00:00' ) }
f
hey, it's the same issue, use
"
instead of `'`:
Copy code
{
          coalesce(
            sync.from_date,
            "2023-12-01 00:00:00"
          )
        }
m
Sorry, didnt notice. Thanks!