Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble selecting data from tables into another table
Message
 
To
20/11/1998 16:57:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00159721
Message ID:
00160019
Views:
34
>Hello,
>
>Thank you for your answer Mr Butler, but my real problem is not only how to select the data from the tables, it's a little more complicated :
>Because I want to make a report of it, I have to use a cursor or a table. A cursor is prefered.
>I thought to do this:
>If the table is selected by the user to be on the report, I select its datafields and write them to a cursor.
>But I can't write to a cursor twice ! And because the structure of the tables to report from is different every time, I have trouble to write to a table too.
>I thought of using an array but I find it very difficult to do.....
>If you use SQL; you have to have one select statement in which all the needed fieldnames and tables are, to put them in a cursor. But I don't know all the field and tables because they've to be choosen by the user ! How can you get around this.
>
>My question is :
>Do you have any alternative options to not only select data from a table but in such a way that only the selected tables are in one table or one cursor, taking the previously stated story in mind.
>
>Thanks again.

Remco, you can take user input (selected fields and other options) and create your SELECT on the fly using macrosubstitution, like:

lcSelectedFields = " cust.c_id, bill.c_id, bill.payment "
lcFrom = " cust, bill "
lcwhere = " cust.c_id = bill.c_id AND bill.pending = .t. "

SELECT &lcSelectedFields ;
FROM &lcFrom ;
WHERE &lcWhere ;
INTO CURSOR myCursor
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform