Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange APPEND FROM problem
Message
From
29/03/2006 00:02:34
 
 
To
28/03/2006 23:50:52
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01108188
Message ID:
01108688
Views:
7
>>>I am probably missing something very simple (I guess too many hours working today <g>). Here is the situation:
>>>
>>>
>>>* Cursor MyCursor is empty
>>>* Table  MyTable has field PK. The first record of MyTable PK is 5
>>>* Other record in MyTable have different values of PK (1,2,etc).
>>>* The following command is supposed to append records...
>>>select MyCursor
>>>append from MyTable for MyTable.Pk = nPk
>>>* but the above works only if nPk is = 5 (that is, the value in the
>>>* first record of MyTable. If I try any other value of nPk, no
>>>* records are appended to MyCursor
>>>
>>>
>>>What am I missing?
>>>
>>>Thank you.
>>
>>The append from kind of reopens MyTable and selects it as the current alias for the time of the append.
>>The reopened alias is then closed and the previous workarea is reselected (MyCursor)
>>Hence, do not prefix Pk with any alias
>
>>
>>select MyCursor
>>append from MyTable for !deleted() and (Pk = m.nPk)  && !deleted() may be necessary
>>
>>
>>The code you are using can be translated as follows
>>
>>local AppendAnyRecord
>>AppendAnyRecord = (MyTable.Pk = nPk)
>>
>>select MyCursor
>>append from MyTable for m.AppendAnyRecord
>>
>
>Gregory,
>
>Following up your explanation that MyTable is reopened for the append (with a new alias, say XX) then APPEND FROM MyTable FOR MyTable.Pk = nPk is equivalent to: APPEND FROM xx FOR MyTable.pk = nPK.
>This is the equivalent, in turn, of asking to append ALL records from XX since MyTable is in a record with pk=nPk. (MyTable does not move from that record throughout the append). If MyTable were in a record for which pk # nPK, no records will be added.

Correct. Do a little test to verify

>The only problem with this is that I understand Dmitry found that only one record is appended in the original case, so this explanation is only correct if I misunderstood :)

I do not find that assertion in Dmitry's text. But I may have skipped that :)
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform