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

Return NULL Value 1

Status
Not open for further replies.
Jan 27, 2005
76
US
How would I declare a NULL value in a formula using Crystal Syntax?

Example 1:
IF 1+1 = 2 THEN 2
ELSE <<null>>

Example 2:
numberVar myNumber := <<null>>;

I'm using CRXI, SP2

Thanks!

 
More importantly, why would you want to.

It'a lways interesting how people decide on architecture without even knowing if it's possible... One might think that people would think posting requirements and getting solutoins are the goal, and I'm confident that yuor clients requirements aren't so supply them with nulls.

Consider posting technical information:

Crystal version (you're a goldmine expert and think this unimportant, goldmine is a prime example of software that constantly changes functionality based on versioning)
Database
Example data
Expected output

There are tricks to getting a NULL as output from a formula, but not in the architecture you specified.

-k
 
Try creating a formula by going to formula->new and naming it "null", and then save and close without entering anything in the formula area. Then try:

//example 1:
IF {table.field1}+{table.field2} = 2 THEN 2
ELSE tonumber({@null})

(I changed your example, since it would always result in a 2 as you wrote it.)

//example 2:
numberVar myNumber := tonumber({@null});

I think this was originally a Ken Hamady trick.

-LB
 
Yep, that was Ken's trick, LB.

Didn't recall that it worked with numerics though.

As I'd suggested to him years ago, a SQL Expression would be more efficient.

-k
 
TheGoldMineGuru, is there any reason not to use
Code:
IF 1+1 = 2 THEN 2
ELSE 0



[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you for your post lbass! I have actually found an article on BOE's web site with the same basic solution. I've implemented it and it works perfect. I appreciate your quick response!

"It'a lways interesting how people decide on architecture without even knowing if it's possible... One might think that people would think posting requirements and getting solutoins are the goal, and I'm confident that yuor clients requirements aren't so supply them with nulls."


This person is generous and gives a lot of help and it's comical how he/she puts in that extra effort. : )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top