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.
Any value (Stonefield Query ignores the return value).
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.
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