Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Table Support  (Read 17374 times)
Gary C.
Posts: 109


« on: June 26, 2011, 04:45:40 pm »

Hi

I think I have read that version 3.0 will offer support for a table object for use in report writing.

In the meantime, does anyone have any suggestions on how to go about creating a report which contains a table with a varying row and column count?

Thanks

Gary
Alex G.
Four Js
Posts: 155


« Reply #1 on: June 27, 2011, 09:03:47 am »

Hi,
the table development is ongoing but if the table isn't too complicated (colspan, rowsspan, repeating headers, etc.) it can be made  from the primitive elements without too much trouble.  Find attached an example that creates a table with 100 rows and 10 columns. Note that the number of columns could be changed at runtime.
Regards,
Alex

* DynamicTable.zip (2.29 KB - downloaded 1150 times.)
Gary C.
Posts: 109


« Reply #2 on: June 27, 2011, 05:56:10 pm »

Thanks - that's a great help and I have managed to achieve the desired results.

Regards

Gary
Silvia A.
Posts: 6


« Reply #3 on: July 20, 2011, 11:09:17 am »

Hi,
I've built a dynamic table thanks to your example, but I can't manage to create the column titles dynamically,depending on the number of columns.
I try to add a similar itemSeparator layout node, with the for and forItem elements, placed on the page header of the .4rp.
In the report .4gl, I have two for bucles


REPORT r_dynamic_table(rowNo)
    DEFINE rowNo,colNo INTEGER,
                titCol    char(30)

ORDER EXTERNAL BY rowNo

FORMAT

ON EVERY ROW 
    FOR colNo=1 to 10
      LET titCol = ldata[colNo]
      PRINT titCol
    END FOR 
    FOR colNo=1 TO 10
        PRINT colNo,rowNo
    END FOR
END REPORT


But when running the report it only shows the column titles.

Does anyone know how to identify different FOR elements, or how to achieve this?

Thanks,

Silvia Arduán
Alex G.
Four Js
Posts: 155


« Reply #4 on: July 20, 2011, 11:47:57 pm »

Find attached an example that creates a table with dynamic row titles. The 4GL is nearly identical to your example with the difference that the "header loop" is executed only once on the first row.
Regards,
Alex

* DynamicTable.zip (2.55 KB - downloaded 1161 times.)
Silvia A.
Posts: 6


« Reply #5 on: July 21, 2011, 11:25:42 am »

Thanks Alex, that's what I need.

Regards,
Silvia
 
.
Posts: 20


« Reply #6 on: July 25, 2011, 11:20:43 am »

Hi Alex,

I have edited DynamicTable.4gl to have 20 columns, I am not sure why column 13 to 20 headings are wrapping over to the row below ?

Thanks
Bothwell
.
Posts: 20


« Reply #7 on: July 25, 2011, 11:30:18 am »

I forgot to mention that that I have changed device to XLS. so I have

CALL fgl_report_selectDevice("XLS")

........


ON EVERY ROW
    IF rowNo==1 THEN
        FOR colNo=1 to 20
          LET titCol = "Title "||colNo
          PRINT titCol
        END FOR
    END IF
    FOR colNo=1 TO 20
        PRINT colNo,rowNo
    END FOR
Alex G.
Four Js
Posts: 155


« Reply #8 on: July 25, 2011, 02:57:02 pm »

Hi Bothwell,
making the paper wider either in the menu "Report properties/paper settings.." or via the API call fgl_report_configurePageSize() will solve the problem.
If you run the report in SVG with 20 columns you will see more clearly how both the data and the title rows wrap. Setting the paper to landscape already makes the wrapping start at column 16 and adding a few more centimeters makes it go away altogether. If the table spans several pages then you might want to consider using the option "mergePages" in a call to the API function fgl_report_configureXSLDevice(). In this case, if you are required to produce both SVG/PDF and Excel with the same design file then you might also consider using then RTL "Runtime" functions to prevent the headers from being repeated for each page. This can be achieved by setting the expression "Runtime.producingExcelOutput()?Port.FirstPageHeader:Port.AnyPageHeader" on the "Section" property of "Any Page Header". In addition to that you may want to remove the rulers like "Row Separator" using an expression like "!Runtime.producingExcelOutput()" on the "Visibility Condition" of these elements. If the report design is dedicated fo Excel only then I suggest to change the headers statically to "FirstPageHeaders" and to remove all rulers. You can set a lager value (e.g. 3 meters) for the paper width to make sure that wide tables will not wrap but don't do the same for the page height because it will break the streaming.
Regards,
Alex
Gary C.
Posts: 109


« Reply #9 on: July 25, 2011, 08:53:57 pm »

Alex

That's great advice! I have just literally added functionality to cater for XLS format verses PDF using multiple 4rp files. Yours offers a far more elegant solution.

Thanks

Gary
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines