2022.04.07 05:56 AM - edited 2022.04.07 07:22 AM
I've been playing around with Dashboards for a little bit and seem to always run into a problem getting a drop down list to connect with my chart.
In the View State for the drop down, I've got it setup for Default "sym" and Value "sym"
The Data for the chart appears to be setup properly (in accordance with the docus I've found).
And obviously I've check to verify that the data exists within the rootData table -- we're all good there.
I've had this issue in the past and usually just give up, or resort to hardcoding the symbols and having to have multiple windows up at a time lol. I've gotta be doing something wrong here.
2022.04.07 06:23 AM
Why do I feel like it's because my table isn't keyed with sym?
2022.04.08 09:27 AM - edited 2022.04.20 02:03 PM
The root issue wouldn’t be related to whether or not table is keyed on sym.
If the table is defined on the process, then it should be good.
Just wondering, does that table have a column labelled sym with `sym in it?
2022.04.08 11:09 AM
Yes, the table has a col "sym" with `sym in it
Here's the meta for the table:
In fact, when i query (within Dashboards):
select from rootData where sym=`sym
works just fine. But when I try to run the query with the dropdown viewstate variable:
2022.04.15 01:19 PM
Thanks for the additional information,
I'll do up an example on my side as soon as possible and will share the steps here.
2022.04.19 04:30 AM
Could the issue be related to my using a tickerplant and sub functions? The table I'm calling, rootData, isn't in my sym.q file -- it's just a table from a subfunction.
Do I need to have the table format in sym.q to get the dropdown variable to work?
2022.04.19 08:38 AM - edited 2022.04.19 08:45 AM
As long as rootData is defined on the process it shouldn't be an issue.
Using the following example, my rootData is defined on the process with the following meta and data
Then via the dashboard, within the dropdown datasource I am selecting the distinct symbols from this table
Then within the widget configuration, I set the viewstate for Selected Value to be selectedSym
This has no default and is of type symbol
Within the datasource mapping section, I am mapping the column sym for the dropdown.
This means the options the dropdown shows will be values from the column sym.
When I select one, it will map to the viewstate selectedSym
For example, when I select a from the dropdown:
With the dropdown setting up and mapping to the viewstate, this viewstate can now be fed into the datasource for the chart
For example, I have created a data grid which uses a datasource "exampleChart". This takes in the symbol and selects from rootData where the sym column matches the symbol selected from the dropdown.
This datasource looks like the following:
(Notice the viewstate being passed in is the same one the selected value in the dropdown maps to)
Within my function, if the passed in viewstate is empty, I return nothing from rootData. If it is not null, I return the rows from rootData where the symbol matches
Tel: +44 (0)28 3025 2242
Tel: +1 (212) 447 6700
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.