Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combining two cursors
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00019482
Message ID:
00019491
Views:
40
>>>>I want to combine the contents of two cursors into another cursor. Is this possible? Both cursor have the same number of fields and the same field names.
>>> Yes -- cursors are quite flexible, though they are readonly when created from SQL. You can write to them also if you CREATE them or USE dbf('cursorname') again alias newname...
>>
>>I have two SQL SELECT statements that query two different tables that use the same field names. I need to produce a report based on this, so I thought I could select into two separate cursors and then combine the cursors. Do you have any suggestions on how I could accomplish this?
>>
>>Thanks!
>
>assuming cursora and cursorb are built,
>
>select cursora.*, cursorb.* from cursora, cursorb where [join condition] into cursor cursorc.

I'm not sure what he wants to do. If he does this, he'll get twice as many vars with _a, _b etc. Maybe he wants this? I don't know...

If he just wants to append, he can use dbf('cursora') again in o alias cursorc and then do something like

for i = 1 to reccount('cursorb')
insert into cursorc etc...
skip 1
endfor

then maybe index on cursorc for report...

What is it you're trying to do Jeff?
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform