Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count
Message
From
23/09/2004 09:48:09
 
 
To
23/09/2004 03:38:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Count
Miscellaneous
Thread ID:
00943945
Message ID:
00945348
Views:
18
yes i need explaine ..

COUNT(ncli) AS cnt_ncli, MAX(telno) AS last_telno FROM active ;&& every part pls.


The MAX function just saves whatever is the highest telno as the last_telno. In the example you started with,
1 111 aa 5 0
1 221 aa 5 0
1 332 aa 5 0
1 444 aa 5 0
1 555 aa 5 5

client 1 would have a last_telno of 555. And this works to identify the last number in the list for that client as long as they are in ascending numerical order.

GROUP BY 1 INTO CURSOR telno READWRITE&& and this part

Hilmar is right that READWRITE was added in Version 7. If you are using an older version, you can use TABLE instead of CURSOR and get the same result. Just remember to erase the table when your all done.

REPLACE ALL active.Count1 WITH telno.cnt_ncli,active.Count2 WITH IIF(active.telno=telno.last_telno,telno.cnt_ncli,0)&& i'm not sure about it ,and what you mean with iif.

The IIF function is a shortened version of:
IF active.telno = telno.last_telno
   REPLACE active.Count2 WITH telno.cnt_ncli 
ELSE
   REPLACE active.Count2 WITH 0
ENDIF
Using the IIF function allows you to do the REPLACE ALL instead of having to SCAN the telno table or cursor and evaluatte each record separately.
Jim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform