Templating value in SQL Query in Workspaces not working

Feature(s) impacted

Live query charts in worskspace with templating value

Observed behavior

I’m using workspace with a dropdown menu, it works well when using the UI filters on the collection. But when i want to execute the same sql query i get error for using template value.

Expected behavior

I should be able to filter with template value as suggested in forest admin documentation:
https://docs.forestadmin.com/user-guide/workspaces/building-a-workspace

Failure Logs

The basic query i’m attempting (the dropdown contains the value 8)

SELECT
    COUNT(id)
FROM
    users
WHERE
    users.id = {{dropdown1.selectedValue}};

I get the following error PG::SyntaxError: ERROR: syntax error at or near "{" LINE 6: users.id = {{dropdown1.selectedValue}}; ^

I attempted to put quotes '{{dropdown1.selectedValue}}' and {{dropdown1.selectedValue}}::integer without any success.

Context

  • Project name: Openstone
  • Team name: Livret P
  • Environment name: Staging
  • Agent technology: Rails
  • Agent (forest package) name & version: 9.3.3
  • Database type: POSTGRESQL
  • Recent changes made on your end if any: none

Thanks for your help.

I stay at your disposal for more information

Hello @Joe_Marc

I reproduce this issue on my end.
I have opened a ticket and I’ll get back to you when this issue has been resolved.

3 Likes

I just released the new version 9.3.7 of our gem to fix the problem.
You can run the following command

bundle update forest_liana

Let me known if the fix works for you :slight_smile:

2 Likes

It’s fixed, amazing thank you @matthv

3 Likes