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

Problem with Report using views and using set relation

Status
Not open for further replies.

jmcfarlane

Programmer
Mar 21, 2001
21
CA
Hello all, I am having a problem with reports. I have converted a stand alone app to client server. Thus I am using views. In my report that I am having difficulty with, I have a main view that has links to other tables. So I have been using set relation to link in the other views. When running the report I will once every few runs get the info from the related views repeating. It looks like the set relation never suceeded.

Does anyone have an idea what do do to fix this?

Jason
 
Unless the report is very large, I've always found it easier to create a cursor with an SQL SELECT using all the tables, and report on it. (The results are often more consistent too if you need to run the report again - the data woun't change in the local cursor!)

Rick
 
I concur with Rick, and not only for VFP Report Writer. I prefer selecting the data into a cursor, or temp table if you need to modiify it, and then sending it to the report. It also aids in debugging since you can browse the data and verify what you're getting is what you think you should be getting. Finally, it is usually faster.

When sending to a cursor or temp table I usually create a unique key and then clean it up when I am done. That is my preference anyway.

The SYS(2015) does a good job at creating the key. The first character is always an underscore so I added a random fuction to convert it to an A thru Z. A little safety net here to ensure it is unique.

Here is the code for my random key.

lcCursor = makeNewKey()
SELECT employee.name FROM employee INTO CURSOR (lcCursor)

REPORT FROM boo TO PREVIEW

FUNCTION makenewkey
RETURN CHR(INT((26 - 1 + 1) * RAND( ) + 1)+64) + RIGHT(SYS(2015),9)

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top