Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a Conditional Variable
Message
De
02/09/2008 09:47:00
 
 
À
02/09/2008 09:04:22
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01344079
Message ID:
01344112
Vues:
15
>I have a variable, m.FilterCondition, that is built as criteria is selected on the form. For example:
>
>m.FilterConditon = m.FilterCondition + " AND SomeValue = SomeOtherValue01"
>
>This works great until the same condition is selected again:
>
>m.FilterConditon = m.FilterCondition + " AND SomeValue = SomeOtherValue02"
>
>Now m.FilterCondition has both clauses, which causes problems. How can I ensure that I have a good conditional variable?

Hi,
I'd create a 'FilterCondition' class containing a string collection (one for each 'individual' filter condition) and a BuildFilter() method that concatenated them all together when needed. The method to add individual conditions to the collection would just need to check the existing collection and only add conditions that were not already there. An additional benefit would be that it would be simpler to remove individual conditions.

Regards,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform