Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET RELATION TO to update a cursor
Message
 
 
To
17/08/2019 11:30:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01670104
Message ID:
01670143
Views:
46
>>>UPDATE 2. I figured how I can have the SQL Update without hard-coded cursor names. Your approach (your SQL Update) works if I use alias (e.g. "XY") in the SQL Update. Here is the example:
>>>
>>>cTarget = "Target"
>>>cSource = "Source"
>>>Update (cTarget) ;
>>>	set week_no = XY.week_no, week_fr = XY.week_fr, week_to = XY.week_to ;
>>>from (cSource) XY where EVALUATE( cTarget + ".Pk_field" ) = XY.Pk_field
>>>
>>
>>Cetin, Please, if you have time, take a look at the message 01670130 to see if I am correctly using the alias.
>>Thank you.
>
>Yes, almost, I would never ignore mdot and use & instead of evaluate (IMHO SQL is the only place to use macro expansion & in VFP - and there were one other place that I don't remember now):
>
>
>cTarget = "Target"
>cSource = "Source"
>Update (m.cTarget) ;
>	set week_no = XY.week_no, week_fr = XY.week_fr, week_to = XY.week_to ;
>from (m.cSource) XY ;
>where &cTarget..Pk_field = XY.Pk_field
>
Thank you! I will replace in my code the EVALUATE() with macro.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform