Page 1 of 1

Write a report.

Posted: Tue Apr 08, 2025 8:39 am
by x4Trace
You can reach the reports on the main page of the x4Trace "Reports" menu.

You can find this report in the x4Trace sample database. Its name is Order instance values.

This report reports the traced values of products.

The SQL statement is the next:

Code: Select all

select instancesandvalues.instanceid as ID, 
instancesandvalues.code as Code, 
(select name from FlowVariable where flowid = (select flowid from[Order] where id = @orderid) and FlowVariable.varid = instancesandvalues.varid) as Parameter,
instancesandvalues.val as [Value]
from
(select OrderInstance.instanceid, OrderInstance.code, allvalues.varid, allvalues.val from 
(select * from OrderInstance where orderid = @orderid) as OrderInstance inner join 
((select instanceid, varid, val from ProductionProcessOutputVarTxt where orderid = @orderid) union all (select instanceid, varid, concat('',round(val, 2)) as val from ProductionProcessOutputVarNum where orderid = @orderid)) as allvalues 
ON OrderInstance.instanceid = allvalues.instanceid) as instancesandvalues order by [Code], [Value]
The report has a parameter, this is the order.
This parameter's GUI is a combo box. You can set the GUI in the type column of the input grid. The report is edited on the left side, and the report is viewed on the right side.
reportorderinstance_orderparam.png
reportorderinstance_orderparam.png (122.26 KiB) Viewed 1358 times
The variable name is @orderid. This variable name is used in the SQL statement.
reportorderinstance_orderparam_orderid.png
reportorderinstance_orderparam_orderid.png (122.04 KiB) Viewed 1358 times
You can set the combo box's values by filling the input control's CMD.
reportorderinstance_orderparam_combocmd.png
reportorderinstance_orderparam_combocmd.png (106.67 KiB) Viewed 1358 times

Re: Write a report.

Posted: Tue Apr 08, 2025 9:07 am
by x4Trace
When the SQL statement runs, the result will be the next.
The variables and values of instances are on the right side.
reportorderinstance_run.png
reportorderinstance_run.png (111.67 KiB) Viewed 1351 times