Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fields in a cursor
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00566548
Message ID:
00566602
Views:
15
It can be even easier if it is possible to create the cursor to insert data to (which is cCursor4) with the same field names as in cCursor instead of c1, c2, etc.

SELECT (cCursor)
SCATTER MEMVAR
INSERT INTO (cCursor4) FROM MEMVAR

This technique may not apply (or apply partially) if you do the INSERTs from other sources too.

>You don't have to prefix in the field list cCursor4 and you can scatter memvar memo in cCursor1, so you would use m.pp, m.fname, etc. Or you should use Larry's suggestion or another alternative would be evaluate(cCursor+".pp"), etc.
>
>>>>I keep getting syntax error when I save my code. I'm trying to reference fields in my cursor as below. Is it not possible to refer to fields in cursor as (cursor).field ?
>>>>
>>>>
>>>>
>>>INSERT INTO (cCursor4) ((cCursor4).c1, (cCursor4).c2, (cCursor4).c3, (cCursor4).c4, ;
>>>	(cCursor4).c5, (cCursor4).c6, (cCursor4).c7, (cCursor4).c8, (cCursor4).c9, ;
>>>	(cCursor4).c10) ;
>>>	VALUES((cCursor).pp, (cCursor).fname, (cCursor).totpay, (cCursor).fica,  (cCursor).retire_amt, ;
>>>	(cCursor).health_ins, (cCursor).retiree_med, (cCursor).unempins, (cCursor).wrkcompins, ;
>>>	(cCursor).total_salary)
>>>				
>>>>
>>>>
>>>>
>>>>Thanks
>>>>Nick Patel
>>>
>>>I believe you have to use
>>>
>>>&cCursor4..
>>>
>>>You must use the double "." because the first . stops the macro substitution and the second will be used in the expression.
>>>
>>>HTH.
>>
>>
>>I tried (&cCursor4)".".fname and it did allow me to save, but when I ran the program, it gave me a syntax error. I even tried (&cCursor4).fname and it still gave me an error. Apparently it sees the value in &cCursor4 just fine, it just doesn't understand fname.
>>
>>Thanks
>>Nick Patel
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
Next
Reply
Map
View

Click here to load this message in the networking platform