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

Multiple formulas in single textbox problem????

Status
Not open for further replies.

ausmoran

MIS
Apr 8, 2001
157
US
I have a report with multiple sections. Some of the sections contain subreports in which I have included multiple string formulas. For some strange reason if I include only one formula in a subreport it work just fine, but if I include more than one, I either don't get ANY data, or I get incorrect data. Is there anyone who might be able to offer some assistance with this?

Here is an example:

against @respondents, the respondent(s), alleging violation of @Articles of the Code of Ethics of the National Association of REALTORS. The decision was as follows:
(Read the decision of the ethics Hearing Panel of the Professonal Standards Committee [Form E-11].)

Here are the formulas:

(@articles)
StringVar List;
List:=List+{tblArticles.ArticleNumber}+", ";

(@respondents)
IF Not {tblCaseLit.Complainant} THEN
StringVar List:= List + {tbl_Litigants.Fname} + " " +
{tbl_Litigants.Lname} + ", " else List;
List;

Thanks in advacne for your assistance!

Austin
 
You are using the same variable name in two different formulas, so they are probably overwriting each other. Either change the name of one variable so that each one is different, or declare them as LOCAL.
Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
KEN,
Thanks for your terrific help. It is terribly frustrating to spend so much time on what should be a VERY obvious oversight....urggghhh.

I still have one dillema though and am hoping you might be able to assist me!


I have a subreport with two formulas as follows
-------------------------------------------
BASIS OF HEARING: The particular matter to be considered by this Appeal Hearing Tribunal is an appeal of the decision of the ethics Hearing Panel
composed of [@Panelists] and chaired by [@Chairperson].
-------------------------------------------
Here's the problem....The first formula works just fine, but the second one produces nothing.
--------------------
@Panelists
StringVar Panel;
IF {tblCasePanel.Chair} =FALSE THEN
Panel:=Panel+{tbl_PanelMembers.Fname}+" "+{tbl_PanelMembers.Lname};
--------------------
@Chairperson
StringVas Chair:
IF {TblCasePanel.Chair}=TRUE THEN
Chair:+Chair+{tbl_PanelMembers.Fname}+" "+{tbl_PanelMembers.Lname};

(Note: I have also tried to remove the "=TRUE" and still get the same results. The database does show three panelists with one marked as the chair)

Thanks for your assistance,
Austin
 
Are both first and last names always filled in? Crystal will print blanks if any field in the formula is null. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Yes, all name fields are populated. I am just working with Demo data....and have ensured that all three records are identical (in fact, just to be sure, I made one of the other persons a chairperson and still came up with a big fat goose egg).

Thanks again,
Austin
 
Looks like you have a typo in the assignment?

Chair:+Chair+{tbl_Pan...

sb

Chair:=Chair+{tbl_Pan...

I am surprised that this didn't give you a syntax error. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks Very much Ken...you are very kind to offer such help! I finally figured out that the problem was that I had neglected to include an "ELSE" component to my formula. None-the-less, it is now working.

Thanks again for your time, Ken.

Austin Moran
 
I hate to keep bothering you./..but now the data appears but only depending upon which section of the subreport I put the formula in. The subreport is linked to the Primary report via the tblCase.CaseID. The CaseID is the linking component throughout the entire report.

If the put the Complainant formula in the report header, I get the complainant's name (appropriately). If I include the respondent formula in this same section, I get a blank. If I put the respondent formula into the details section that it populates with the name of the respondent.

If I put the Article formula in anything but the report footer, it does not populate correctly.

Am I losing my mind or what?

Thanks
Austin
 
Put all three on the details. Then post all three formulas here and tell us what you saw. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Here are the formulas:

------------
{@complainants}
IF {tblCaseLit.Complainant} THEN
StringVar Complain:=Complain + {tbl_Litigants.fname}+" " +
{tbl_Litigants.lname}+", " else Complain;
Complain;
-------------
(@respondents}
IF NOT {tblCaseLit.Complainant} THEN
StringVar Respond:= Respond + {tbl_Litigants.fname}+" " +
{tbl_Litigants.lname}+", " else Respond;
Respond;
--------------
{@Articles}
StringVar Art;
Art:=Art+{tblArticles.ArticleNumber}+", ";

When I place each of these formulas into the detail section of the subreport (incidentally using the REPORT SELECT EXPERT, I have set a CASEID to a particular case)I don't get just one DETAIL section...I get four of them, each time adding progressively more data.

1st DETAIL Section: I get the name of the complainant and the first article number (this particular case has four alleged article violations)

2nd DETAIL section: I get both the complainant and the respondent, along with two article numbers

3rd DETAIL section: I no longer get the complainant OR the respondent, but now receive three article numbers.

4th DETAIL section: I get all four of the article numbers that are associated with this case.

Thanks again for any/all help that you can provide.

Austin
 
I would change the syntax to be as follows at the beginning of each formula, before you start the if:

{@complainants}
WhilePrintingRecords;
StringVar Complain;

IF {tblCaseLit.Complainant}
THEN Complain:=Complain + .....


No need to declare again after the IF. When you declare them in the THEN they aren't available for the ELSE.

These formulas should stay on the detail bands to evaluate every record.

To display the result you create a separate formula, probably on the report footer, and just declare the variable:

WhilePrintingRecords;
StringVar Complain
Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
How can I thank you, Ken! You have been absolutely terrific in working this through with/for me. I can't thank you enough!

Austin
 
Just, stop by often, and don't forget to tell all of your friends. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top