How to change font type on a report when a particular condition applies
How to change font type on a report when a particular condition applies
(OP)
Hello
I recently resolved my problem on thread https://www.tek-tips.com/viewthread.cfm?qid=182529... (thank you)
This is a follow on from that thread and would like to know how to change font type using "Print when" or other method on a report when a particular condition applies.
I am aware of examples in the controls properties section such as:
Print only when expression is true: not empty(mydate)
or
Print only when expression is true: mynumber>0
One field in my table COSTMASTER is called CATYPE and it is that field the word INVOICE is shown in some records
The default font for that field is: Arial, Regular, 8
If the word INVOICE is in the record, how do I change the font to something like: Arial, Bold, 10
I recently resolved my problem on thread https://www.tek-tips.com/viewthread.cfm?qid=182529... (thank you)
This is a follow on from that thread and would like to know how to change font type using "Print when" or other method on a report when a particular condition applies.
I am aware of examples in the controls properties section such as:
Print only when expression is true: not empty(mydate)
or
Print only when expression is true: mynumber>0
One field in my table COSTMASTER is called CATYPE and it is that field the word INVOICE is shown in some records
The default font for that field is: Arial, Regular, 8
If the word INVOICE is in the record, how do I change the font to something like: Arial, Bold, 10
Thank you
Steve Williams
VFP9, SP2, Windows 10
RE: How to change font type on a report when a particular condition applies
But what you already know can also be used with fixed font layouts. You just need two report controls or labels you position at the same place in the report, one prints when At("INVOICE",catype)>0, ie INVOICE is within the field, and one that prints when At("INVOICE",catype)=0, ie when INVOICE is not in the text. So alwayys one of the two controls print, the other doesn't. That spares you creating two reports.
Besides, you could simply have a logical field within the report data that tells that difference for the print when condition, which also makes you independent from the exact word, just decides the two layouts that way.
So all in all it just means positioning two things at the same position, you can easily do that by selecting the second one and using the arrow keys to move it at the same position.
Chriss
RE: How to change font type on a report when a particular condition applies
This can get a bit complicated when there are many items one the same line - so to speak - but if you just have
a single line with two possible conditions for a single element like Credit Note or Invoice, you can combine the
'print when' with a 'remove line if blank' and position the two elements one above the other vertically (not in the z axis)
Regards
ing
Griff
Keep
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
There is no place like G28 X0 Y0 Z0
RE: How to change font type on a report when a particular condition applies
I’ll try out your suggestion
Thank you
Steve Williams
VFP9, SP2, Windows 10
RE: How to change font type on a report when a particular condition applies
While editing the COSTMASTER.CATYPE field properties, select the Dynamics tab and add a new condition (for instance, "IsInvoice").
Set the condition and adjust the font to your requirements. For instance:
RE: How to change font type on a report when a particular condition applies
When changes need to be more complicated, like a different position, alignement, size of the field, using a second textbox and the "print when" option is the easiest way.
You can also dynamically change the report before issuing REPORT FORM during runtime by using the report like a table:
USE myreport.frx
Then you can change the record corresponding to the specific control you want to change. You can add a comment first to the control (in the field properties click on the "Others" tab) to be able to identify the record of the control later on by locating for the record which contains your comment. I find this document very helpful in understanding the structure of the report-dbf-file:
http://portal.dfpug.de/dfpug/Dokumente/FoxTalk/Fox...
But this is kind of advanced and not needed in most cases.
Regards,
Manni
RE: How to change font type on a report when a particular condition applies
Chriss
RE: How to change font type on a report when a particular condition applies
I tried your suggestion but the font didn't change. I also change the SET REPORTBEHAVIOR TO 90 as Chriss suggested but still no effect.
I then tried out the overlapping putting a duplicate field over the top of the original, changed the field font settings and added the condition to the "print when...."
This has now resolved my question.
I will however have a look at why perhaps the Dynamic Properties suggested by atlopes didn't work in my case, I never knew about that function.
Thank you
Steve Williams
VFP9, SP2, Windows 10
RE: How to change font type on a report when a particular condition applies
I think António's suggestion depends on having SP2 installed for VFP 9.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: How to change font type on a report when a particular condition applies
Regards,
Manni
RE: How to change font type on a report when a particular condition applies
Thank you for your post
Mike
If you look at my footer profile, I have SP2 installed!
Thank you
Steve Williams
VFP9, SP2, Windows 10
RE: How to change font type on a report when a particular condition applies
2. When you want your EXE to be able to use the VFP9 report engine you must also provide the report engine APPs, at least the ReportOutput.app
In general, consult the FoxPro help file about the new VFP9 report engine to make use of it. If you don't you fall back to the legacy report engine of VFP8 or lower, as 90 report engine is not embedded within the vfp9r.dll runtime.
Chriss
RE: How to change font type on a report when a particular condition applies
The "SET REPORTBEHAVIOR TO 90" was a typo. I just checked my PRG and it is set to "SET REPORTBEHAVIOR 90" but thanks for pointing that out.
Thank you
Steve Williams
VFP9, SP2, Windows 10
RE: How to change font type on a report when a particular condition applies
there could always be an error handler just logging errors and not showing them. But then again, the second point is more important. If you don't run with the reportoutput.app present and set in the _reportoutput system variable you only run with legacy report features and whatever you configure in terms of danmic properties is ignored without any error, even when you SET REPORTBEHAVIOR 90. So that is more important. I suggested you read about the new report engine in the help file, it has all details you need to know to use it, both within the IDE and deployed with an EXE.
Chriss