Print Page | Close Window

Help with formula if value does not exist in table

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8568
Printed Date: 07 May 2024 at 4:32am


Topic: Help with formula if value does not exist in table
Posted By: flanman
Subject: Help with formula if value does not exist in table
Date Posted: 04 Dec 2009 at 11:28am
Hi all,
 I am fairly new with CR 11 and doing a lot of learning along the way. I have a report that is pulling some numerical fields from two different tables. One of the tables is an optional field and may or may not have a number connected to a record. I will try to diagram below. What I am finding if is there is no record in the second table I am not getting a value from my formula instead of just getting the value from table 1. How can I setup my formula so if no record exists in table 2 then use the value from table one as the result.


current Delima
Record ID      Table1            Table2           formula             result

1                        5                  3              Table1+table2         8
2                        6                                                                 
3                        9                                                                       
4                        4                   10                                          14

Would like to achieve the following:

Record ID      Table1            Table2           formula             result

1                        5                  3              Table1+table2         8
2                        6                                                                  6
3                        9                                                                  9    
4                        4                   10                                          14

Thanks for any help.

Flanman



Replies:
Posted By: DBlank
Date Posted: 04 Dec 2009 at 12:07pm
If table 1 always has a value then try:
table1.value + (if isnull({table2.value}) then 0 else {table2.value})


Posted By: flanman
Date Posted: 04 Dec 2009 at 1:01pm
Thank You very much. That worked great. I was working with the is null syntax but could not get it right until your example.

Flanman




Print Page | Close Window