How to make have a formula field show dependent on subreport fields?

My report has a cover sheet, and two sub reports showing Bill of Materials and Processes.  For this question, I need to know how to have a field (and box/art object if possible) only show up on the cover sheet if a record matching 2096 and 2097 is found in the Processes subreport.

If needed, I'll be happy to post any code you may need or the report or clarify my question in any way.  Just let me know.

Thanks!
LVL 1
ZkdogAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peter57rCommented:
You cannot get values from a subreport until the subreport has run.

So the only way to get values onto the first page is to have hidden copies of the subreport(s) in the header or at least higher up the page than the point that you wish to use the values.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You can LOCATE to find such a variable in your query and then flag a certain memory variable and display that variable in the cover letter.
0
mlmccCommented:
CaptainCyril - Please exxplain your idea further.  I don't know of a LOCATE command or function in Crystal.

mlmcc
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
SELECT query
LOCATE FOR logicalexpression
IF FOUND()
   cVariable = "The items found ..."
ELSE
   cVariable = ""
ENDIF

You use LOCATE to search for a logical expression in a table. If it's found you assign the memory variable a value and you display that value in your report.

Hope it's more clear now. Let me know if you need more clarification.
0
ZkdogAuthor Commented:
Makes sense but I'm not sure what the logicalexperssion is.  Other than that, it looks like it would work to me.
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
logicalexpression is something like:

LOCATE FOR car = "Camaro"
LOCATE FOR price > 25000
LOCATE FOR IsInStock
0
ZkdogAuthor Commented:
So something like this would work?
SELECT query
LOCATE FOR schedl.opnum IN ["2096, 2097"]
IF FOUND()
   cVariable = "Yacht Quality Finsih"
ELSE
   cVariable = ""
ENDIF

Open in new window

0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
SELECT query
LOCATE FOR INLIST(opnum, "2096", "2097") && If this is character
LOCATE FOR INLIST(opnum, 2096, 2097) && If this is numeric
IF FOUND()
   cVariable = "Yacht Quality Finsih"
ELSE
   cVariable = "" 
ENDIF
0
ZkdogAuthor Commented:
So I don't have to actually put the table in the code?  Just the field?
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
Yes.
0
ZkdogAuthor Commented:
When I try this in the SQL Expression Editor, I get an error compiling the expression stating that the command contains unrecognized phrase/keywords.

I'm connecting to a VFP database using ODBC drivers.
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
Ah. What I gave you is actual FoxPro code to be run inside FoxPro.
0
ZkdogAuthor Commented:
Sorry for the misunderstanding.

So let me see if I understand now.  To achieve this, I can run this code inside of FoxPro to create the variable.  From there, I can pull in the variable to Crystal Reports to print out the Quality text?
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
If you are printing from FoxPro using Crystal Reports, then yes, you need to run the code inside FoxPro, prepare the variables and then let Crystal Reports handle these new variables.
0
ZkdogAuthor Commented:
Sorry for the delay in getting back with you.  Had a new printer that came in that has eaten up alot of my time recently.

How do you call in a VFP variable in CR?
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
I never worked in Crystal Reports. So my point of view is that you send it in the table. If it's large then it should be a memo field.
0
mlmccCommented:
The easy way to pass a VFP variable to Crystal is using a parameter.

If you are trying to pass different values for each record then you will need to create the calculation in the report.

mlmcc
0
ZkdogAuthor Commented:
Maybe this is getting mixed up because it's seeming much more complicated than I think it should be.  All I need is a formula to read out "X" or "Y" depending on if said X or Y is in the subreport.

I'm not sure if I follow.  I do the following?

So run the VFP command to get the variable.

Use a parameter to call in said variable.

0
ZkdogAuthor Commented:
Ok so I don't think using the FoxPro variables will work.

What if a put another sub-report (a copy) in a suppressed group before the cover page.  Then can I pull whether or not it has the operation in it?
0
ZkdogAuthor Commented:
Doing some research, so far I think it can be done using Shared NumberVar.  

So far I have this in my subreport.  

 whileprintingrecords;
 Shared Numbervar x:= ({schedl.op_num})

And this in my main report, but it still won't work.

whileprintingrecords;
 Shared NumberVar x := {schedl.op_num};
0
mlmccCommented:
What are you trying to do with the shared variables.

The example you provided simply assigns a value to the shared variable.

mlmcc
0
ZkdogAuthor Commented:
I'm trying to make a formula to read out "X" or "Y" in the details section depending on if said X or Y is in the subreport.
0
mlmccCommented:
Where is the subreport?

In the main report you don't want to assign a value just display it.

mlmcc
0
ZkdogAuthor Commented:
The subreport is in the Group Header.
0
peter57rCommented:
All you need in your main report formula is..

whileprintingrecords;
 Shared NumberVar x;
x

But to recap on my opening comment, you can only display the subform value after the subform has run, not before.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.