In Vision, I am able to create a SQL query that are (n X m) in dimension and then extract the (m) values into parameters to be used in other components. In Perspective I am having trouble doing this?
I have created a view in Perspective. It contains a Dropdown component that is bound to a named queue:
OID AS value,
WRK_CNTR_CD AS label,
FROM SAP_WRK_CNTR WITH(NOLOCK)
WHERE PLNT_CD = :myValueX
ORDER BY WRK_CNTR_CD ASC
Which is returning a dataset of 21x3 and displays it correctly in the dropdown. The selection of the label changes the PROPS.value as expected.
I then added a custom property, on the Dropdown, called test, which has the following property binding and transform
def transform(self, value, quality, timestamp):
Transform the incoming value and return a result.
self: A reference to the component this binding is configured on.
value: The incoming value from the binding or the previous transform.
quality: The quality code of the incoming value.
timestamp: The timestamp of the incoming value as a java.util.Date
2 if self.props.value == “”: #account for no selection on dropdown
3 returnValue = “”
5 returnValue = self.props.options[value].label
6 return returnValue
I get the following error message in the script:
Error_ScriptEval,”Traceback(most recent call last):
File “” line 5, in transform TypeError:”’com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataSet’ object is unsubscriptable”)
Have I setup something incorrectly in the Dropdown Dataset that it is not recognizing it as a dataset?