Filtering Table based on INT Variable

Dear App Builders,

I am trying to filter a table element using a variable that has type int. However, I am getting the following error: ERROR: invalid input syntax for type integer: "{{cashbcf_start_date}}

I have tried removing the '' before and after {{cashbcf_start_date}} but that just gives me a different error.

Thanks in advance for any help :slight_smile:

I am using the following code:

Sourceoptions/SQL Satement – This gives me the error

"sql": "SELECT * FROM inputTable i WHERE month_year_index_int >= '{{cashbcf_start_date}}'  ORDER BY month_year DESC"

Variable

{
      "name": "cashbcf_start_date",
      "type": "int",
      "default": 51
    },

Data Table

{
  "origin": "datatable",
  "config": {
    "dataId": "fd33b11b-4bc9-4dae-b74a-64b67c4a2726",
    "dataOptions": {
      "sql": "SELECT *, CAST(month_year_index AS INT) as month_year_index_int FROM inputTable"
    },
    "filterOptions": {
      "enabled": true,
      "distinctValues": true
    },
    "schema": "table"
  }
}

I am explicitly casting it to INT in the app, as ONE DATA seems to have issues casting a bigint to an int inside a worklfow.

Nevermind, the solution is that instead of using sql: in my table element, I need to use "$sql: to make sure the variable is recognized

1 Like