PDA

View Full Version : ReportControl how to...



Boris
3-Mar-2011, 06:17 PM
Hi! VDF 16.00

I have a report with several columns.
1.) How can I start the report with a particular field as group?
2.) How can I add fields and are not "by default" shown, but only accessible thru the Field Chooser?

Thanks in Advanced.
Boris

Martin
7-Mar-2011, 03:26 AM
These are options that we have not put into the class, maybe we should.

Peter Bragg
7-Mar-2011, 06:30 AM
Actually, with regards to point (1) (Starting with a field already as the group) you can do this with the SIG class.

There is an event:



Procedure OnSetGrouping tdRC_Ordering[] ByRef taRC_Ordering
End_Procedure


The argument is a struct array with the Struct defined as:



Struct tdRC_Ordering
Integer iColumn // - Column Number (zero based)
Boolean bDescending // - True = Descending, False = Ascending
End_Struct



So within this event you basically have to to stack the array with the numbers of any columns that you want to appear already grouped (typically this would just be one but doesn't have to be). You can also specify whether it should be sorted in ascending order (the default) or descending order.

So for example, to Group by column 3 (remember groups are zero based) you would simply code the event as:




Procedure OnSetGrouping tdRC_Ordering[] ByRef taRC_Ordering
Move 3 to taRC_Ordering[0].iColumn
End_Procedure


This event is understood by the SIG report control class.

Renato Villa
7-Mar-2011, 08:49 AM
Hi Peter,

i've used your code


Procedure OnSetGrouping tdRC_Ordering[] ByRef taRC_Ordering
Move 0 to taRC_Ordering[0].iColumn
End_Procedure


the difference when the grouping is manually set , is that the grouping Column remain in the report instead only in the top of the report.

The refresh report add anytime a duplicate column of the Grouping Column.

There is something to do ?

Best Regards

Peter Bragg
7-Mar-2011, 09:30 AM
Ah yes, something I forgot. When you add the column give it a width of zero. This will mean that the column is hidden (but you can still group by it)



Procedure OnDefine_Columns
Send Add_Report_Column "Description" 300 eRC_String eRC_Standard "" ""
Send Add_Report_Column "Unit Price" 90 eRC_Currency eRC_Standard "" ""
Send Add_Report_Column "On Hand" 90 eRC_Integer eRC_Standard "" ""
//Hidden column on which to group
Send Add_Report_Column "" 0 eRC_String eRC_Standard "" ""
End_Procedure

Renato Villa
7-Mar-2011, 09:33 AM
Thank's

i try it.

And the refresh problem? Have you a sol?

Best Regards

Renato Villa
7-Mar-2011, 09:37 AM
Ok work fine

Thank's

Jose
7-Jun-2017, 05:22 AM
Hi Renato,

Have you found any solution?

I have augmented Refresh_Report in this way:


Procedure Refresh_Report
Set pbRefresh_Report to True

Forward Send Refresh_Report

Set pbRefresh_Report to False
End_Procedure


Then at the report control of the view:


Procedure OnSetGrouping tdRC_Ordering[] ByRef taRC_Ordering
Forward Send OnSetGrouping (&taRC_Ordering)

If (not(pbRefresh_Report(Self))) Begin
Move 0 to taRC_Ordering[0].iColumn
Move True to taRC_Ordering[0].bDescending
End
End_Procedure


Of course I have defined a property called pbRefresh_Report.

Regards.