Hi
I noticed when trying to display a XML string in a grid component in LCA, that it is not displayed as the raw string.
E.g.:
New2604776177644032024/04/18 15:30:002024/04/18 16:00:002024/04/18 19:00:004a27bd2c-c010-409f-940b-3f512465c65d3 JPEG 2Kj2k150-PPNFL Atlanta Falcons vs. New Orleans SaintsSkyline Communications12906721280485150.5281MercedesBenzStadiumATLNFLMCRNY2024/04/13 05:10:12
Instead of:
<NMSHost><CircuitSetup><MessageType>New</MessageType><CircuitID>2604776</CircuitID><SharedID>17764403</SharedID><tLead>2024/04/18 15:30:00</tLead><tStart>2024/04/18 16:00:00</tStart><tEnd>2024/04/18 19:00:00</tEnd><ServiceType>4a27bd2c-c010-409f-940b-3f512465c65d</ServiceType><ServiceDescription>3 JPEG 2K</ServiceDescription><ServiceID>j2k150-PP</ServiceID><JobName>NFL Atlanta Falcons vs. New Orleans Saints</JobName><Client>Skyline Communications</Client><SequenceNumber>1290672</SequenceNumber><WorkOrder>1280485</WorkOrder><Capacity>150.528</Capacity><ProtectionID>1</ProtectionID><Source>MercedesBenzStadiumATL</Source><Path><Node>dtm11:1_LA-688-2</Node><Node>dtm2:8_LANim9</Node><Node>dtm6:1_TOR-688-1</Node><Node>dtm1:4_NYNim11</Node></Path><Destination>NFLMCRNY</Destination><TimeStamp>2024/04/15 08:23:42</TimeStamp></CircuitSetup></NMSHost>
How can I display the raw string in my grid component? (my string is a field of a DOM instance)
Based on the answers above I used this custom GQI operator to encode the column in my table (or a duplicated column). It uses HtmlEncode from System.Web
Note: make sure to set the following in your script XML:
<Param type="preCompile">true</Param>
<Param type="libraryName">HTMLEncode</Param>
GQI operator
using Skyline.DataMiner.Analytics.GenericInterface;
using System.Web;
{
private GQIColumnDropdownArgument _htmlColumnArg = new GQIColumnDropdownArgument("Column") { IsRequired = true, Types = new GQIColumnType[] { GQIColumnType.String } };
private GQIColumn _htmlColumn;
public GQIArgument[] GetInputArguments()
{
return new GQIArgument[] { _htmlColumnArg };
}
public OnArgumentsProcessedOutputArgs OnArgumentsProcessed(OnArgumentsProcessedInputArgs args)
{
_htmlColumn = args.GetArgumentValue(_htmlColumnArg);
return new OnArgumentsProcessedOutputArgs();
}
public void HandleRow(GQIEditableRow row)
{
string html;
if (!row.TryGetValue(_htmlColumn, out html))
return;
var encoded = HttpUtility.HtmlEncode(html);
row.SetValue(_htmlColumn, encoded, encoded);
}
}