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

While Do Loop 1

Status
Not open for further replies.

KrystalKid

Programmer
Aug 12, 2003
4
US
I am trying to write a formula with an If statement inside a while do loop:

WhilePrintingRecords;
stringVar Name := {sprptCOCETSCrysCaptionSubw_Attorney;1.PartyName} ;
While {sprptCOCETSCrysCaptionSubw_Attorney;1.IsPlaintiff}= True Do
(
If {#RTotal1} > 1 Then
Name&", ET AL"
Else
Name
);
Name

The result is a name where the boolean {IsPlaintiff} field is False, #RTotal1 is a running summary of {IsPlaintiff}=True

Why is the formula picking the wrong boolean and how might I go about fixing it.

 
I'm not quite sure what you are trying to accomplish. It looks like you want the ET AL added when there are more than one {is.Plaintiff}

It that's the case, you could use

WhilePrintingRecords;
stringVar Name := {sprptCOCETSCrysCaptionSubw_Attorney;1.PartyName} ;

if {sprptCOCETSCrysCaptionSubw_Attorney;1.IsPlaintiff}= True and {#RTotal1} > 1
then
Name&", ET AL"
else
Name

Mike
 
Thanks for the quick reply. Your formula returned the same name, one that {IsPlaintiff} is False.

I have a SQL stored procedure that is returning records with:
Name(str), IsPlaintiff(Boo)

For a caption in a legal pleading, I need to return the first party that is a plaintiff ({IsPlaintiff}=True, and the first party that is a defendant ({IsPlaintiff}=False). If there is more than one Plaintiff, I have to take the first name an concatinate ,ET AL to it. The same for the Defendant. If there is only one plaintiff and or defendant, no concatination. For this particular instance

Name1 True
Name2 True
Name3 True
Name4 False
Name5 False

The caption should read:

Name1, ET AL
vs
Name4, Et Al

This formula give me the first name in the dataset even though {IsPlaintiff} is False. Appreciate the help....
 
If you grouped on {sprptCOCETSCrysCaptionSubw_Attorney;1.IsPlaintiff}, you could then write a formula:

(if count({sprptCOCETSCrysCaptionSubw_Attorney;1.PartyName}, {sprptCOCETSCrysCaptionSubw_Attorney;1.IsPlaintiff}) > 1 then {sprptCOCETSCrysCaptionSubw_Attorney;1.PartyName}& " et al" else{sprptCOCETSCrysCaptionSubw_Attorney;1.PartyName}) & (if {sprptCOCETSCrysCaptionSubw_Attorney;1.IsPlaintiff}) = true then chr(13) & "vs" else "")

You would then place this in the group header and then suppress the details.

-LB
 
Group by the caption in a legal pleading.

Add in formulas:

Group Header:
whileprintingrecords;
stringvar NameIs: = {table.name};
Numbervar RecCount := 1;

Details:
whileprintingrecords;
Numbervar RecCount := 1;
stringvar NameIs;
if RecCount = 1 and NameIs = {table.name} then
RecCount := 0;

Group Footer:
whileprintingrecords;
stringvar NameIs;
Numbervar RecCount;
NameIs+
if RecCount = 0 then
""
else
+" ET ALL"

The Group footer will be where you display the name.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top