Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Logic Conumdrum - Volunteers?
Message
De
08/03/2006 14:25:38
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Logic Conumdrum - Volunteers?
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01102577
Message ID:
01102577
Vues:
54
Given:

If a record exists with und_owner = 1, then it is a guideline for all. Those values are used UNLESS a record exists for the specific agent. Any record for specific agent will override the setting in the record with the und_owner = 1.
ag_account = 5608  && und_owner=5608 will be agent specific settings
ag_pmtnb6 = 5        
ag_maxnb6 = 5
 
SCAN WHILE NOT EOF()
   IF UNDGUIDE.UND_EFF <= DATE() AND ( UNDGUIDE.UND_OWNER = 1 OR UNDGUIDE.UND_OWNER = m.ag_account)
      CASE UNDGUIDE.UGI_ID = UGI_MAX6PMT  
         IF BETWEEN(UNDGUIDE.UND_VALUE,1,6)
            m.ag_maxnb6 = UNDGUIDE.UND_VALUE  <--und_value = 4 in the record for und_owner = 1
            m.ag_maxrn6 = UNDGUIDE.UND_VALUE
            *--Here ag_pmtnb6 is changed to 4 because ag_maxnb6 is now 4
            IF m.ag_pmtnb6 > m.ag_maxnb6    
              m.ag_pmtnb6 = m.ag_maxnb6
            ENDIF
         ENDIF
 
*Now based on the record with und_owner = 1 above the two values below have been changed:
 
*ag_pmtnb6 = 4 
*ag_maxnb6 = 4
 
*Next the record und_owner = 5608 is found which does not change the ag_pmtnb6 back
 
CASE UNDGUIDE.UGI_ID = UGI_MAX6PMT  
IF BETWEEN(UNDGUIDE.UND_VALUE,1,6)
    m.ag_maxnb6 = UNDGUIDE.UND_VALUE <--und_value = 5 in the record for und_owner=5608
    m.ag_maxrn6 = UNDGUIDE.UND_VALUE
    IF m.ag_pmtnb6 > m.ag_maxnb6    <<<<----Here ag_pmtnb6 is not changed because it is now 4 and 4 < 5
        m.ag_pmtnb6 = m.ag_maxnb6
    ENDIF
ENDIF
This obviously is not working. A value of ag_pmtnb6 should be 5 not 4 when the code finished because we set it to 5 before the code is run and the record for und_owner=5608 with the ag_maxnb6 value allows for 5 as the max value for 5608.
When the code hits the record for und_owner=1 it sets ag_pmtnb6 to 4. Then it hits the record specific for the agent und_owner=5608 but only the allowed max value is changed and the modified value is under it so it is not changed. The logic is all wrong. ideas?
The rule is, if no records exist for that guideline for und_owner=ag_account (specific agent), then use the record with und_owner=1(default for all agents). If no record exists for und_owner=ag_account or und_owner=1, then don't change the value. There are probably 50 values to check.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform