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

Formula messing up Data Selection 1

Status
Not open for further replies.

LadyAmpherion

Technical User
Jul 22, 2004
9
US
Here's my issue:

When I use "FORMULA A", any record that does not have an entry in the PODETL Table, no longer shows up on my Report.

When I use "FORMULA B", all my records show on my report, but sometimes have the wrong value ...

All my Values on this Report are either Calculated Values or Come from the JOBDETL Table, EXCEPT TWO VALUES. One Value is coming from the JOB Table, with no issues. The other Value is the one that I want to pull in from the PODETL Table, when the ACTCOST Value EXISTS AND is NULL. The problem is I don't know how to put it in the formula correctly.

Thanks again for your thoughts and insights.

//********************************************
//* FORMULA A *
//********************************************
if isnull({JOBDETL.ACTCOST})
then
if isnull({PODETL.PRICE})
then
if isnull({JOBDETL.UNITCOST})
then numbervar x:=0
else numbervar x:={JOBDETL.UNITCOST}
else numbervar x:={PODETL.PRICE}
else numbervar x:={JOBDETL.ACTCOST};
{@QtyDue} * x


//********************************************
//* FORMULA B *
//********************************************
if isnull({JOBDETL.ACTCOST})
then
if isnull({JOBDETL.UNITCOST})
then numbervar x:=0
else numbervar x:={JOBDETL.UNITCOST}
else numbervar x:={JOBDETL.ACTCOST};
{@QtyDue} * x
 
Where are you using this formula?

What's in @qtydue?

A quick fix might be to use formula A (though clean it up to remove the variables, see below) and change the join to a Left Outer. Hard to say without knowing the specifics of the database.

Sharing the version of Crystal is very important when discussing record selection, and is almost always pertinent.

Also, never use variables in the record selection formula, if that's where this formula exists. They will prevent the SQL from being passed to the database, slowing things considerably.

Try posting technical information:

Crystal version
Database/connectivity used
Example data
Expected output

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top