Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN ..... ENDSCAN
Message
From
21/06/2001 03:44:04
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
 
 
To
21/06/2001 03:01:07
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00521771
Message ID:
00521774
Views:
16
Hi Richard,

I don't know of any function such as LAG(), but how about something like:
CREATE CURSOR testing ;
    ( testfield N(1) )
	
FOR nLoop = 1 TO 9
    INSERT INTO testing ;
        ( testfield ) ;		
        VALUES ( nLoop )
ENDFOR

SCAN
    cWindow = STR(testfield,1) + " is the current value"
    IF RECNO() # 1
        cWindow = cWindow ;
	        + " and " + STR(m.testfield,1) + " is the previous value"
    ENDIF
    WAIT WINDOW cWindow
    SCATTER MEMVAR MEMO FIELDS testfield
ENDSCAN
Hope this helps,
Gavin...

>Hi all again,
> I'm doing some computations on a records in a table using the SCAN ... ENDSCAN. I have a variable (var1) which stores the compound number (1, 2, 3,..) and var2 (1, 2, 3,..) which stores the house number. Var2 is incremented by one from the previous record if the compound is the same otherwise var2 starts from one again. I was wondering if there's a function in VFP6 that can lag values (something like the LAG() function in SAS!). Or how do I go about this? I want my code to "see" the previous value of compound (var1) and/or house (var2).
>
>Thanks in advance guys.
>Richard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform