Yes, as I suggested in your other thread--it would be good if you responded to that thread. Were you careful to avoid using the shared variable(s) before adding it to the chart?
thanks for your second reply - new to this group and not familiar with protocol.
I am a bit of a novice with this software only had it 5 weeks....
I was careful to follow your info but do not get any data from the subreport variable into the graph. I seem to have tried many options all without much success.
My design is one of the main report populated with one dataset and a second, subreport populated with another dataset. I have then created a shared variable within the subreport and created a formula in the main sheet calling the variable. I have checked they work by placing them on the main report and then removed them priot to adding a graph. They are both available for selection within the graph dialog and the correct formats are set as suggested.
I have tried placing the graph before and after the details section with the same outcome, tried deleting the graph, refreshing the report and re adding. Also had a go at placing the graph in the subreport and running the variables in the other direction. I can get the graph to work if all of the data is in the main report, but not it seems when the data comes from a subreport, something I am stuck with.
Am I correct in thinking that if I want a graph with more than one y axis dataset I require a subreport for each and a shared vairiable called into the main report.
Beginning to think export to excel would be easier but wish to persevere for the learning curve. Not much info around on this method.
Hi,
Yes I think so to your first question - the formulae that I have put together all now appear in the available fields area of the graph expert and I can insert them into the onchangeof and values sections. I have looked at all of the options for both of these sections.
My subreports are in the details section of the report and I have tried placing the graph in both page and report headers and also the footer.
Placing it in the footer does cause some problems because there are a lot of records for the select criteria and I have to wait for the subreports to finish access before I can see the resultant graph. There are 2200 records. Did wonder if this was too many but I have had the graph build with one dataset in the main report so can't see why there should be a problem.
a bit of further digging suggests that the returned variable from the subreport is empty ie returning 0.
I can get the graph to work on main report data but when changed to returned subreport data it is zero. If I add a number to the returned subreport data I can see that the values the graph is using change by the added number.
I am using:
whileprintingrecords;
shared numberVar temp :=ToNumber ({RESULT.ENTRY});
in the subreport assigned to a formula and:
whileprintingrecords;
shared numberVar temp;
temp
in the mainreport. I am linking all of these to a samplenumber generated in the mainreport recordselection
The shared variables will only work in a section below the one in which a subreport is executing, and therefore a chart using subreports MUST be in a section lower than the one containing the subreports. Since your subreports are in a detail section, that means the chart must be in a detail_b section (if the subreports are in _a), in a group footer section, or in a report footer section. Where you place the chart depends upon what you are charting.
If this still doesn't help, then please provide your group structure, how you are linking the subreports, and what you are charting on (the on change of value and the summary values). The general concept of what you are trying to do would help clarify the next step.
ok here goes at an explanation of what I am working with...
I am calling data from a large labaratory dBase but the crux of what I need is from just three tables. These are SAMPLE, TESTS & RESULTS. The sample is logged in via a user application to an oracle dBase. Each sample starts as a single entry in the sample table which contains all of the sample details and is the sort selection for what I need to get out. Tests logged against a sample are entered into the test table and for each test there is a single entry into the test table. There can be more than one test against each sample hence more than one entry in the table. Each test has a number of components for which entries are made into the result table. My particular samples have just one test of which there are 5 components. One of these is a time date.
In crystal I am firstly pulling out all of the sample numbers that fit a select criteria and placing these in the detail_a section of the report. I don't need any data from the TEST table so jump straight through to the RESULT table. There is replication of sample number in this table and, in this instance there are 5 for every sample number pulled from the SAMPLE table. I need to separate these components and plot them as individual data sets.
I have been down the path of pulling out the datetime component onto the main report since this is the common x_axis component and thought it would simplify my work. I have then generated the second component data set in a subreport and plan to pull the others into separate subreports.
So the main report is using a record selection criteria:
{SAMPLE.DESCRIPTION} = "WiTower11" and
{SAMPLE.STATUS}="A" and
{RESULT.NAME}="TimeStamp" and
{SAMPLE.LOGIN_DATE} > LastFullMonth
and the fields placed in the report are sample.sample_number & result.entry. If I run preview at this point I get as expected. I can plot the returned date string against sample_number and it all works both placing the graph in the header or footer.
I have only been as far as the first subreport. The record selection criteria is;
{RESULT.NAME} = "Temperature"
and
{RESULT.SAMPLE_NUMBER} = {?Pm-SAMPLE.SAMPLE_NUMBER}
and the field placed in the report is result.entry. Placing the subreport in the details section adjacent to the main report fields works for the preview. I have added a formula into the subreport with the code:
and placed it into the subreport adjacent to the result.entry field. I find I have to do this to populate the dependancy.
I have next added a corresponding formula in the main report with:
shared numberVar temp;
temp
and placed this in the main report formula in details_b since I know that it has to sit below the subreport to populate the first record. Without the subreport placement this returns zero for every instance.
Previewing this gives the result.entry and the formula value displayed in the subreport and below the corresponding main report value. So all seems to be correct.
I then have taken out the main report formula, ran refresh and then placed the graph into the report footer. In the report dialog I have gone for a line graph and assigned:
onchangeof: result.entry (the main report field) and @temperature and don't summarise (the formula from the main report).
Running the review the graph comes back with a blue line on the zero y axis value and a blank x_axis. There are 2219 records. I have pondered wether the data returned is numerical since the result.entry field in the table can take textual results. Formatting the formula with ToNumber does not change the outcome.
I have tried not calling the first component into the main report - with the same outcome. If I add 1 to the subreport formula the graph then displays a blue line at 1 on the y_axis, to me meaning the graph is working but it's population from the subreport formula to the main report formula has an error somewhere.
I noticed there is an entry into the usergroup re calling values from subreports to the main report and the examples given are different depending on the data type. Unfortunately the number data type was not one of the examples. I have got my code from another source...
nb: the syntax is for an access Dbase since I am working remotely and have extracted the oracle master into access.
Thanks for the continuing support - much appreciated.
Actually, I believe the problem is that you are linking the subreports to the main report. I think you should try placing the subreports in the report header section with no linking. If you want to ensure the same samples, then use the same selection criteria in the subreport as in the main report.
If you need to display the subreport data at the detail level, then add the subreport again at the report header level and pass the shared variables from that subreport.
I am out of time tonight to give this a go - I do have a concern that it will make the report execution time too long for the purpose.
I have a note from another user group that suggests the best way is to place the graph in a subreport. Do you have any view on the pro's and con's of this over the main report.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.