Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCATTER to Object how do I add more propertys?
Message
From
29/04/2002 07:44:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
29/04/2002 07:33:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00649539
Message ID:
00650296
Views:
24
:) For your reference, later you'd refer to a single item as :

thisform.arrRecs[rcNo].FieldName

I actually use this approach where I have a form that should have controlsources set from multiple records at once. I set the controlsources to something like :

..Controlsource = "thisform.arrConfig[OPTION].FieldName"

and on save simply :

scan
gather name thisform.arrConfig[recno()]
endscan

Cetin

>Thanks Cetin
>
>Yes I see what you mean. I was only thinking in terms of a single record and some additional fields but your idea opens up a few new possibilities.
>
>Using multiple records in this way could be very useful in some circumstances where a view is inappropriate.
>
>I will mark this thread for future reference:)
>
>
>
>
>
>>>It is often handy to use the SCATTER NAME command to scatter
>>>fields to an Object.
>>>
>>>However there are many occasions where I would like to add a new property(s) to the object created, but the object created has no addproperty method to cater for this.
>>>
>>>At present I do this in rather cumbersome way.
>>>
>>>ie
>>>
>>>If I need another property called Section I would do the following
>>>
>>>SELECT *,left(code,2) as section from myTable into cursor myCursor
>>>
>>>then
>>>
>>>SCATTER NAME oMyob
>>>
>>>Most of the collection objects I have looked at are a bit heavy for what I want and require the name of the field passed as a parameter to reference contents.
>>>
>>>I also dont seem to be able to do the following
>>>
>>>SCATTER NAME thisform.myproperty
>>>
>>>However I can make thisform.myproperty = to an object previously created by SCATTER NAME myObj so this is not much of a problem. GATHER NAME thisform.myproperty works fine.
>>>
>>>I have a sneaking suspicion I may be going about things the wrong way, can anyone tell me if there is an easier way of doing this sort of stuff.
>>
>>Mark,
>>IMHO your way is good. You could save multiple records to a custom form array property. ie:
>>
>>select *, {} as myNewDate, space(20) as myNewChar ;
>> from myTable ;
>> into cursor myCursor ;
>> nofilter
>>dimension thisform.arrRecs[reccount()]
>>scan
>> scatter name thisform.arrRecs[recno()]
>>endscan
>>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform