-SET &ECHO=ALL;
-*SET NODATA=0;
DEFINE FILE CAR
COUNTR/I11= IF COUNTRY EQ 'ENGLAND' THEN 1 ELSE 0;
CARS/I11= IF CAR EQ 'TOYOTA' THEN 1 ELSE 0;
STS/I11= IF SEATS EQ 2000 THEN 1 ELSE 0;
SLS/I11= IF SALES EQ 100000 THEN 1 ELSE 0;
ACL/I11= IF ACCEL EQ 777 THEN 1 ELSE 0;
DEALER_COST/D20.2= IF DEALER_COST GT 1000 THEN 1 ELSE 0;
RETAIL_COST/D20.2= IF RETAIL_COST GT 2000 THEN 1 ELSE 0;
SNO/I11 = IF COUNTR GE 1 THEN 1 ELSE
IF CARS GE 1 THEN 2 ELSE
IF STS GE 1 THEN 3 ELSE
IF SLS GE 1 THEN 4 ELSE
IF ACL GE 1 THEN 5 ;
END
TABLE FILE CAR
PRINT
-*COUNTR
DEALER_COST
RETAIL_COST
BY SNO
END
I was in need of the SNO irrespective whether the value is true or false. In the above code I get the SNO only when the value is 1 .Please provide me any suggestions as how I can get the SNO in sequence whether the value is 1 or 0.
Regards, MSAMThis message has been edited. Last edited by: Kerry,
June 06, 2010, 03:48 AM
<JG>
quote:
SNO/I11 = IF COUNTR GE 1 THEN 1 ELSE IF CARS GE 1 THEN 2 ELSE IF STS GE 1 THEN 3 ELSE IF SLS GE 1 THEN 4 ELSE IF ACL GE 1 THEN 5 ;
Incomplete logic
SNO/I11 = IF COUNTR GE 1 THEN 1 ELSE
IF CARS GE 1 THEN 2 ELSE
IF STS GE 1 THEN 3 ELSE
IF SLS GE 1 THEN 4 ELSE
IF ACL GE 1 THEN 5 ELSE 0;
June 06, 2010, 06:08 AM
Ram Prasad E
Are you looking for LIST or something like row number, then here it is
TABLE FILE CAR
PRINT
COMPUTE SNO/I11=SNO+1;
COUNTRY
CAR
BY COUNTRY NOPRINT
BY CAR NOPRINT
END
TABLE FILE CAR
LIST
COUNTRY
CAR
BY COUNTRY NOPRINT
BY CAR NOPRINT
END
DEFINE FILE CAR
COUNTR/I11= IF COUNTRY EQ 'ENGLAND' THEN 1 ELSE 0;
CARS/I11= IF CAR EQ 'TOYOTA' THEN 1 ELSE 0;
STS/I11= IF SEATS EQ 222 THEN 1 ELSE 0;
SLS/I11= IF SALES EQ 0 THEN 1 ELSE 0;
ACL/I11= IF ACCEL EQ 777 THEN 1 ELSE 0;
DEALER_CO/I11= IF DEALER_COST GT 1000 THEN 1 ELSE 0;
RET_CO/I11= IF RETAIL_COST GT 1000 THEN 1 ELSE 0;
SNO/I11= IF COUNTR GE 1 THEN 1 ELSE
IF CARS GE 1 THEN 2 ELSE
IF STS GE 1 THEN 3 ELSE
IF SLS GE 1 THEN 4 ELSE
IF ACL GE 1 THEN 5 ELSE 5 ;
-* IF DEALER_CO GE 1 THEN 6 ELSE
-* IF RET_CO GE 1 THEN 7 ELSE 7;
END
-*
TABLE FILE CAR
SUM
COUNTR
CARS
STS
SLS
ACL
DEALER_CO
RET_CO
BY SNO
-*ON TABLE HOLD AS HOLD1
END
-EXIT
The SNO value gets skipped when the value of the DEFINE field is 0.. Please suggest an idea..
Regards, MSAM
June 06, 2010, 06:30 PM
Waz
quote:
when the value of the DEFINE field is 0
The value of which define field ?
Can you post your output and what you are expecting?
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
June 06, 2010, 06:32 PM
Waz
quote:
WebFOCUS 7.11
Wow, you have v7.11
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
June 06, 2010, 09:34 PM
<msam>
it's 7.6.11
June 06, 2010, 09:42 PM
<msam>
Waz, What actually I'm trying to do is to generate a SNO based on the DEFINE fields so that I can use it as a FOR Field by joining to another table that has a SNO. But as per my above code the DEFINE fields generate the SNO only when the value is 1 and it stops at the DEFINE which ever has the value 0. I need to get the SNO for the above DEFINE fields irrespective whether the value returned is 1 or 0.Can we do that as per my logic or I'm I going in the wrong direction..
Regards, MSAM
June 06, 2010, 09:55 PM
Waz
If you are not getting a zero, then your not getting a zero.
But....
If you use some of the techniques specified in this forum, then you can force the existance of the zero.
e.g.
DEFINE FILE CAR
COUNTR/I11= IF COUNTRY EQ 'ENGLAND' THEN 1 ELSE 0;
CARS/I11= IF CAR EQ 'TOYOTA' THEN 1 ELSE 0;
STS/I11= IF SEATS EQ 222 THEN 1 ELSE 0;
SLS/I11= IF SALES EQ 0 THEN 1 ELSE 0;
ACL/I11= IF ACCEL EQ 777 THEN 1 ELSE 0;
DEALER_CO/I11= IF DEALER_COST GT 1000 THEN 1 ELSE 0;
RET_CO/I11= IF RETAIL_COST GT 1000 THEN 1 ELSE 0;
SNO/I11= IF COUNTR GE 1 THEN 1 ELSE
IF CARS GE 1 THEN 2 ELSE
IF STS GE 1 THEN 3 ELSE
IF SLS GE 1 THEN 4 ELSE
IF ACL GE 1 THEN 5 ELSE 5 ;
-* IF DEALER_CO GE 1 THEN 6 ELSE
-* IF RET_CO GE 1 THEN 7 ELSE 7;
END
-*
TABLE FILE CAR
SUM
COUNTR
CARS
STS
SLS
ACL
DEALER_CO
RET_CO
BY SNO ROWS 0 OVER 1 OVER 2 OVER 3 OVER 4 OVER 5
-*ON TABLE HOLD AS HOLD1
END
-EXIT
Just note that SNO after a HOLD does not exist, you will have to reference it by E01.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
June 07, 2010, 03:36 AM
<JG>
quote:
SNO/I11= IF COUNTR GE 1 THEN 1 ELSE IF CARS GE 1 THEN 2 ELSE IF STS GE 1 THEN 3 ELSE IF SLS GE 1 THEN 4 ELSE IF ACL GE 1 THEN 5 ELSE 5 ;
Read your own code.
SNO can never have a value of 0 based on your define.