Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
Dynamic formats in a VFP9 report
The object-oriented report writer is a powerful tool but it can take a lot of effort to get the best out of it. One new feature though is very easy to use. This lets you apply dynamic formatting to rows in a report.
Dynamic formatting - changing the appearance of the field being displayed so as to highlight interesting data - is something that clients often ask for and their interest has grown in recent years as they've bought colour lasers. They now routinely print their Excel charts in colour and they'd like their FoxPro reports in colour too.
We could do this in previous versions of FoxPro but it was hard work. If you wanted a field to appear in red when its value was negative then you had to create two textboxes on the report - one in red and one in black - and use Print When statements to control which of them would be visible.
Applying a dynamic format
This effect is much easier to achieve in the Visual FoxPro 9 Report Writer:
- Double-click on the textbox to open the Field Properties Window.
- Select the Dynamics tab.
- Click to add a new text formatting rule.
- Give the rule a suitable name and the Configure Dynamic Properties dialog will open as shown in the screen shot opposite.
- Set the format you'd like to see when this rule evaluates as true. In this example I've asked for blue text on an opaque cyan background.
- Click to close this dialog and again to close the Field Properties dialog.
Printout
The preview below shows how "Around the Horn", the only UK-based supplier in this extract, has been displayed in blue against a cyan background. Note that only the one field has been affected. You have to repeat the formatting for the other two textboxes to highlight the entire line.