Hi Jose,
There is the sample report DynamicColumnsTable.4rp which demonstrates a possible technique.
I quickly creates a simpler version for you just now. I have this 4gl:
$cat Jose.4gl:
IMPORT FGL greruntime
CONSTANT NUMBER_OF_COLUMNS=3
CONSTANT NUMBER_OF_ROWS=6
MAIN
DEFINE saxHandler om.SaxDocumentHandler,
row,col INTEGER,
value DECIMAL(10,2)
IF NOT fgl_report_loadCurrentSettings("Jose.4rp") THEN
EXIT PROGRAM
END IF
CALL fgl_report_selectDevice(getPreviewDevice())
LET saxHandler=fgl_report_commitCurrentSettings()
START REPORT DynamicColumnReport TO XML HANDLER saxHandler
FOR row = 1 TO NUMBER_OF_ROWS
FOR col = 1 TO NUMBER_OF_COLUMNS
OUTPUT TO REPORT DynamicColumnReport(NUMBER_OF_COLUMNS,row,col,row*123+col*456)
END FOR
END FOR
FINISH REPORT DynamicColumnReport
END MAIN
REPORT DynamicColumnReport(numberOfColumns,row,col,value)
DEFINE numberOfColumns,row,col,titleColumn INTEGER,
value DECIMAL(10,2)
ORDER EXTERNAL BY numberOfColumns,row
FORMAT
BEFORE GROUP OF numberOfColumns
FOR titleColumn = 1 TO numberOfColumns
PRINT titleColumn
END FOR
ON EVERY ROW
PRINT row,col,value
END REPORT
FUNCTION getPreviewDevice()
DEFINE fename String
CALL ui.interface.frontcall("standard", "feinfo", ["fename"],[fename])
RETURN iif(fename=="Genero Desktop Client","SVG","PDF")
END FUNCTION
and this design:
$cat Jose.4rp:
<?xml version="1.0" encoding="UTF-8"?>
<report:Report xmlns:rtl="
http://www.4js.com/2004/RTL" xmlns:report="
http://www.4js.com/2007/REPORT" xmlns="
http://www.4js.com/2004/PXML" gstVersion="40a00" version="7.00">
<report:Settings RWPageWidth="letterwidth" RWPageLength="letterlength" RWLeftMargin="0.5inch" RWTopMargin="0.5inch" RWRightMargin="0.5inch" RWBottomMargin="0.5inch">
<report:FormatList>
<report:Format-SVG/>
<report:Format-PDF/>
<report:Format-image/>
</report:FormatList>
</report:Settings>
<report:Data RWDataLocation="Jose.rdd" RWFglReportName="DynamicColumnReport"/>
<report:Conflicts/>
<rtl:stylesheet>
<PXML>
<rtl:match name="Report" nameConstraint="Report" minOccurs="1" maxOccurs="1">
<rtl:match name="Group numberOfColumns" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
<MINIPAGE name="Page Root" width="max" length="max">
<LAYOUTNODE name="Page Header" width="max" length="min" port="anyPageHeader">
<MINIPAGE name="StripeLayouter3" width="min" length="max" layoutDirection="leftToRight">
<WORDBOX name="Report Title" x="0" y="max/2" anchorX="0" anchorY="0.5" alignment="baseline" fontSize="25" baselineType="leftleft" floatingBehavior="enclosed" text="Report Title Here"/>
<PAGENOBOX name="PageNoBox" x="1.23857" y="max" anchorX="0" anchorY="1" alignment="baseline" baselineType="leftleft" floatingBehavior="enclosed" textAlignment="right"/>
</MINIPAGE>
<MINIPAGE name="Table Header" class="grwTableHeader" width="min" length="max" layoutDirection="leftToRight">
<WORDBOX name="Spacer" alignment="baseline" baselineType="leftleft" port="itemSeparator" text=" "/>
<rtl:match name="BeforeGroup numberOfColumns" nameConstraint="BeforeGroup" minOccurs="1" maxOccurs="1">
<rtl:match name="For" nameConstraint="For" minOccurs="1" maxOccurs="1">
<rtl:match name="ForItem" nameConstraint="ForItem" minOccurs="0" maxOccurs="unbounded">
<WORDBOX name="titleColumn Title" designHints="fieldName:titleColumn;fieldRole:TableColumnTitle" class="grwTableNumericColumnTitle" width="{max(width("{"TitleColumn".translate()}"),width("-0000000000"))}" floatingBehavior="enclosed" textAlignment="right" text="TitleColumn" localizeText="true"/>
</rtl:match>
</rtl:match>
</rtl:match>
</MINIPAGE>
<MINIPAGE name="Separator" width="1" length="max" bgColor="#000000" layoutDirection="leftToRight"/>
</LAYOUTNODE>
<rtl:match name="Group row" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
<MINIPAGE name="Table Row" class="grwTableRow" width="min" length="max" layoutDirection="leftToRight">
<WORDBOX name="Spacer_1" alignment="baseline" baselineType="leftleft" port="itemSeparator" text=" "/>
<rtl:match name="OnEveryRow" nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
<rtl:input-variable name="value" type="FGLNumeric" expectedLocation="expectedHere"/>
<DECIMALFORMATBOX name="value Value" designHints="fieldName:value;fieldRole:TableColumnValue" class="grwTableNumericColumnValue" width="{max(width("{"Value".translate()}"),width("-00,000,000.00"))}" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="--,---,--&.&&" value="{{value}}"/>
</rtl:match>
</MINIPAGE>
</rtl:match>
</MINIPAGE>
</rtl:match>
</rtl:match>
</PXML>
</rtl:stylesheet>
</report:Report>
I hope that this works as a starting point.