Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Report Designer Question: Changing Report Label content based on Checkbox Value in table

May 4, 2021
3
I could use a little bit of guidance here.

I have an existing VFP 5 Report that contains a Report Expression field that I would like to change the content of to an alternative label based on the T/F value of a field in my user's dbf. I've seen a lot of documentation, but have had very little success with my hacking on this; I am missing something very obvious I'm certain.

As a potential alternative, I've created a new report with the alternative label already nicely set, and it works fine, so if I could figure out how to launch the alt-label-report.frx from within Report Designer after the first report runs, that would also be acceptable to my user even without paying attention to the checkbox field value (as they will print this second report roughly 85% of the time anyway, and they will always need the second report if that checkbox value is T).

Thoughts?

Note: I am limited to editing the existing report or linking the existing report to a new report after printing as I do not have the ability to edit the actual VFP screens (source missing/incomplete).
 
Hi Griff,

Thank you for replying! I suppose I should clarify something;

So my existing Report Expression for the Report area in question is very simple;
Code:
table1.memofield1

Based on your guidance, would I tweak this Expression to be something like this for an expression instead?
Code:
=iif(table1.chkbox,table1.memofield1,"Nawh")

If not, just so I'm understanding your potential solution here, if Report Designer can't substitute Text for a field like I propose above, then your guidance would be to change it so it's not pulling the memo field at all.
 
You can use Griff's suggestion, or you can create two different labels (one overlapping the other). Set the Print When for each label to the field value in the table. If this field is a boolean, then one label's Print When would be "my.tablechkbox" and the other label's Print When would be "!my.tablechkbox".
 
You can use Griff's suggestion, or you can create two different labels (one overlapping the other). Set the Print When for each label to the field value in the table. If this field is a boolean, then one label's Print When would be "my.tablechkbox" and the other label's Print When would be "!my.tablechkbox".
Thank you, I will try this as well and I'll report back.
 
I use both methods, depending on the difference in length between the two labels, when they are both small, and similar in size, it can be harder to 'debug' later
because one will be over the other - if one is much longer it is easy to spot
 
You've got good advice of which I'd prefer the IIF expression, if the alternative label can be in the same font as the usually printed data in that place, it doesn't need to be a label. All in all that's just a reminder that a report field expression can not only be a single field name.

The thing to add is perhaps, that if am EXE has included FRXes, they will always be prioritized over external FRX/FRT report files. If you have such external report files the likelyhood is in favor of you, that they are external to be adjustable without needing too rebuild the EXE for most changes.

You'll see if you try the suggested changes to achieve your goal. If they all don't succeed the simplest thing to try and assure your changes are effective is to just add a label with a fixed text, data independent, and see whether that's printed. If not, that's a sure sign instead a report internal to the EXE is printed. The question then becomes why there is an external report, but that may just be a version history relict. Anyway, good luck in getting the necessary change to work.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top