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

Help with populating null field

Status
Not open for further replies.

laurenbattaglia

Technical User
May 3, 2002
28
US
I don't know if this is possible, but here is what I am trying to do:

Inv Line Number Inv Number Account Number
1 123 2365
2 123 null
3 123 null

If line 1 has a value in Account Number, but the remaining lines are null in the Account Number, then pull the value from line 1.

Is this possible? I am working in Crystal 7.

Thanks, Lauren
 
Create a formula:

If OnFirstRecord and IsNull({AccountNo}) then "something" else If Isnull({AccountNo}) then Previous({AccountNo})

We have to test for null on the first record, and assign some value if it is null because there is no previous value for the first record. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
I am still getting null values in lines 2 and 3. Also, I need this to reset on each change in invoice number.


Thanks for your help, Lauren
 
place the following formula in your details section:

IsNull({AccountNo})

See if it is returning true or false on lines 2 and 3. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
I think the following will do it:

Place a formula in the detail section with the following (you can suppress it so that the users don't see it).

whileprintingrecords;
Global Numbervar FirstAcct;
if {InvLine} = 1 then
FirstAcct := {MyTable.MyAcctNumber}

Now instead of placing the {MyTable.MyAcctNumber} in the detail section, create a formula instead with something like:

whileprintingrecords;
Global Numbervar FirstAcct;
if isnull({MyTable.MyAcctNumber})
or {MyTable.MyAcctNumber} = ""
//This assumes that Acct is a string type
then
FirstAcct
else
{MyTable.MyAcctNumber}

Since I don't know your datatypes, you may have to adjust accordingly.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top