on 12-11-2007 4:08 PM
Post Author: John
CA Forum: Formula
I have this code in CR 9....
WhilePrintingRecords;stringVar flaga := 'false';stringVar flagb := 'false';numberVar a := 0;
While {Combine_CR_Table.Field1} = {Combine_CR_Table.Field1} do If {Combine_CR_Table.Field7} = "TLC METHOD" and flaga <> 'true' then a := a + 1 * (remaining text does not appear to be part of formula)
flaga := 'true' *(remaining text does not appear to be part of formula)
If {Combine_CR_Table.Field7} = "GC/MS METHOD" and flagb <> 'true' then a := a + 1 flagb := 'true'
Wend *(No matter what I add to the code above, ";" or "and".. this keeps reading that it is not part of the formula.)
a := a + 1
flaga := 'false'flagb := 'false'
So.. the errors I am getting are the same. Note *s above. I have used Else If, End If, and tried ";" and "and" at the end of each line.
If I take from the "Wend" down, out, and put a ; after the addition (a := a + 1) and the first flaga = "true" then I get no errors when I perform a check. However, when I run it, it gives me an error "The loop was evaluated more than the maximum number of times".
Anybody see the holes in this code and why it won't let me put If statements in and While/Wend command?
Thanks
John
Post Author: John
CA Forum: Formula
AHHHH.. so.. the good old idiot gene came through again for me! Yeah, don't know why I didn't see that about the While loop.
Is there a "Next" command to make it compare the next record?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post Author: SKodidine
CA Forum: Formula
I see two issues. The first one being your While condition. When is this ever NOT true? Field1 will always equal Field1. It is an infinite loop and CR has a loop limit of 100k or so and hence the error.
The second issue is that of syntax.
While {Combine_CR_Table.Field1} = {Combine_CR_Table.Field1} do
( If {Combine_CR_Table.Field7} = "TLC METHOD" and flaga <> 'true' then (a := a + 1;
flaga := 'true');
If {Combine_CR_Table.Field7} = "GC/MS METHOD" and flagb <> 'true' then (a := a + 1 ; flagb := 'true');
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.