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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluation Issue

Status
Not open for further replies.

wesleycrusher

Technical User
Sep 30, 2003
61
US
Greetings. Can anyone help me with this situation?

This is my evaluation statement:
if {form_custom_footnote.footnote_nbr} <> 0 then &quot;Additional Footnotes&quot;;

However, it only evaluates it for the last record pulled/displayed instead of if it is true anywhere in the entire section.

Is there another way to write this so it is tripped if it is true anywhere in the list of data?
 
So, it sounds like you are placing this formula in a group footer. Group footers only have access to the last record in the group, so when simply reference a field, as you have, you are only looking at the last record. To evaluate all the records, you need some type of summary (or, depending on your situation, you may need to track things with a variable). Not knowing anything more about your data, I would suggest the following formula:

If sum({form_custom_footnote.footnote_nbr},{table.group#}) <> 0 then &quot;Additional Footnotes&quot;;

where {table.group#} is the field you are grouping on.
 
You need to assess this formula in the details section, as opposed to after the details section has completed, which is what I suspect you're currently doing.

Work this formula into your details section, and assign a variable to it:

WhilePrintingRecords;
if {form_custom_footnote.footnote_nbr} <> 0 then BooleanVar Footnotes := True;

In you footer, which is where I presume you want the footnotes, use another formula which checks the status of the variable:

WhilePrintingRecords;
If BooleanVar Footnotes := True
Then &quot;Additional Footnotes...&quot;
Else &quot;&quot;;

If you need to re-use the variable, you'll need to reset it.

Naith
 
I noticed there's a typo in the second formula. There should be no colon where := is stipulated.

Looks like FVTrainer and I posted at the same time, but in retrospect, I like the simplicity of his approach. Providing you can't have any negative footnote numbers which could cancel out a positive figures in a sum, FVTrainer's solution is cleaner.

Naith
 
Thanks. The formula is indeed in the footnotes. I tried both of the above methods and they didn't work. I know they do work as intended because I added extra fields as a test to see the results. I believe the problem is caused because the last records pulled/displayed (and some in the section) do not have {form_custom_footnote.footnote_nbr} entries at all. How can I address this? I will then use the solutions above to finish it off. Thanks a million.
 
wesley,

Please clarify a few things. &quot;The formula is indeed in the footnotes&quot;: This doesn't really tell me anything. I need to know where the footnotes are on your report. Are they in the report footer? A group footer?

Also,you'll need to describe more clearly what &quot;didn't work.&quot;. For example, when you used the summary formula, what value was shown by the formula on the report? What value did you expect would be shown. Where did you place the summary formula?
 
I apologize. I meant to say the original formula was in the footer of the group like you both thought.

I placed your formulas/suggestion exactly where you had instructed. Either in the details section of the footer section. The reset was added as well and tried in several places.

I tried both suggestions and &quot;additional footnotes&quot; did not appear in the result. I know your suggestions do work because I added extra fields to test the results. I was able to see the results of your formulas/suggestions up until the record that didn't have an entry in the table.

I sincerely believe this is the problem.
 
Well, summaries like the one I showed aren't affected by NULL values, which is what I assume is the case when you talk about &quot;records that didn't have an entry in the table&quot;. Just to see what's going on, try the following:

Create the formula below and place it in the details section.

If IsNull({form_custom_footnote.footnote_nbr}) then 0 else 1

What is the result? Do you see a 1 or 0 in each detail record?
 
Yes, I see a 1 or 0. The 0 occurs for the last record displayed (as well as two others in the section). All others are 1.
 
so, if you create a summary of this new formula and place it in the group footer (in the designer, if using CR 8.5, click on the formula in the details section and choose Insert | Subtotal and in the 2nd drop-down, select the field you are grouping on), you should end up with a summary of the formula. Now you could use this summary in a new If..then formula, placed in the same group footer as the summary, as in:

If sum({@myformula,{table.group#}) <> 0 then &quot;Additional Footnotes&quot; else &quot;&quot;;
 
I am with FVTrainer...you now know why this isn't evaluating as you would like...but what are you trying to do?

It seems that there are footnotes available for various details in your reports....Are these details to be listed in your report footer??? If so this is easy to do.

Just store the footnote and number in an array for later printing in the report footer.

you show little of your report construction (why do they do this?? {shrug})

But let us ASSUME you have something like this

{detail1} {detail1} {detail1} {detail1} {@FootNote#}

this would alert the reader that there is additional info available at the end of the report.

In the report header place an initialization formula

//@Initialization (suppressed in report header)

WhilePrintingRecords;
//estimate your max no. of footnotes and increase it by 50%
//say you expect 20 max so plan on 30.

StringVar Array ftnote := [ &quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,
&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,
&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot; ];
StringVar Array ftNum := [ &quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,
&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,
&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot; ];
numberVar pointer := 0;
StringVar warning := &quot;&quot;;

now in the detail section place this formula as I showed in the above example

//@FootNote#

WhilePrintingRecords;
StringVar Array ftnote ;
StringVar Array ftNum ;
numberVar pointer ;
stringVar temp := totext({form_custom_footnote.footnote_nbr},0,&quot;&quot;,&quot;&quot;);
stringVar warning; // to let you know when you must maintain the report

if temp <> &quot;0&quot; then
(
pointer := pointer + 1;
if pointer > 30 then
warning := &quot;Maintenance Alert - &quot; + totext(pointer - 30,0,&quot;&quot;,&quot;&quot;) + &quot;footnotes missing.&quot;
else
(
ftnote[pointer] := {form_custom_footnote.footnote_Description}; //field name of footnote
ftNum[pointer] := temp ;
);
);

if temp := 0 then
&quot; &quot;
else
temp;

This prints the footnote number or a blank space next to the details

in the report footer(or group footer...in this case the @Initialize is placed in the Group header) you display the footnote results.

the easiest is just to create 30 subsections of the report (or group footer) each subsection has &quot;Suppress Blank Section&quot; enabled...(this is why you make the arrays strings)

report footer Section 1 has this

FootNotes
---------

{@displayFN#1} {@displayFND1}

the rest to the sections are just this..this is tedious but easy to do since all formulas are simple and easily cloned.

{@displayFN#2} {@displayFND2}

this is all these formulas consist of

//@displayFN#1
WhilePrintingRecords;
StringVar Array ftNum ;

ftNum[1];

//@displayFND1
WhilePrintingRecords;
StringVar Array ftnote ;

ftnote[1]

Make certain the &quot;can Grow&quot; is enabled on the @displayFNDx formulas.

Now add one final report or group footer section for the warning

//@MaintenanceAlert (enable suppress blank section)
WhilePrintingRecords;
stringVar warning;

warning;

Place this in the centre of the section and bold it so it is easily visible....this will only show if you ran over 30 footnotes in this case...then you must go in and increase the array sizes accordingly.

Anyway, this was a lot of work but I think this is really what you want...if not {shrug} Tell us!!!

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
I still have the IsNull formula in my details section but it is not in the second dropdown menu of the insert window: &quot;Insert a field which calculates the (count?) of (my formula 'additional footnotes test' does not appear in this list)&quot;.

@additional footnotes tests formula reads:
WhilePrintingRecords;
If IsNull({form_custom_footnote.footnote_nbr}) then 0 else 1
 
ah..take out the WhilePrintingRecords statement from your formula. That statement forces the formula to be evaluated in the 2nd pass and excludes it from summary operations. I don't believe it is necessary in this calculation. You should then be able to create a subtotal on that formula.
 
First, my apologies Ngolem. I mistakenly I supplied enough info. I have records grouped by company, fuel type, output, etc. They all usually share footnotes. However, the footnotes section was conditionally supressed in a group footer. this condition only depended on the last record apparently. Thus, my problem.

Second, it works!!! Thank you very much, FVTrainer. Thank you to Naith and Ngolem as well. I do appreciate your expertise!
 
Now that you have told us the &quot;REAL&quot; problem the solution is easy.

in the report or group header (if repeated) place this formula

//@Initialize (suppressed)
WhileprintingRecords;
BooleanVar Flag := False;

Then in your details section place this formula

//@FootNoteAlert
WhileprintingRecords;
BooleanVar Flag;

If not IsNull({form_custom_footnote.footnote_nbr}) then
Flag := True;

Then in the conditional suppress of your footnote section just put the following formula

WhilePrintingRecords;
BooleanVar Flag;

not Flag;

I know you have already solved the problem using another approach but IF you would have described your PROBLEM not just a symptom you would get better answers

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top