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     Maximum Number of IF THEN ELSE Pairs?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Maximum Number of IF THEN ELSE Pairs?
 Login/Join
 
Platinum Member
posted
Can anyone tell me what the maximum number of IF THEN ELSE pairs in a defined field is?

A search in the technical documentation library for 7.6.x release indicates it is still 16, but I have used more than that with no problems.

I have hit the limit (found when the code errored) but although I could try to find the actual limit by removing lines one by one, I was hoping someone here would know.

BTW it's not possible for me to use a DECODE in this instance.

Thanks


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Virtuoso
posted Hide Post
To my knowledge that hasn't changed. Are you using it in a define or a compute? I've had to play games with defines to get it to work for me. Don't have the example in my mind though.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
you can get around that limit, you probably figured that out already.
NEWFIELD/A..=IF.....
ELSE 'XXXX';
NEWFIELD/A...=IF NEWFIELD NE 'XXX' THEN NEWFIELD ELSE
IF ...
ELSE 'XXXX';
...repeat the 2nd bit, redefining the same field name. And when your fex references the fieldname, focus always grabs the last defined one. handy trick.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
2 choices -

either rewrite your IF THEN ELSE expression as nested ifs if it is possible to divide the conditions equally or.

-or to retain the same if then else if logic which works like a filter since the tests in each if may not be mutually exclusive

-* needed expression too big with 100 max is 25 say
val = if expr1 then result1
else if expr2 then result2
...
else if expr100 then result100
else resultdefault ;

-* becomes
valgroup1/i2 = if expr1 then 1
else if expr2 then 1
...
else if expr24 then 1
else 0 ;

val1 = if expr1 then result1
else if expr2 then result2
...
else if expr24 then result24
else 0 ;

valgroup2/i2 = if valgroup1 eq 1 then 1
else if expr25 then 2
else if expr26 then 2
...
else if expr48 then 2
else 0 ;

val2 = if valgroup1 eq 1 then val1
else if expr25 then result25
else if expr26 then result26
...
else if expr48 then result48
else 0 ;

and so on...

Try it and you will soon get the idea



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Master
posted Hide Post
Suzannah's method is better and simpler if you can define an else that is not in the possible values so use that!



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Platinum Member
posted Hide Post
Thanks for the replies, I already have it set up in the way Susannah suggests, so it is working.

It was just before the code came up with the this is too long error, I had it working with at least 40 IF THEN ELSE statements!

After reading the documentation, I have split it up so there's only 16 per defined field now, and it works fine, I was just wondering if anyone else had more insight into this.

Thanks Again


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Virtuoso
posted Hide Post
I seem to remember that it was not the amount of if-then-else's but more a matter of how much memory it occupies. There is a certain amount of memory reserved for computational elements, and it goes per element. But I can't really remember how much memory that is.
Anyway, the problem is solved easily enough by splitting up, so you don't hit this memory limit any more.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report 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     Maximum Number of IF THEN ELSE Pairs?

Copyright © 1996-2020 Information Builders