Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Help with formula if value does not exist in table Post Reply Post New Topic
Author Message
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Topic: Help with formula if value does not exist in table
    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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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})
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet 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

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.029 seconds.