Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Selection Criteria Post Reply Post New Topic
Page  of 3 Next >>
Author Message
jswartz
Newbie
Newbie


Joined: 24 May 2013
Location: United States
Online Status: Offline
Posts: 11
Quote jswartz Replybullet Topic: Selection Criteria
    Posted: 29 Nov 2013 at 5:55am
I am a Crystal Report Novice, so please be gentle with me. I am trying to select records where Field 1 does not contain "HHGD" or is blank, AND Field 2 is not equal to "Storage". BOTH conditions must be true. If the record has "HHGD" in Field 1 and something other than "Storage" in Field 2, I want it in the report. There is also other criteria, but I can figure out how to add that. I'm using Version 14. Thanks for your help. Jayn
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 30 Nov 2013 at 6:43pm
Hi
 
Try this in record selection Formula :
 
{field1} = "HHGD" and {Field2} <> "Storage" 
 
Also on top of your formula editor window, you will find 'Exceptions for Nulls' make that as 'Default Values for Nulls'
 
 
 
Thanks,
Sastry
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 09 Dec 2013 at 9:49pm
Or try...

({Field1} like "*HHGD*" or not(ISNULL{Field1}))
AND
not({Field2} = "Storage")


sometimes for excluding null value, I used the following also.
{Field1} <> ""

Try them out and see. :)
IP IP Logged
jswartz
Newbie
Newbie


Joined: 24 May 2013
Location: United States
Online Status: Offline
Posts: 11
Quote jswartz Replybullet Posted: 10 Dec 2013 at 2:58am
Hello Sastry and lolly54,
Sastry, when I try your suggestion, I don't get any records where Field 1 is not HHGD or blank.

lolly54
When I try yours Crystal is asking for a ) but I can't figure out where to put it.

I am trying to select records where Field 1 does not contain "HHGD" or is blank, AND Field 2 is not equal to "Storage". BOTH conditions must be true. If the record has "HHGD" in Field 1 and something other than "Storage" in Field 2, I want it in the report
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 10 Dec 2013 at 9:15pm
Hi

Try this :

(Not({Field1} like "*HHGD*") OR not(isnull({Field1})) or {field1} <>" ") and
not({Field2} = "Storage")





Thanks,
Sastry
IP IP Logged
jswartz
Newbie
Newbie


Joined: 24 May 2013
Location: United States
Online Status: Offline
Posts: 11
Quote jswartz Replybullet Posted: 11 Dec 2013 at 3:11am
Hi Sastry,
Thanks for your help. I tried that formula. The problem is that I have a record where Field 1 = Not HHGD, Field 2 = Storage. I need that record to show on this report. When I apply the formula, that record is not selected.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 11 Dec 2013 at 6:42am
(Not({Field1} like "*HHGD*") OR not(isnull({Field1})) or {field1} <>" " or {field1} <> "Not HHGD") and
not({Field2} = "Storage")

should work
IP IP Logged
jswartz
Newbie
Newbie


Joined: 24 May 2013
Location: United States
Online Status: Offline
Posts: 11
Quote jswartz Replybullet Posted: 11 Dec 2013 at 8:59am
I'm sorry I'm not being clear. Select Records: If Field 1 is not equal to "HHGD" or if Field 1 is blank, AND Field 2 is not equal to "Storage". BOTH conditions must be true. If the record has "HHGD" in Field 1 and something other than "Storage" in Field 2, I want it in the report.

I got the isnull part. The issue is that I am trying to put two conditions together into one condition. BOTH PARTS of the condition must be true. When I put () around to try to say that, Crystal takes the () away and makes them like two separate conditions that are not dependent on each other.

Edited by jswartz - 11 Dec 2013 at 9:00am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 11 Dec 2013 at 9:18am
that's just a more complex...
local stringvar x := {table.field1};
if isnull(x) then x := ""; //deal with the null value
x:= trim(x);   //remove leading and trailing white space
if x = "HHGD" or x = "" then
if {table.field2} <> "Storage" then
     true
else
     false
else
false

this should get you what you are after, and I have been wrong before. I was just building on what Sastry had written.

HTH
IP IP Logged
jswartz
Newbie
Newbie


Joined: 24 May 2013
Location: United States
Online Status: Offline
Posts: 11
Quote jswartz Replybullet Posted: 11 Dec 2013 at 9:37am
Yeah that is a little more complex :-)
OK I copied and pasted this into the Formula Workshop for Record Selection. Replaced the {field} with my fields. Crystal says "A field is required here" at
if isnull(x)
IP IP Logged
Page  of 3 Next >>
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.063 seconds.