Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help on Array
Message
De
26/08/2013 16:54:07
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01581462
Message ID:
01581468
Vues:
47
Thanks To all.


I am using the following code to get the Maximum two values of posR from a cursor.
>>
>>
>>SELECT TOP 2 posR FROM PageTwo ORDER BY posR DESC INTO ARRAY Maxrows
>>nfisrtposR=Maxrows(1)
>>nSecondposR=Maxrows(2)
>>
>>
>>However, i a case I am encountered with a situation where there is no posR in Pagetwo and at that situation my program generates error as Maxrows(1).prg does not exist.
>>
>>Whats the Problem, How to overcome it ?
>
>Well, this seems to be easy.
>
>lnRows = _tally
>
>if m.lnRows > 1
>   nFirstPosR = maxRows[1]
>else
>   nFirstPosR = some default value, you can also display a message
>endif
>
>if m.lnRows = 2
>   nSecondPosR = maxRows[2]
>else
>   less than 2 rows - work this condition
>endif
>
Harsh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform