Focal Point
[CLOSED] case type logic

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

May 30, 2017, 03:36 PM
Jimilives
[CLOSED] case type logic
Hi, I am not a web-focus user, but am at the mercy of one on a current project that I am on.
I am passing multiple fields that she uses for creating a report. I would like her to interrogate one field, and based on the value of that field, handle another field a certain way. I am a cobol mainframer, so something like - If field A = 'NA' move field A to field C, else move field B to field C. Sure would seem like a simple thing to do, but as I stated, I am not a web-focus developer. A little help for my web-focus newbie please. thanks

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


WebFOCUS 8
Windows, All Outputs
May 30, 2017, 03:51 PM
MartinY
Need to use a DEFINEd variable.

Something such as
DEFINE FILE CAR
AREA  /A10 = IF COUNTRY EQ 'ENGLAND' OR 'FRANCE' THEN 'EAST' ELSE IF COUNTRY EQ 'ITALY' THEN 'MIDDLE' ELSE 'WEST';
AREA2 /A10 = DECODE COUNTRY ('ENGLAND' 'EAST' 'FRANCE' 'EAST' 'ITALY' 'MIDDLE' ELSE 'WEST');
COST  /D10 = IF COUNTRY EQ 'ENGLAND' OR 'FRANCE' THEN RETAIL_COST ELSE DEALER_COST;
END

TABLE FILE CAR
PRINT AREA
      AREA2
      RETAIL_COST
      DEALER_COST
      COST
BY COUNTRY
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
May 30, 2017, 07:34 PM
Doug
Jimilives: Or, COMPUTE
TABLE FILE CAR
SUM 
COMPUTE AREA /A10 = IF COUNTRY EQ 'ENGLAND' OR 'FRANCE' THEN 'EAST' ELSE IF COUNTRY EQ 'ITALY' THEN 'MIDDLE' ELSE 'WEST';
COMPUTE AREA2/A10 = DECODE COUNTRY    ('ENGLAND' 'EAST' 'FRANCE' 'EAST' 'ITALY' 'MIDDLE' ELSE 'WEST');
      RETAIL_COST
      DEALER_COST
COMPUTE COST/D10 = IF COUNTRY EQ 'ENGLAND' OR 'FRANCE' THEN RETAIL_COST ELSE DEALER_COST;
BY COUNTRY
END

Check out the difference between DEFINE and COMPUTE.

Hendix?




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
May 31, 2017, 11:43 AM
FP Mod Chuck
Hi Jimilives

Welcome to Focal Point as you can already see people are very quick to reply and give you the guidance you need.

Since you are so new to WebFOCUS I would highly recommend using IBI education services to help get up to speed.

Don't be shy to reach out!


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats