Features, discussions, tips, tricks, questions, problems and feedback

Use different Data Row Splitters to feed a Trend/Chart

Hello All,

I would like to create a Bar Chart like this:

image

Each operation has two bars representing the number of incidents. I have a query that retrieves the following result:

image

I tried to use a Data Row Splitter to generate the chart, but I encountered an issue. When I insert data from a query that passes through the Data Row Splitter to filter it and load into the Bar Chart, the value always remains the same as the last one I connected. It seems to happen because, in the chart properties, the value field only shows the name of the output dragged from the Data Row Splitter. Since it comes from the same query, it has the same name for all outputs.

Is there a way to resolve this issue, or is there a better method to achieve this?

Regards,

Douglas

Hi Roldan.

I sent you a private message. I will need your data and graphic form to replicate this on my side.

Hi Roldan,

Driving individual bars is dependent on unique data element names.

When using a Data Row Splitter spider the output data element name is always the column name you are returning. Hence why you get the issue you are experiencing. The typical use case of driving individual bars is from unique data elements like adroit tags.

I have replaced your Data Row Splitter spider with a Script Spider which will do the row split with outputting unique data element names like below:

image

The script to do this is as follows. I get the data table from the output of the QuerySpider on input var 1 of the Script Spider and I split the rows of the data table and return each rows IncidentCount into outputs var 1… var 6 which we link up to their relevant bars.

// get the dataset from the output of the query spider
DataElement inputDE = MyInputs["var 1"] as DataElement;
DataSet inputDS = inputDE.Value as DataSet;
DataTable inputDT = inputDS.Tables[0];

DataRow inputRow = null;
int rowNumber = 1;
int incidentCount = 0;
DataElement outputDE = null;

// split each row of the data table and output each one to its relevant output var 1.... var 6
for (int a = 0; a < inputDT.Rows.Count; a++)
{
    inputRow = inputDT.Rows[a];
    rowNumber = (int)inputRow["RowNumber"];
    incidentCount = (int)inputRow["IncidentCount"];

    outputDE = DataElementEngine.NewDataElement("Row" + rowNumber);
    outputDE.Value = incidentCount;

    MyOutputs["var " + rowNumber] = outputDE;
}

I have attached your modified sample graphic form below:

Adroit Support.viz (58.3 KB)

As discussed further we had to change the types for rowNumber and incidentCount to Int64 and Int32 respectively as they are like this SQL:

image .

Modified script below:

image

1 Like