Dynamic variable in a query

Stimulsoft Dashboards.WEB discussion
Post Reply
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

Dynamic variable in a query

Post by jlorue »

Hi,

I have built a dashboard that has 2 pages:

- Page 1: A dashboard with table1. The first column of this table is called "ID"

- Page 2: A Dashbard with table2 (related to another SQL table). This Dashboard opens when I click on a cell of the ID column of the Page1's table (using a Custom interaction in the ID column, where I defined the parameter "ID" that has a value {Row.ID}). I use {Row.ID} to filter table2 just to extract the table2's rows related to that ID.

The question is this: is there anyway to use the {Row.ID} as a variable in query of the SQL table2? I mean something like this:
Select
table2.IDreference,
table2.description
from table2
where table2.IDreference = {Row.ID}

The option to add a filter to table2 is not useful in this case, given that table2 has +100K records. So the filter by {Row.ID} is done after it gets all this records, what takes a very long time (or time out).

How can I do that?
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Dynamic variable in a query

Post by Lech Kulikowski »

Hello,

Please check the sample report in the attachment.

Thank you.
Attachments
DBSParam.mrt
(15.69 KiB) Downloaded 177 times
jlorue
Posts: 126
Joined: Thu Apr 15, 2021 6:33 pm

Re: Dynamic variable in a query

Post by jlorue »

Hi Lech, it worked!!!
Thank you so much for this solution!
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Dynamic variable in a query

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply