×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to change font type on a report when a particular condition applies
4

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

Thank you

Steve Williams
VFP9, SP2, Windows 10

RE: How to change font type on a report when a particular condition applies

There are no DynmicFontBold or other dynamic properties of report controls like these exist for grid columns, for example. and while VFP9s report engine (90) has some advanced features like printing rotated text, and colors, that hasn't changed. I think there was some project in VFPX that allow usage of HTML style tags, which means you can mix bold and non-bold and some other font modifiers.

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

Chriss is right about 'overlapping' elements and setting them to have mutually exclusive 'print when' conditions.

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

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

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

(OP)
Chriss, Griff

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

Steve,

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

Yes, the way Antonio describes it is the same way I do it when I only need to change the font size or color dynamically. Notice that you can also make the font bold by changing the font itself (there is no checkbox for the "bold propterty" like on a form).

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

I realize what atlopes posts is in fact the dynamicXYZ I said is only available in grid columns. I forget they integrated it into the VFP9 report engine. Just notice you need to SET REPORTBEHAVIOR 90 to let this work at all.

Chriss

RE: How to change font type on a report when a particular condition applies

(OP)
atlopes

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

Quote:

I tried your suggestion but the font didn't change.

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

Steve, after adding a dynamic property, make sure, that "Print when" is empty, in case you have experimented with this option before. Also double check in the menu of the dynamic property if the condition you entered in "Apply when this condition is true" is really true before you report the form (i.e. first use simply .T. for test purposes) and that the field "Replace expression result with:" is empty. It should work, I've used it many times.

Regards,
Manni

RE: How to change font type on a report when a particular condition applies

(OP)
Mannib

Thank you for your post

Mike

Quote:

I think António's suggestion depends on having SP2 installed for VFP 9.

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

1. The command to use is SET REPORTBEHAVIOR 90 not SET REPORTBEHAVIOR TO 90
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

(OP)
Chriss

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

Steve,

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close