Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] What is alternative to replace nested IF statement?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] What is alternative to replace nested IF statement?
 Login/Join
 
Member
posted
Hello,

New to Focus world. I ran into to the issue that I had too many if statements in either Define or Commuted field; and App studio gives me FOC0266 error. What is alternative way to handle many ifs?

Thanks
Thanit

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 7 | Registered: August 01, 2017Report This Post
Virtuoso
posted Hide Post
Hi Thanit

Welcome to Focal Point! It is a great resource to getting answers to your development questions.

Please post your code with code tags around it so we can see if we can detect the problem.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Member
posted Hide Post
Thanks Chuck.

Here is my code in a Define field (A3);

IF A_CODE EQ 'EMER' THEN '420' ELSE
IF A_CODE EQ 'AHM' THEN '420' ELSE
IF A_CODE EQ 'HSTU' THEN '420' ELSE
IF A_CODE EQ 'HSNT' THEN '420' ELSE
IF A_CODE EQ 'HSTN' THEN '420' ELSE
IF A_CODE EQ 'MED' THEN '420' ELSE
IF A_CODE EQ 'CMED' THEN '420' ELSE
IF A_CODE EQ 'MB' THEN '420' ELSE
IF A_CODE EQ 'MCBA' THEN '420' ELSE
IF A_CODE EQ 'MC' THEN '420' ELSE
IF A_CODE EQ 'NURS' THEN '420' ELSE
IF A_CODE EQ 'MEDX' THEN '420' ELSE
IF A_CODE EQ 'EMTP' THEN '420' ELSE
IF A_CODE EQ 'NURP' THEN '420' ELSE
IF A_CODE EQ 'RESP' THEN '420' ELSE
IF A_CODE EQ 'NURR' THEN '420' ELSE
IF A_CODE EQ 'ORT' THEN '420' ELSE
IF A_CODE EQ 'ACCT' THEN '430' ELSE
IF A_CODE EQ 'ACC' THEN '430' ELSE
IF A_CODE EQ 'AADJ' THEN '430' ELSE
IF A_CODE EQ 'BUAD' THEN '430' ELSE
IF A_CODE EQ 'ECA' THEN '430' ELSE
IF A_CODE EQ 'CIS' THEN '430' ELSE
IF A_CODE EQ 'CUL' THEN '430' ELSE
IF A_CODE EQ 'CULC' THEN '430' ELSE
IF A_CODE EQ 'ECD' THEN '430' ELSE
IF A_CODE EQ 'ECED' THEN '430' ELSE
IF A_CODE EQ 'EDUC' THEN '430' ELSE
IF A_CODE EQ 'BGEN' THEN '430' ELSE
IF A_CODE EQ 'HIS' THEN '430' ELSE
IF A_CODE EQ 'HRM' THEN '430' ELSE
IF A_CODE EQ 'CHRM' THEN '430' ELSE
IF A_CODE EQ 'DPRP' THEN '430' ELSE
IF A_CODE EQ 'ITGD' THEN '430' ELSE
IF A_CODE EQ 'DPM' THEN '430' ELSE
IF A_CODE EQ 'IMM' THEN '430' ELSE
IF A_CODE EQ 'MOB' THEN '430' ELSE
IF A_CODE EQ 'DPRN' THEN '430' ELSE
IF A_CODE EQ 'ITWD' THEN '430' ELSE
IF A_CODE EQ 'CSWP' THEN '430' ELSE
IF A_CODE EQ 'IMMC' THEN '430' ELSE
IF A_CODE EQ 'MOBC' THEN '430' ELSE
IF A_CODE EQ 'OAC' THEN '430' ELSE
IF A_CODE EQ 'PLG' THEN '430' ELSE
IF A_CODE EQ 'CPLG' THEN '430' ELSE
IF A_CODE EQ 'POL' THEN '430' ELSE
IF A_CODE EQ 'PSY' THEN '430' ELSE
IF A_CODE EQ 'SWO' THEN '430' ELSE
IF A_CODE EQ 'SOC' THEN '430' ELSE
IF A_CODE EQ 'WEB' THEN '430' ELSE
IF A_CODE EQ 'JOUR' THEN '450' ELSE
IF A_CODE EQ 'THEA' THEN '450' ELSE
IF A_CODE EQ 'COMM' THEN '450' ELSE
IF A_CODE EQ 'CW' THEN '450' ELSE
IF A_CODE EQ 'ENG' THEN '450' ELSE
IF A_CODE EQ 'GEN' THEN '450' ELSE
IF A_CODE EQ 'GLOS' THEN '450' ELSE
IF A_CODE EQ 'GRA' THEN '450' ELSE
IF A_CODE EQ 'LA' THEN '450' ELSE
IF A_CODE EQ 'PHO' THEN '450' ELSE
IF A_CODE EQ 'STU' THEN '450' ELSE
IF A_CODE EQ 'THEC' THEN '450' ELSE
IF A_CODE EQ 'EGR' THEN '460' ELSE
IF A_CODE EQ 'EGRT' THEN '460' ELSE
IF A_CODE EQ 'MNS' THEN '460' ELSE
IF A_CODE EQ 'HSCI' THEN '460' ELSE
IF A_CODE EQ 'ADVT' THEN '491' ELSE
IF A_CODE EQ 'AUT' THEN '491' ELSE
IF A_CODE EQ 'AUTC' THEN '491' ELSE
IF A_CODE EQ 'CPT' THEN '491' ELSE
IF A_CODE EQ 'CNC' THEN '491' ELSE
IF A_CODE EQ 'DDTC' THEN '491' ELSE
IF A_CODE EQ 'CAM' THEN '491' ELSE
IF A_CODE EQ 'CTEC' THEN '491' ELSE
IF A_CODE EQ 'CSUP' THEN '491' ELSE
IF A_CODE EQ 'ELT' THEN '491' ELSE
IF A_CODE EQ 'ELTC' THEN '491' ELSE
IF A_CODE EQ 'HVA' THEN '491' ELSE
IF A_CODE EQ 'IPT' THEN '491' ELSE
IF A_CODE EQ 'MTT' THEN '491' ELSE
IF A_CODE EQ 'MAN' THEN '491' ELSE
IF A_CODE EQ 'MPT' THEN '491' ELSE
IF A_CODE EQ 'PLB' THEN '491' ELSE
IF A_CODE EQ 'PLBC' THEN '491' ELSE
IF A_CODE EQ 'PCT' THEN '491' ELSE
IF A_CODE EQ 'SKTR' THEN '491' ELSE
IF A_CODE EQ 'TSTU' THEN '491' ELSE
IF A_CODE EQ 'WLD' THEN '491' ELSE 'N/A'


It works if I have only a few IFs. I think I might hit the limit.


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 7 | Registered: August 01, 2017Report This Post
Expert
posted Hide Post
Chuck is not on-LINE - here is a possible resolution for 1, you can complete the rest:
  
IF A_CODE IN ('EMER','AHM','HSTU','HSNT','HSTN','MED','CMED','MB','MCBA','MC','NURS','MEDX','EMTP','NURP','RESP','NURR','ORT') THEN '420' ELSE


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
An option using DECODE such as this (not all your data is in)
NEW_A_CODE/A3 = DECODE A_CODE ('EMER' '420' 'AHM' '420' 'HSTU' '420' 'HSNT' '420' 'HSTN' '420' 'MED' '420' 'CMED' '420' 'MB' '420' 'MCBA' '420' 'MC' '420' 'NURS' '420' 'MEDX' '420' 'EMTP' '420' 'NURP' '420' 'RESP' '420' 'NURR' '420' 'ORT' '420' 
                               'ACCT' '430' 'ACC' '430' 'AADJ' '430' 'BUAD' '430' 'ECA' '430' 'CIS' '430' 'CUL' '430' 'CULC' '430' 'ECD' '430' 'ECED' '430' 'EDUC' '430' 'BGEN' '430' 'HIS' '430' 'HRM' '430' 'CHRM' '430' 'DPRP' '430' 'ITGD' '430' 'DPM' '430' 'IMM' '430' 
			                   ....
			                  ELSE 'N/A');


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
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
Thank you both Tom and Martin. I will try Tom's suggestion first.

Thanit


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 7 | Registered: August 01, 2017Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] What is alternative to replace nested IF statement?

Copyright © 1996-2020 Information Builders