Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Big Problem with simple code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01047265
Message ID:
01047269
Vues:
7
The problem as Mike has pointed out is one of an exact match as opposed to a match. The right-hand expression decides how much is checked. So, 'Domestic Chassis LED' = 'Domestic Chassis' since only the length of 'Domestic Chassis' is checked in the left-hand expression. There are a few different ways to fix this...
1. Switch the expression around
2. Use the exactly-equals operator "=="
3. Set Exact On

A simple demonstration may help illustrate this better...
SET EXACT OFF
?'Domestic Chassis LED' = 'Domestic Chassis' && .T. -- only len('Domestic Chassis') is checked to see if it matches
?'Domestic Chassis' = 'Domestic Chassis LED' && .F.

?'Domestic Chassis LED' == 'Domestic Chassis' && .F.
?'Domestic Chassis' == 'Domestic Chassis LED' && .F.

SET EXACT ON
?'Domestic Chassis LED' = 'Domestic Chassis' && .F.
?'Domestic Chassis' = 'Domestic Chassis LED' && .F.
>Out of no where my projects are screwed up.
>
>below m_recess_lights.value = selected for a drop-down by user
>
>CODE Example:
>
>mreclights = alltrim(m_recess_lights.value)
>do case
> case mreclights = 'Domestic Chassis'
> m_featureno = '3N0105'
> case mreclights = 'Import Chassis'
> m_featureno = '3N0106'
> case mreclights = 'Domestic Chassis LED'
> m_featureno = '3N0107'
> case mreclights = 'Import Chassis LED'
> m_featureno = '3N0108'
> otherwise
> m_featureno = ''
>endcase
>
>
>If I step through this and mreclights = 'Domestic Chassis LED' it will always process the 1st case statement, making m_featureno = '3N0105' and not the 3rd case statement as it should.
>
>If I step through this and mreclights = 'Import Chassis LED' it will always process the 2nd case statement, making m_featureno = '3N0106' and not the 4th case statment as it should.
>
>I don't know what happened or why it's doing this. The only way to fix this is to move the 3rd and 4th case statments above the 1st and 2nd case statments but I cannot because I'd have to do this in to many places.
>
>Thanks in advance for any help provided.
>
>Regards,
>Torrey
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform