Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor.GetRecordData ?
Message
From
27/10/2004 20:41:52
 
 
To
22/10/2004 06:07:55
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00953526
Message ID:
00955106
Views:
17
Thanks for the suggestion - very cool!

>Hi Mike:
>
>>I was thinking that I could emulate the a c# class type bizobj with properties for each field.
>
>I'm not entirely sure why you want to do this - it kind of negates all the benefits of the framework as it currently stands.
>
>>so that instead of something like this:
>>
>>WITH loBCSTypes
>> .Open
>> .New
>> .Replace( "cCategory" , "GL" )
>> .Replace( "cShortName", "ASSET" )
>> .Replace( "cName", "Asset" )
>> .Update()
>>Endwith
>>I could have something like
>>
>>WITH loBCSTypes
>> .Open
>> .New
>> .cCategory = "GL"
>> .cShortName = "ASSET"
>> .cName = "Asset"
>> .Update()
>>Endwith
>
>You could modify your business object (add a method) that runs through the properties and does a single REPLACE based on the property name and its current value. This way, you would only have a single REPLACE call that doesn't need the field name specifying each time (because the field name can be taken from the commensurate property name). You could call your new method prior to calling Update(). However (there is always a BUT <s>), you should remember what the REPLACE method gives you. Using the CM cursor object's REPLACE method calls FieldValid, AfterChange and refreshes any bound controls in the interface. So ideally, REPLACE should be called whenever a value is changed in the bound control, as indeed is exactly what happens at the moment using the standard Codemine approach. Using the standard approach, you never have to worry about manually calling the REPLACE method because the framework does that for you (at least from the interface).
>
>>Alternatly can you suggest another way to do this without the Replace?
>
>Sure, if you haven't already got a copy of the record data from the start of the editing session in a NAME object, to identify the field properties on your business object, you could SCATTER NAME from the existing data or use cursor::GetRecordData(), update the properties with the values from the matching properties on your business object and then GATHER NAME back to the cursor or using the counterpart method, cursor::SetRecordData() on the cursor represented by the bizobj. Then call cursor::Update().
>
>Hope this gives you a few ideas.
>
>Best
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform