Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning value to property of object indirectly
Message
De
22/11/2015 08:59:00
 
 
À
21/11/2015 23:33:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01627690
Message ID:
01627755
Vues:
42
If you compare always on object name and do NOT have operation wich need to be done one a number of collected objects in sequence, the collection is not the best datastructure to use: it forces an access like a scan to a table where you really want a seek() - in other languages you would talk about a hash table, offering you direct access to all collected objects. Just like in tables, count matters: looping through 10 objects or records is fast, but the speed difference grows with the # of records/objects compared. Similar to seek() access time is nearly identical/constant, especially if compared with sequential access. Think of Hash access like a Rushmore for memory access ;-)




>I had no idea this "simple" question would generate so many responses :-)
>
>To answer the person why I first get the object reference:
>
>I look through the collection first testing for a match on the object name - it may or may not exist in the collection. I *could* try instead to EVAL() against the collection using TRY/CATCH but that seems kinda clunky (though possibly faster, although the collection in this case is typically small). e.g.
>
>
>
>TRY
>   STORE EVAL("THIS.ioCollection." + tcObjectName ) TO loSavedObject
>CATCH
>   STORE .NULL. TO loSavedObject
>ENDTRY
>
>And this seemed to work just fine so let's go with that:
>
>><pre>
>>STORE m.tuValue TO EVAL("m.oSavedObject." + m.tcProperty)
>>
>>
>>Of course, it's easier to just pass the object in the first place.
>>
>>Tamar
>
>Thanks all!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform