I have a toggle and a qaction which is triggered on 18019(write parameter). The qaction will setParameter to other column values in the table based on the toggle.
One of the column is a datetime and another is range bound number control. When the toggle is enabled I disable one of these columns. With the qaction I want to set it to NA which will then be set to N/A in dataminer as greyed out parameter. The setParameter is not setting the values or throwing any errors. Is this possible to set? what am i missing?
<Param id="18009">
<Name>Data transform</Name>
<Description>Data transform</Description>
<Type>read</Type>
<Interprete>
<RawType>numeric text</RawType>
<LengthType>next param</LengthType>
<Type>double</Type>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
</Display>
<Measurement>
<Type>discreet</Type>
<Discreets>
<Discreet>
<Display>Scheduled</Display>
<Value>0</Value>
</Discreet>
<Discreet>
<Display>Offset</Display>
<Value>1</Value>
</Discreet>
</Discreets>
</Measurement>
</Param>
<Param id="18019" setter="true">
<Name>Data transform</Name>
<Description>Data transform</Description>
<Type>write</Type>
<Interprete>
<RawType>numeric text</RawType>
<LengthType>next param</LengthType>
<Type>double</Type>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
</Display>
<Measurement>
<Type>togglebutton</Type>
<Discreets>
<Discreet>
<Display>Scheduled</Display>
<Value>0</Value>
</Discreet>
<Discreet>
<Display>Offset</Display>
<Value>1</Value>
</Discreet>
</Discreets>
</Measurement>
</Param>
Below is snippet of qaction- when I log toggleValue it always return 0, no matter what is pressed on toggle. And the setParameter does not set anything.
public static void Run(SLProtocol protocol)
{
var toggleValue = protocol.GetParameter(18019)?.ToString();
if (toggleValue == "1")
{
protocol.SetParameter(18017, "NA"); // write parameter
} else
{
protocol.SetParameter(18018, "NA"); // write parameter
}
}
This is how I plan to handle "NA" once setParameter works.
<Exception id="1" value="NA">
<Display state="disabled">N/A</Display>
<Value>NA</Value>
</Exception>
</Exceptions>
Hi Miguel, yes I have added that already. Any other tips let me know
Hi,
The write parameter has setter="true" defined. In such case it will set the value on the read parameter 18009, but if there is then a trigger on the write parameter it will not be possible anymore to get the value of the write parameter through the QAction.
To fix this:
-Remove the setter="true" attribute from the write parameter
-Make sure that row="true" is present on the QAction
-In the QAction execute string rowKey = protocol.RowKey(); to get the row key as this is needed to fill in the read parameter.
-Set the read parameter from the QAction by using protocol.SetParameterIndexByKey(18000, rowKey, 9, toggleValue) (note that "9" is the one based column position of the read parameter, so if idx="8" then 9 should be used here, and I'm assuming that 18000 is the parameter id of the table)
Regards,
Hi Laurens, thank you for your response. I have tried those steps but no luck. Once i remove the setter=true, the UI will not store the new value in the read parameter so I have added that back in. would you advise to trigger on the read parameter instead?

Hi Samita,
If you remove setter = true, it's expected that the read parameter won't reflect updated values. However, when triggering the QAction, you can retrieve the value from the write parameter and explicitly set it on the read parameter within the QAction logic.
That makes sense, I added it like this after removing the setter but I am not seeing the value reflected on frontend for 18019.
public static void Run(SLProtocol protocol)
{
protocol.Log("QAction triggered by toggle (18019)", LogType.Information);
// Read the write param directly (this is what the toggle sets)
var toggleValue = protocol.GetParameter(18019)?.ToString();
string rowKey = protocol.RowKey();
protocol.Log($"Toggle value is {toggleValue}", LogType.Information);
if (toggleValue == "1")
{
protocol.SetParameterIndexByKey(18000, rowKey, 8, "NA");
protocol.SetParameterIndexByKey(18000, rowKey, 10, "0");
var confirm = protocol.GetParameter(18007);
protocol.Log("18017 after setting to NA: " + (confirm == null ? "null" : confirm.ToString()), LogType.Information);
}
else
{
protocol.SetParameterIndexByKey(18000,rowKey,9, "NA");
protocol.SetParameterIndexByKey(18000, rowKey, 10, "1");
var confirm = protocol.GetParameter(18008);
protocol.Log("18018 after setting to NA: " + (confirm == null ? "null" : confirm.ToString()), LogType.Information);
}
}
NA isn't being set either as my log returns below. Am i setting up SetParameterIndexByKey incorrectly?
18018 after setting to NA: 0
Hi,
If you are setting a row from a table, are you using the option row=True in the QAction tag?
https://docs.dataminer.services/develop/schemadoc/Protocol/Protocol.QActions.QAction-row.html