Issue with Dropdown menu

Am new to Ignition
Just trying out a data table and a drop down
Data table has 4 columns and 12 rows of values. only column one is set as Integer(id), the other columns are set as Float(dr, v_max, v_allow)

In the dropdown , it has the property binding of
SELECT distinct v_allow from test_ignition_table
and has a custom properties of “where” with the Expression of
if({Root Container.Dropdown.selectedValue} = -1 , “1=1”,
“v_allow = '” + escapeSQL ({Root Container.Dropdown.selectedStringValue}) + “’”)

on the data table, it has the query of
SELECT * FROM test_ignition_table where {Root Container.Dropdown.where}

ISSUE is:
When it is run, there is no error at all but whenever the dropdown select a value, on the data table it does not display any corresponding row.
However, whenever the value of 9.75 is selected, that particular row will be displayed.

Would appreciate any help or advise.Thank you

If your v_allow column is numeric, remove your quoting in your where property’s expression.

Thanks for kind reply
Not sure if I understood correctly. But the issue is still not solved.
After removing the “where” from the query in data table as follows:
SELECT * FROM test_ignition_table

Basically, when the drop down is selected for any value, the data table always show all the rows, it does not show the particular row that corresponds to the value selected in the dropdown.

After trying out different things or to troubleshoot, still could not figure out what went wrong or what is missing.
Would appreciate any advise/help. Thank you.

Leave your where clause as is but remove the quote (’) delimiters:

"v_allow = " + escapeSQL ({Root Container.Dropdown.selectedStringValue}))

Thanks @bfuson and @pturmel. Its finally working after removing the quote (’) delimiters and also changing all the data table columns from float to decimal.

By the way, I have encountered further difficulties and would greatly appreciate any advise/help. Not sure should i start in a new topic but i thought just continue here(my apologies if it is not suppose to be):

Q1) Wonder how is it possible to generate a plot of two curves on the same graph based on the data (Eg the data table as shown the picture in post 2 above)?
1)first curve is v_max(y axis) versus dr(x axis)
2)second curve is v_allow(y axis) versus dr(x axis)
Q2)is there any curve fitting to use(eg polynomial etc that is used in Excel) to best fit a curve to respective data?
Q3)Let say, there is new information/data Eg dr=8.1, which does not exist in the data table
a)how could it be used to interpolate to find out the values of v_max and v_allow that correspond to dr = 8.1 based on the best fitting curve?

[quote=“liau.kwongweng, post:5, topic:16885”]
Q1) Wonder how is it possible to generate a plot of two curves on the same graph based on the data (Eg the data table as shown the picture in post 2 above)?1)first curve is v_max(y axis) versus dr(x axis)2)second curve is v_allow(y axis) versus dr(x axis)[/quote]
Use the Classic Chart in XY Plot mode. Place your x-axis data in the first column of your dataset, then the remaining columns will be y-axis.

[quote=“liau.kwongweng, post:5, topic:16885”]
Q2)is there any curve fitting to use(eg polynomial etc that is used in Excel) to best fit a curve to respective data?[/quote]
No, you’ll have to do it in a script with your own curve fit equation. The script would generate many values in a dataset for the chart to display, enough to make the line segments show the curvature.

1 Like

Hello @pturmel
Thanks for kind reply
Had done it using Chart using two data sets
1)Data - v_allow versus dr (using the SQL query SELECT dr, v_allow FROM test_ignition_table)
2)Data2 - v_max versus dr (SELECT dr, v_max FROM test_ignition_table)
So on the Y-axis tab(on the Chart Customizer), there is v_allow and v_max

Now the question is, there is two axis shown on Y-axis and both axis are scaled differently, so the curves does not look proportional to each other so much so that at around dr=6.0++, the two curves seem to be touching each other but in actual fact, should not be the case.

Q1)Hence is there any way to scale both axis correctly?
Q2)Is there anyway to just use one Y-axis but able to plot out the two curves
(v_allow versus dr) and (v_max versus dr) whereby the values of v_allow and v_max are almost within the range of each other(difference could just be at most 4-5)?

Thanks so much for any advise/help

Yes to both questions. Either change the plot datasets to use the same y_axis, or combine your data into one dataset:

SELECT dr, v_allow, v_max
FROM test_ignition_table