Report Parameter

smgomes
edited February 11, 2022 in Analytics #1
Hello,

in my template I have a REPORT PARAMETER with the name XYZ.
I need to automatically add it to my layout programmatically, it is possible?

I tried as follows, but without success :

DataItemHandle dataItemHandle = design.getElementFactory().newDataItem("XYZ");
dataItemHandle.setDisplayName("XYZ");
dataItemHandle.setResultSetColumn("params[\"XYZ\"]");
cellHandle.getContent().add(dataItemHandle);

The DataItem appears in the layout but with all blank, without expression defined :(

Thanks
Warning No formatter is installed for the format ipb

Comments

  • smgomes
    edited December 31, 1969 #2
    Found the solution! :)

    This is the code used :

    cellHandle.clearContents(0);

    ComputedColumn newComputedColumn = StructureFactory.createComputedColumn( );
    newComputedColumn.setName("XYZ");
    newComputedColumn.setDataType("String");
    newComputedColumn.setExpression("params[\"XYZ"\"]");

    DataItemHandle newDataItem = design.getElementFactory().newDataItem(null);
    newDataItem.setResultSetColumn("XYZ");
    newDataItem.addColumnBinding(newComputedColumn, true);

    cellHandle.getContent().add(newDataItem);

    Thanks anyway!
    Warning No formatter is installed for the format ipb