The ReportEngine.AfterAddField script is called after a field is added to a report in a report wizard. This can be used, for example, to modify the default settings for the field or give a warning if the field shouldn't be used under some circumstances.
Parameters
A reference to the Stonefield Query Application object, a reference to a Report object for the report, and a reference to the newly added ReportField object.
Return Value
Any value (Stonefield Query ignores the return value).
Example
Here's an example that gives a warning if fields from the OEINVD table are included in a report with fields from the OEINVDCRDD table.
Visual FoxPro
lparameters toApplication as SQApplication, ;
toReport as Report, toField as ReportField
local lnI, loField as ReportField, lcAlias, ;
llHaveCombined, llHaveDetail
for lnI = 1 to toReport.Fields.Count
loField = toReport.Fields.Item(lnI)
lcAlias = loField.Alias
do case
case lcAlias = 'OEINVDCRDD'
llHaveCombined = .T.
case lcAlias = 'OEINVD'
llHaveDetail = .T.
endif
next
if llHaveCombined and include fields from
toApplication.ShowErrorMessage('You should not ' + ;
'include fields from Invoice Details on the ' + ;
'same report as Combined Invoice & Credit Note Details.')
endif
See also
Scripts© Stonefield Software Inc., 2024 • Updated: 01/13/17
Comment or report problem with topic