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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report based on a View Problem

Status
Not open for further replies.

jvalk

Programmer
Jun 28, 2000
4
0
0
NL
I have created a report based on a view. When I preview this report in design mode everything is OK. But when I preview the report in the running program and I want to see the next page, the report can not find variables. When I use the full fieldnames including the alias name instead of only the fieldname this is OK, but when I go to the next page I only see all the same records.
 
This does not sound like a &quot;view problem&quot;, but a variable scoping problem.<br><br>Try isolating the problem by taking the view out of the picture:<br><br>1) Dump the data out to a .DBF file.<br>&nbsp;&nbsp;&nbsp;USE MyView<br>&nbsp;&nbsp;&nbsp;REQUERY()<br>&nbsp;&nbsp;&nbsp;COPY TO frxTable<br>&nbsp;&nbsp;&nbsp;USE IN MyView<br>&nbsp;&nbsp;&nbsp;USE frxTable EXCLUSIVE<br><br>2) Call your report from a simple program.&nbsp;&nbsp;At first, declare all variable PUBLIC to make sure it works as you think. <br><br>&nbsp;&nbsp;&nbsp;PUBLIC gdStart, gdEnd<br>&nbsp;&nbsp;&nbsp;USE frxTable<br><br>&nbsp;&nbsp;&nbsp;*- Make sure &quot;development&quot; environment still works.<br>&nbsp;&nbsp;&nbsp;MODIFY REPORT MyFrx<br><br>&nbsp;&nbsp;&nbsp;*- After saving changes to the report, run it.&nbsp;&nbsp;It should work just like in the previous MODIFY REPORT above.<br>&nbsp;&nbsp;&nbsp;REPORT FORM MyFrx PREVIEW<br><br>&nbsp;&nbsp;&nbsp;*- See which memvars (if any) remain after the report.&nbsp;&nbsp;If you use report variables, they can be released by the REPORT FORM command, and therefore be GONE at this point.<br>&nbsp;&nbsp;&nbsp;LIST MEMORY LIKE *<br><br>You only have to used aliased field names for cursor fields in other work areas.&nbsp;&nbsp;The field name alone if fine for the current alias.<br><br>Hope this helps.<br><br>
 
It sounds like the table from which the report pulls data is not the currently selected table when the report is run.&nbsp;&nbsp;The clues I'm going by are:&nbsp;&nbsp;adding alias makes data appear; but its the same data over and over. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
watch your variables and remember if they are form properties they go out of scope.&nbsp;&nbsp;almost sounds like you're defining memvars from the command window in design time which makes your vars public.&nbsp;&nbsp;Then in runtime they are not and are expected or needed to be the way you have your code.&nbsp;&nbsp;Also if you preface the variables in your view definition with a ? you can create a parametized view that prompts the user for the value if it is previously undefined.&nbsp;&nbsp;Watch the scope of your mevars and check the DE of the report.&nbsp;&nbsp;Generally I never use the DE of a report or aliases.<br> <p>John Durbin<br><a href=mailto: > </a><br><a href= > </a><br>ICQ VFP ActiveList #73897253
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top