Get Selected Record Workspace

Feature(s) impacted

Charts Workspace using {{Merchant.selectedRecord.id}} or Merchant.selectedRecord.id

Observed behavior

Error : PG::SyntaxError: ERROR: syntax error at or near “{” LINE 3: …cts.id FROM products WHERE products.merchant_id = {{Merchant… ^

Expected behavior

Show the data

Context

Workspace :

  • Search with on click row table merchant

  • Chart Single Value : Query :

      SELECT COUNT(*) as value
      FROM plan_sales
      WHERE plan_sales.product_id IN (SELECT products.id FROM products WHERE products.merchant_id = {{Merchant.selectedRecord.id}});
    

How can i use the “selected record” in a Query Chart?

Thanks for your help.

1 Like

Hello @kakou,

Can you give me the name of your project so I can have more details on the nature of your problem?

Kind regards,

Florian

Hello @kakou,

Thanks a lot for reaching out :raised_hands:

What you’re trying to achieve here (using templated value inside a chart query) is not possible yet :confused:

As you might know, Workspace is a pretty new feature and there are still some work to do to make them perfect!
On this specific subject, what’s coming soon is the possibility to filter using templated value on a Simple chart. Would it help you on your use case?

Thanks again for your feedback, this is priceless for us.

Hello @kakou,

Big news!
What you were trying to achieve:

SELECT COUNT(*) as value
FROM plan_sales
WHERE plan_sales.product_id IN (SELECT products.id FROM products WHERE products.merchant_id = {{Merchant.selectedRecord.id}});

is now possible and should work straight away as soon as you update your forest-express-sequelize version to 9.0.0 :tada:

Let me know!
Thanks.