Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
APPEND FROM file.txt TYPE SDF
Message
From
13/05/1999 13:11:33
 
 
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00217874
Message ID:
00218476
Views:
25
>>Jim,
>>
>>>That doesn't work either. The NewID is not even generated.>
>>
>>If it's not working, then something isn't set up correctly...Did you try it outside of your application by browsing the view and manually adding a new record?
>>
>>< Generating the newid's in the code works fine. The problem is the save is failing for some reason. I don't think busobj like to have records appeded from text files.>
>>
>>It's not really a business object issue...if you tried the same thing outside the context of a business object you'll probably run into the same problem.
>>
>>Kevin
>
>Kevin,
>
>I duplicated the same functionality outside the framework with no problems. I think it may be a framework issue.
>
>I opened my view, manually set table buffering, appended my text file, replaced all cid with newid(), and issued tableupdate(1,.t.). Everything saved just as it should!


Kevin,

I found the problem. The framework needs some tweeking. When you enable tablebuffering, the save method expects two parameters--tlAllRows and tlForce.
The developer has to remember to send those parameters in. Consider the code below:

LOCAL lcgetfile, lcolddirectory, loselect, loSetDefa

loSetDefa = CREATEOBJ('cSet', 'DEFAULT', 'j:\PROD\vfp\maximus\SOURCE\maximus')
lcgetfile = GETFILE("Files:txt","Import")

IF !EMPTY(lcgetfile)
loselect = CREATEOBJ('cSelect', THIS.GetALIAS())
APPEND FROM &lcgetfile TYPE SDF
SCAN
THIS.ONNEW()
ENDSCAN
THIS.SAVE(1,.T.)
ENDIF

Currently, the business object has a property for setting forced updates, llAllowforcedupdates, but there is no method for setting the nRows portion of the TABLEUPDATE() command. Which number the user passes can effect how the save behaves in different situations. The default value passed to the save method is always .F., which is not always correct. I think some code should be written to handle this passed parameter, and then handle any errors that may occur as a result. Also, the Getnextmodified function is very useful, and I would definately like to see some of that functionality in our business objects. If you refer to the original Codebook 3.0 manual, there is a great discussion on update strategies. I don't have the book with me now, but it is toward the beginning. By setting a few properties, a developer could decide whether he wanted to update all the rows in a table-buffered cursor, or one row at a time.

Hope I havn't bored you to death with my dissertation.

Regards,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform