Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning value to property of object indirectly
Message
De
21/11/2015 23:33:42
 
 
À
21/11/2015 08:35:06
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:
01627748
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform