cancel
Showing results for 
Search instead for 
Did you mean: 

optional command level parameters

Former Member
0 Kudos

Hi All,

Please guide how to do this requirement.

I Have a report having 2 command level parameters a and b.

If they select any of the one parameter then other one should be disabled/should not ask any value to enter /should not take any value .

Please suggest how to do

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Divya,

As long as these are string prompts, the suggestion in this thread should work:

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

Can you please explain some more clearly.

I have 2 parameters a and b.

IF user selects a then I should disable b/not giving chance for user to enter any value for  b.

IF user selects b then I should disable a/not giving chance for user to enter any value for  a.

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

You cannot 'disable' a prompt in CR; you can only leave it blank.

String prompts can be left blank without entering a value and without specifically marking them as 'Optional'. While you can't set prompts created at the command level as optional, you can always leave them blank and handle the NULL value passed by that prompt in the where clause of the query.

The query could look something like this:

where ({?Prompt_a} is null OR table.field = {?Prompt_a})

AND ({?Prompt_b} is null OR table.field = {?Prompt_b})


-Abhilash

Former Member
0 Kudos

Hi Abhilash,

As suggested by you I did the same

My where condition is like this.But I am not getting data.

where ('{?empno}' is null OR  ct.employee_no = '{?empno}')

AND ('{?Type}'  is null OR ct.clock_type = '{?Type}')

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

OK. This works for me against a SQL Server database:

where ('{?empno}' = '' OR  ct.employee_no = '{?empno}')

AND ('{?Type}'  = '' OR ct.clock_type = '{?Type}')


-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I am using MYSQL.

This is working

But if I didn't gave any values for both the parameter it is showing some data.

What is the problem ?

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

If both the prompts are left blank, the report should return all the data.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

Thank you.

Now the user enetered empno value

but under that 2nd parameter type is there.

So there is a possibility user can enter value for that also.

Is there any way to restrict the user not to enter the value for type parameter.

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

Unfortunately, that can't be done. You can type in a 'Notification Text' by 'Editing the prompt' from the Field Explorer that lets the users know about how these two prompts work.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I need to show a text to user to enter any one value below .

My text will be like this.

Please suggest is it possible

abhilash_kumar
Active Contributor
0 Kudos

Right-click the prompt in the Field Explorer > Edit > Enter a text under 'Prompt Text'.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I already entered text for empno and type as above.And both are coming above the parameters.

What I need is to display a text like above on top of both the parameters.

abhilash_kumar
Active Contributor
0 Kudos

That is also, unfortunately, not possible in Crystal Reports.

CR's prompt screen has very limited (or almost no) scope for customization.

Use WebElements if you wish to customize the prompt screen.

-Abhilash

Answers (0)