Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Line Break in formula Post Reply Post New Topic
Author Message
Danie
Newbie
Newbie


Joined: 15 Sep 2011
Location: South Africa
Online Status: Offline
Posts: 13
Quote Danie Replybullet Topic: Line Break in formula
     Posted: 19 Sep 2011 at 3:55am
Hi
 
I have the following formula -
{OITM.U_Spec1}+ ChrW(13)+{OITM.U_Spec2}+ChrW(13)+{OITM.U_Spec3}+ChrW(13)+{OITM.U_Spec4} in my details section.
- which works fine and will display each Spec underneath each other.
However, it only displays when all 4 specs are present. When an item only has U_Spec1,U_Spec2 and U_Spec3 (without U_Spec4) - nothing displays.
 
How can I change the formula to display in cases like that?
 
Regards
 
Danie
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Sep 2011 at 4:12am

Change the option the formula workshop to use default values for NULLs



Edited by DBlank - 19 Sep 2011 at 4:13am
IP IP Logged
Danie
Newbie
Newbie


Joined: 15 Sep 2011
Location: South Africa
Online Status: Offline
Posts: 13
Quote Danie Replybullet Posted: 19 Sep 2011 at 7:31am
Hi
 
Thank you for the reply. It worked for me.
 
However, since this formula is in the details section I would like for the records to be directly underneath each other. At the moment I might get 4 lines for items 1 and 2, 2 lines for item 3 and so on. Problem is - when there is only 2 or 3 lines then I get a blank line(s) for the missing (Null value) specs.
 
My formula is imbedded in a test field which is set 'Suppress Embedded Field blank lines' and 'Can grow' is enabled. In the section expert (Details) I have 'Suppress blank section' ticked.
 
Formula set to 'Default values for nulls'
 
Am I missing a tick somewhere?
 
Regards
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Sep 2011 at 7:45am
there are a few ways to habdle this but here is one...
 
(if {OITM.U_Spec1} = "" then "" else {OITM.U_Spec1}+ ChrW(13))+
(if {OITM.U_Spec2} = "" then "" else {OITM.U_Spec2}+ChrW(13))+
(if {OITM.U_Spec3} = "" then "" else {OITM.U_Spec3}+ChrW(13))+
(if {OITM.U_Spec4} = "" then "" else {OITM.U_Spec4})
IP IP Logged
Danie
Newbie
Newbie


Joined: 15 Sep 2011
Location: South Africa
Online Status: Offline
Posts: 13
Quote Danie Replybullet Posted: 19 Sep 2011 at 8:14am
Hi
 
Thank you - that worked for me.
 
Regards
IP IP Logged
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