Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Parameter if not entered Post Reply Post New Topic
<< Prev Page  of 4 Next >>
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 4:22am
try
 

{ATEXTRA2.IDENT1_0} = "447" and
{ATEXTRA2.LANGUE_0} = "ENG" and
{ATEXTRA2.ZONE_0} = "LNGDES" and
{ATEXTRA2.CODFIC_0} = "ATABDIV" and
{ATEXTRA1.IDENT1_0} = "446" and
{ATEXTRA1.LANGUE_0} = "ENG" and
{ATEXTRA1.ZONE_0} = "LNGDES" and
{ATEXTRA1.CODFIC_0} = "ATABDIV" and
{ATEXTRA0.IDENT1_0} = "445" and
{ATEXTRA0.LANGUE_0} = "ENG" and
{ATEXTRA0.ZONE_0} = "LNGDES" and
{ATEXTRA0.CODFIC_0} = "ATABDIV" and
{SERREQUEST.CREDAT_0} = {?Date Range}
and
(

(

not(hasvalue({?GroupBy BPC}) and hasvalue({?Customer BPC}))

)

or
(

hasvalue({?GroupBy BPC}) and {?GroupBy BPC} = {BPCUSTOMER.BPCGRU_0} and not(hasvalue({?Customer BPC}))

)


or

(

hasvalue({?Customer BPC}) and {?Customer BPC} = {SERREQUEST.SREBPC_0} and not(hasvalue({?GroupBy BPC}))

)

)

IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 13 Sep 2013 at 5:01am
I do not have any records on the report when I refreshed..... and I left the Customer and Group parameters blank - I also tried to select one customer and the report had no records on it (I picked one that I knew should be there).
Be kind to those less fortunate.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 5:16am

I suspect that the other values are the issue.

change your report to only use the two param conditions and see what you get
 
{SERREQUEST.CREDAT_0} = {?Date Range}
and
(

(

not(hasvalue({?GroupBy BPC}) and hasvalue({?Customer BPC}))

)

or
(

hasvalue({?GroupBy BPC}) and {?GroupBy BPC} = {BPCUSTOMER.BPCGRU_0} and not(hasvalue({?Customer BPC}))

)


or

(

hasvalue({?Customer BPC}) and {?Customer BPC} = {SERREQUEST.SREBPC_0} and not(hasvalue({?GroupBy BPC}))

)

)

IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 13 Sep 2013 at 5:56am
(
    (
    hasvalue({?Customer BPC})
    )
                    or
    (
    hasvalue({?Customer BPC}) and {?Customer BPC} = {SERREQUEST.SREBPC_0}
    )
)
I removed the other values and then put them back in because it wasn't working without them. I decided to remove any reference to the parameter GroupBy, and the above is my result. This selection give me ALL records even if I specify a customer number.
 
When I put NOT(hasvalue.... in the first line, I can specify a single customer and get that customer to return on the report, but if I Don't specify a customer, I get nothing on the report.
Be kind to those less fortunate.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 6:04am
test each piece like you were doing
the first part should only return all values when both params are blank
if either has a value nothing would be returned

(not(hasvalue({?GroupBy BPC}) and hasvalue({?Customer BPC})))

The second part only returns one selected "group bpc" if only the group param has a value and the other is blank

(hasvalue({?GroupBy BPC}) and {?GroupBy BPC} = {BPCUSTOMER.BPCGRU_0} and not(hasvalue({?Customer BPC})))
 
The last part only returns one selected "customer" if only the customer param has a value and the other is blank

(

hasvalue({?Customer BPC}) and {?Customer BPC} = {SERREQUEST.SREBPC_0} and not(hasvalue({?GroupBy BPC}))

)

IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 13 Sep 2013 at 6:14am
The first part
(not(hasvalue({?GroupBy BPC}) and hasvalue({?Customer BPC})))
 
This looks to me like it needs another NOT in the 2nd half if it's looking to see if both values are blank?
 
When I put the not(hasvalue in the first line, I don't get any records unless I do specify a customer.
Be kind to those less fortunate.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 7:49am
the NOT on this should apply to both based on the way the pareth is set up
(not(hasvalue({?GroupBy BPC}) and hasvalue({?Customer BPC})))
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 7:50am
test it out.
make a formula field and insert that code
place it on the report canvas report header
it should return a result of TRUE if both are blank and FALSE it either has a value
IP IP Logged
Minco
Groupie
Groupie
Avatar

Joined: 28 Nov 2012
Location: United States
Online Status: Offline
Posts: 62
Quote Minco Replybullet Posted: 13 Sep 2013 at 7:58am
Oh, now I see the logic.... but even when I take out the 2nd parameter, I can't get the single parameter to work right. If I could get the 1st one to work OK, I could put the 2nd parameter in.
Be kind to those less fortunate.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 8:12am

The select statment is just a row evaluation

if it evlauate to TRUE it is included
if False it excludes it.
 
with the OR statements, as soon as it it finds a TRUE it includes the row and stops reading the rest of the OR options.
 
To debug your formula create 3 formula fields to test each part separately.
 
place each of the formula fields  in the report header and run different combos of your params to see if they get TRUE and FALSE as expected.
I still think you might have a join issue with your other criteria.
IP IP Logged
<< Prev Page  of 4 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.016 seconds.