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!

Subreport Shared Variable Formula

Status
Not open for further replies.

dgillz

Instructor
Mar 2, 2001
10,044
US
I have the following formula in a subreport and I cam getting an error "The remaining text does not appear to be a part of this formula", right before the last line of code. The error is right before the [red]red text[/red].

I must have some brain lock - I cannot figure this out. Any assistance appreciated.

WhilePrintingRecords;
Shared Stringvar Comments;
If shared stringvar TrxType:="AP" then stringvar Comments:={IMINVTRX_SQL.Ord_No} else
If shared stringvar TrxType:="PR" then stringvar Comments:={IMINVTRX_SQL.Doc_Ord_No} else
If shared stringvar TrxType:="GL" then stringvar Comments:="GL" else
If shared stringvar TrxType:="IM" then stringvar Comments:={IMINVTRX_SQL.Comment}

[red]Shared Stringvar Comments;[/red]

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
You are missing the final ";" after the last then, right before the "shared stringvar comments;"

-LB
 
WIth the following formula I am getting "boolean required here" in from of the last "shared stringvar TrxType" line of code.


WhilePrintingRecords;
Shared Stringvar Comments;
If shared stringvar TrxType:="AP" then stringvar Comments:={IMINVTRX_SQL.Ord_No} else
If shared stringvar TrxType:="PR" then stringvar Comments:={IMINVTRX_SQL.Doc_Ord_No} else
If shared stringvar TrxType:="GL" then stringvar Comments:="GL" else
If shared stringvar TrxType:="IM" then stringvar Comments:={IMINVTRX_SQL.Comment};

Shared Stringvar Comments;

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
I think you mean:

WhilePrintingRecords;
Shared Stringvar Comments;
If shared stringvar TrxType = "AP" then stringvar Comments:={IMINVTRX_SQL.Ord_No} else
If shared stringvar TrxType = "PR" then stringvar Comments:={IMINVTRX_SQL.Doc_Ord_No} else
If shared stringvar TrxType = "GL" then stringvar Comments:="GL" else
If shared stringvar TrxType = "IM" then stringvar Comments:={IMINVTRX_SQL.Comment};

Shared Stringvar Comments;

Your if statement should use "=" not ":=". Sorry I didn't catch that the first time...

-LB
 
WhilePrintingRecords;
Shared Stringvar Comments;
If shared stringvar TrxType = "AP" then stringvar Comments:={IMINVTRX_SQL.Ord_No} else
If shared stringvar TrxType = "PR" then stringvar Comments:={IMINVTRX_SQL.Doc_Ord_No} else
If shared stringvar TrxType = "GL" then stringvar Comments:="GL" else
If shared stringvar TrxType = "IM" then stringvar Comments:={IMINVTRX_SQL.Comment};

Shared Stringvar Comments;
******************************************

I think LBass got the reason for the Crystal errors but I have to ask: Why have you declared Comments as "Shared" twice and as a normal string variable four times

Shouldn't the formula be written

WhilePrintingRecords;
Shared Stringvar Comments;
shared Stringvar TrxType;
If TrxType = "AP" then
Comments:={IMINVTRX_SQL.Ord_No}
else If TrxType = "PR" then
Comments:={IMINVTRX_SQL.Doc_Ord_No}
else If TrxType = "GL" then
Comments:="GL"
else If TrxType = "IM" then
Comments:={IMINVTRX_SQL.Comment};

Comments;


I have never declared a variable both "shared" and (implied) global at the same time in a formula....I don't know if they are treated the same or different as far as Crystal is concerned.


Jim Broadbent
 
Jim, I guess I still wasn't paying attention closely enough. I agree with your final version, assuming that the fields {IMINVTRX_SQL.Ord_No} and {IMINVTRX_SQL.Doc_Ord_No}
are actually strings, not numbers. Otherwise, they would need to be converted to strings using "totext".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top