Focal Point
[SOLVED] Creating a Flag

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2597082406

May 23, 2011, 11:25 AM
umun
[SOLVED] Creating a Flag
Table A
 
VIN	NAME	DATE
Vin1	Test 1	2011-05-05
Vin1	Test 1	2011-05-10
Vin2	Test 2	2011-05-12
Vin3	Test 3	2011-05-01
Vin6	Test 6	2011-05-10
Vin7	Test 7	2011-05-02
Vin7	Test 7	2011-05-12
.
.
.

Table B
VIN	NAME	DATE	         FLAG
Vin1	Test 1	2011-05-05	1
Vin1	Test 1	2011-05-10	2
Vin2	Test 2	2011-05-12	1
Vin3	Test 3	2011-05-01	2
Vin6	Test 6	2011-05-10	1
Vin7	Test 7	2011-05-02	1
Vin7	Test 7	2011-05-12	2
.      
.
.
 


Please, can someoe suggest how I can generate Table B from Table A? That is adding 1s and 2s for all records in the table.

Thanks

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
May 23, 2011, 04:32 PM
Dan Satchell
As long as the data is already sorted by VIN, NAME, and DATE, this should be easy to do with a DEFINE or COMPUTE:

DEFINE FILE ....
 FLAG/I2 = IF (VIN NE LAST VIN) OR (NAME NE LAST NAME) THEN 1 ELSE (LAST FLAG + 1);
END



WebFOCUS 7.7.05
May 24, 2011, 04:16 AM
umun
Thanks for your suggestion.

But when your logic is applied, it means whenever VIN EQ LAST VIN and NAME EQ LAST NAME, Flag is 2.

Please, how would first row (vin1) have flag =1 and the second(which is same with row 1) have Flag 2.

Again, I think I will prefer a compute.


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
May 24, 2011, 04:27 AM
umun
It worked thanks. Still trying to use compute.

Thanks


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS