Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
No Duplicates
Message
De
05/05/2010 11:04:48
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01462570
Message ID:
01463227
Vues:
20
>>Ok lets see
>> select the table, set an index declare variables
>>
>>Then you Replace the IDfield(the ton of Zeroes granted we didnt do the previous replace) with if and only if the test.fname=m.pcname.
>>
>>NVL returns statement 2 if statement 1 is null.
>>
>>so NVL(_VFP.setvar('pnRec',m.pnRec+1),1)= Setvar sets a variable to a value pnrec an pnrec+1 i would believe but if null 1 is returned?
>>
>>NVL(_VFP.SetVar('pcName', crsTest.FName),1)=same as above mostly but different expressions for 1 and 2
>>
>>
>>* NVL(_VFP.SetVar('pnRec', 0),1)) * (m.pnRec + 1) IN crsTest NEXT 40= pnrec an 0 is the first expression and if null sis returned 1 is returned?
>>*(mpnrec+1) not too sure and also not sure about NEXT 40
>
>Instead of next 40 try WHILE NOT EOF(). I wanted to make sure that the replace runs in the order I specified. NEXT respects the order set, replace ALL doesn't seem to respect the order.
>
>The idea of manipulations with _VFP.SetVar is to increment the counter if we're in the same group and reset to 0 if the new group starts.
>
>_VFP.SetVar returns NULL. So I use NVL and convert the return value to 1
>
>Essentially, it translates to
>
>   IF Same group
>      pnRec = m.pnRec + 1
>  else
>    pnRec = 0
>endif
>
>and the result of my function always would be 1, so I can use it to multiply.
>
>Perhaps the same idea can be translated into slightly different code, I did the first that came to mind.
>
>Yes, I'm thinking this code can be changed to
>
>IDField with IIF(pcName = crsTest.fName, nvl(_VFP.SetVar('pnRec',m.pnRec+1), m.pnRec), nvl(_VFP.SetVar('pcName',crsTest.fName),1) *
>nvl(_VFP.SetVar('pnRec',1), m.pnRec)))
i did change the last part of the code it seemed to have a bracket issue as in it wasnt closed properly ill add your tweak but so far everyone in the first 40 got the value 1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform