Using tab values from a tabbed container in a SQL query

I am attempting to control the data that is returned in a query by using the values of the tabs in a tabbed container. This is my WHERE statement:

WHERE
  ship_date = {{ tabs7.value = 'today' ? moment(new Date()) : moment(new Date()).add(1, 'days') }}

For some reason, this is not working. When I mouse over the tabs7.value, it says value: any. Does anyone what I did wrong?

Hi @tomm,

I don't think I see anything wrong on that statement.

Have you tried debugging using a js query? What do you get if you run a js query with return tabs7.value = 'today' ? moment(new Date()) : moment(new Date()).add(1, 'days')

If you do get the expected result, could it be that yoru ship_date column is expecting another format?

I tried the javascript you provided and no matter what tab I select, I am getting today's date. I have two tabs, Today (with the key 'today') and Tomorrow (with the key 'tomorrow')

I have checked the state for each one and the correct value is being passed, but I still only get today's date in the query.

Hi @tomm! I think your ternary statement should be tabs7.value === 'today' ? moment(new Date()) : moment(new Date()).add(1, 'days'). We should use the === operator to check for equality!