Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass select expert from main report to subreports

Status
Not open for further replies.

thebigbadwolf

Programmer
Jul 7, 2010
67
CY
Hello everyone!
I am using CR9 i could use some help on this one...
i have 2 subreports in the report footer section (a,b) and i would like to pass the formula from the main report's select expert to the select expert of the two subreports automatically.
I need it automatically because crystal reports is used from another program and when i filter some data (from this program) (ex. equipment_code=abcd) a statement is created on select expert-main report (ex. equipment_code:="abcd")

I have tried to create a formula like

shared stringvar filter_:=
(if not isnull(RecordSelection) then RecordSelection else "1=1")

and place it to the select expert in the subreports but this message appears telling me that "a boolean is required here" which is correct and incorrect at the same time if you get what i mean.

Is there a solution to this odd question?

ps.main report and subreports uses a common table which is not connected because CR appears only one line of the data, not the whole list.
 
I am assuming you are using parameters in main report to change select statement.

Just copy same parameters into subreports and build select statement in each SR using these.

In subreport link dialog box select parameter from main report.

In lower left hnad drop down select parameter from sub report with same name, repeat for other Parameters.

Ian
 
Thanks Ian for the reply.
You are right, i am using parameters, but i have already done the things you said.
The SR are linked with the parameters, they just aren't linked with some specific field from the table.

The thing is that the new statements in the select expert in the main report will be created the time that the user from the other program chooses or chooses not to filter the data during the evaluation.
That's why i'm using the "RecordSelection" field.
 
Please show select statement from Main report and subreports as they are and also how you want the SR select statement to change.

Ian
 
in main report, there are no statements in select expert.

in subreport a, i have placed this tricky formula:
if
({?NOT STARTED}=true and
{?IN PROGRESS}=true and
{?DONE}=true and
{?HISTORY}=true)

then {@select_expert}

else

(
(if {?NOT STARTED}=false
then
({@select_expert} and
{USER_STATUS.MDUS_CODE} <> "N")
else
{@select_expert})

and

(if {?IN PROGRESS}=false
then
({@select_expert} and
{USER_STATUS.MDUS_CODE} <> "P")
else
{@select_expert})

and

(if {?DONE}=false
then
({@select_expert} and
{USER_STATUS.MDUS_CODE} <> "D")
else
{@select_expert})

and

(if {?HISTORY}=false
then
({@select_expert} and
{USER_STATUS.MDUS_CODE} <> "H")
else
{@select_expert})

)

//@select_expert is {@CREATION DATE} in {?FROM:} to {?TO:} and {JOB_REQUEST.JRJR_STATUS} = 3.00


in subreport b, it's the:

{@CREATION DATE} in {?FROM:} to {?TO:} and
{JOB_REQUEST.JRJR_STATUS} in [0.00, 1.00]


i assume that the statements that will be created automatically in the select expert in main report (from the other program) must be added:
in subreport a:inside the formula "@select_expert"
in subreport b:directly with a "and"

i really want to thank you for your time on this. I am trying not to split this report on two different ones that's why this complexity is all about!
 
i should also add that in "format subreport" window there is a suppression if
subreport a:
{?NOT STARTED}<>true and
{?IN PROGRESS}<>true and
{?DONE}<>true and
{?HISTORY}<>true

subreport b:
{?REQUESTS WITHOUT WO}<>true
 
Not really sure what you are trying to do.

If you do not have a select statement in Main report why are you trying to pass it to the subreports.

Why can't you replace the formula {@select_expert} with the relevant select statements for each subreport.

Have you tried link the main report to subreport on the field
ex.equipment_code

Ian
 
That is the whole point.
I'm working on a cmms software which co-operates with Crystal Reports.
So CR runs through the cmms software.
In this software, you can see lists of equipments-employers-items etc and -if you like- you can filter these lists with some kind of statements such as "{equipment_code} starts with "abc" or {creation_date}>01/01/2010 etc.

The thing is that when you filter these/any fields or tables, and press "print", then Crystal reports evaluates and into select expert in main report this cmms program creates these statements(or does not create if there isn't any filter).

That's why i need something automatic.
 
Its sounds like the cmms software is populating a stored procedure parameter.

Are you planning to attach this report to the CMMS software or will you run it as a stand alone report.

If the former you will need to use a stored procedure and then Crystal will automatically ask users to enter data for the SP parameters.

There will also be some other cmms functions you will need to perform to ensure report is accessible by the cmms software

If its a standalone report you can still use an SP and Crystal will ask for parameters to be entered, or you can build a report querying tables directly and add in your own Crystal Parameters.

Have you looked at one of the cmms built in reports and seen how they are structured.

Ian
 
That's right Ian, the report will be attached to the cmms software and it uses CR to print/export.

Let's say that in the main report in select expert there is this code:
{table1}=123 and
{table2}="abc"

If the user of this cmms software chooses to filter {table3} for example like
{table3}>0
then, when you print/execute the report, in the select expert, the code will become:

{table1}=123 and
{table2}="abc" and
{table3}>0

That's why i tried this formula in my first post.

I'm out of ideas, really, it's kind of tricky
 
If I understand you, correctly the cmms software actually adds code to the select statement of the main report.

I have never seen that done before.

If it was populating parameters then you could replicate those in subreports.

Sorry but I do not think I can help you with this issue.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top