Hi there,
I am unable to initialize a QAction in a driver that I am building with an error message stating that the data is invalid. I am simply trying to log an error message with a button press as I am just figuring out how to use this functionality.
Here is the quick action in question:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;using Skyline.DataMiner.Scripting;
/// <summary>
/// DataMiner QAction Class: Test Button.
/// </summary>
public static class QAction
{
/// <summary>
/// The QAction entry point.
/// </summary>
/// <param name="protocol">Link with SLProtocol process.</param>
public static void Run(SLProtocol protocol)
{
try
{
protocol.Log("Testing button click");
}
catch (Exception ex)
{
protocol.Log("QA" + protocol.QActionID + "|" + protocol.GetTriggerParameter() + "|Run|Exception thrown:" + Environment.NewLine + ex, LogType.Error, LogLevel.NoLogging);
}
}
}
</QAction>
<QAction id="6" name="Test Button" encoding="csharp" triggers="55">
</QAction>
And here is the parameter that is triggering it:
<Param id="55">
<Name>Update Table</Name>
<Type>write</Type>
<Information>
<Subtext>Manually send out the request.</Subtext>
</Information>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>Schedule</Page>
<Column>0</Column>
<Row>0</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type width="110">button</Type>
<Discreets>
<Discreet>
<Display>Generate Table</Display>
<Value>Generate Table</Value>
</Discreet>
</Discreets>
</Measurement>
</Param>
Any help with this would be much appreciated as I am very new to this functionality.
Thank you
Hi Tyler,
I recreated the setup you provided in your post, but didn't get the error. I've pushed my resulting protocol, which was started from the DIS protocol template, to github: FlorisCO/Dojo_QActionLog (github.com)
This was tested on an internal build of 10.3.8, but I see no reason why this would fail on earlier versions.
Do you see any significant difference between my version and yours? Can you share the actual protocol where you encounter this problem? What is your DataMiner version?
Hi Tyler,
When using a protocol solution, the QAction code is stored in separate .cs files whereas this used to be part of the XML while editing. With a solution, the protocol needs to be uploaded using the “publish” button, or exported through the File menu. Perhaps the XML without the code was copy-pasted, or uploaded through cube?
Hi Tyler,
Apart from one small thing here
</QAction>
<QAction id="6" name="Test Button" encoding="csharp" triggers="55">
</QAction>
which I am guessing the first line is just the ending of your previous QAction, otherwise you should have something like this
<QActions>
<QAction id="6" name="Test Button" encoding="csharp" triggers="55" >
</QAction>
</QActions>
But other than that I do not see anything wrong with your code.
Could you let us know what is the issue you are experiencing? Is it just that it does not trigger the QAction or do you see any errors in the element log file?
Hey Joao, thank you for your reply. The Qactions tag is in my code already thanfully. In terms of the error, in the protocol logs It is stating that my QActions have failed to initialize due to invalid data. I’m not sure what would be causing this.
Hey Floris,
Thank you for your help, I was able to figure it out. For some reason DIS was not embedding my code for the qaction into the XML. I was able to get around this by doing it manually.
Thank you again
Tyler