Procedure
|
You are editing a report definition.
- Click the Data tab.
- From the main menu, click File | New | Query Wizard.
- Select the Employee table.
- Click the Design tab.
- Click the Variable button and then click in the Detail band to create the Variable field.
- Click the Calc tab.
- In the main menu, click View and ensure that Events, Toolbox, and Messages are ticked.
- In the Report Objects window expand the Detail band and click the Variable1 component.
- In the Events window, click OnGetText.
- Click inside the Code Entry Window to view the code
- In the Code Toolbox, click the Language mini-tab. In the top section of the Code Toolbox, click Statement.
- Drag and drop if..then..else from the Code Toolbox to the Code Entry Window between 'Begin' and 'Value:='.
- Click the Data mini-tab.
- Click the Employee data query.
- Drag and drop the Apprentice field into the Code Entry Window in place of the term 'Expression', and then type '=true'.
- Type a term in place of the two 'statement' words, within single quotes and preceded by 'Value: ='. Make sure that the last statement has ';' after the final single quote:
procedure Variable1OnGetText (var Text: String);
begin
if plEmployee['Apprentice']=true
then Text := 'Is Apprentice'
else Text :='Is not Apprentice';
end;
|