Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pemstatus vs amembers
Message
 
À
30/11/2010 00:26:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01491017
Message ID:
01491046
Vues:
81
You should also consider:
IF  TYPE("loMyObject." + cNewProperty) = "U"
   ADDPROPERTY(loMyObject,cNewProperty,"Test Value")
ENDIF
If you know the name of the property and it's not a variable you can also use VARTYPE() for better performance yet:
IF  TYPE(loObject.cProperty) = "U"
   ADDPROPERTY(loMyObject,"cProperty","Test Value")
ENDIF
I suspect either of these will be faster faster than either PEMSTAUS and certainly AMEMBERS.

+++ Rick ---

>I have a program that checks to see if a property already exists on an object before adding it, which would be the better way to determine if the property already exists?
>
>
>    AMEMBERS( m.laPropertySet, m.loMyObject )
>    IF ASCAN(m.laPropertySet,[cNewProperty],1,0,1,1)>0 && Case insensitive search, 0-not found
>      ADDPROPERTY( m.loMyObject, [cNewProperty], [Test Information])
>    ENDIF
>    
>    && or should I do this instead:
>    
>    IF PEMSTATUS( m.loMyObject, [cNewProperty], 5)
>      ADDPROPERTY( m.loMyObject, [cNewProperty], [Test Information])
>    ENDIF
>
>
>What do you think?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform