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] 2 fields in one define? Not sure how to describe.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] 2 fields in one define? Not sure how to describe.
 Login/Join
 
Gold member
posted
Greetings all. I have the following senerio:

DEFINE FILE xxx
key_val/A3V=
IF ((SUBJ EQ 'REL') and (CRSE IN ('100','200'))) THEN '1A' ELSE
IF ((SUBJ EQ 'ENG') and (CRSE IN ('100','200'))) THEN '1B' ELSE
...etc
key_desc/A60V=
IF ((SUBJ EQ 'REL') and (CRSE IN ('100','200'))) THEN 'Desc for REL' ELSE
IF ((SUBJ EQ 'ENG') and (CRSE IN ('100','200'))) THEN 'Desc for ENG' ELSE
...etc

As you can see, the IF statements are identical, it is just the field name and values that differ. If there anyway to achieve something like the following:

key_val/A3V, key_desc/A60V=
IF ((SUBJ EQ 'REL') and (CRSE IN ('100','200'))) THEN '1A','Desc for REL' ELSE
IF ((SUBJ EQ 'ENG') and (CRSE IN ('100','200'))) THEN '1B','Desc for ENG' ELSE
...etc

This may be in the lserv somewhere, but I do not even know how to decribe what to search for. Is what I am trying to do even possible?

Thanks all for your help.
Paul

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


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Report This Post
Virtuoso
posted Hide Post
So are you asking for 1A to say 'Desc for Rel" ?

if so then skip the 1A part and just put 'Desc For Rel'

or if that's not the way you do it then do the first define and then have a second define. Key_Desc/A60V = if Key_Val eq 1A then 'Desc for Rel.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
All kinds of ways to do this but I don't know of a function that gets you there.

How about:

DEFINE FILE XXX
KEYVALDESC/A63 = 
IF ((SUBJ EQ 'REL') and (CRSE IN ('100','200'))) THEN '1A Desc for REL' ELSE
IF ((SUBJ EQ 'ENG') and (CRSE IN ('100','200'))) THEN '1B Desc for ENG' ELSE
etc....
KEYVAL/A3V   = EDIT(KEYVALDESC,'999');
KEYDESC/A60V = EDIT(KEYVALDESC,'$$$999999999999999999999999999999999999999999999999999999999999');
END
  


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Expert
posted Hide Post
Cleanest idea possible.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Paul,

You can only assign values to one virtual field at a time within a Compute/Define. And that's certainly true for most languages I know. Though I can see the value in having the functionality you suggest.

Anyway, here's my take on one of at least 10 different efficient ways...or more...to do it:

KEYVAL/A3V  =IF NOT CRSE IN(100,200) THEN ' ' ELSE DECODE SUBJ('REL' '1A' 'ENG' '1B' ELSE ' ');
KEYDESC/A60V=DECODE KEYVAL('1A' 'Desc for REL' '1B' 'Desc for ENG' ELSE ' ');



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
 
Posts: 161 | Location: Dallas, TX | Registered: February 20, 2009Report This Post
Expert
posted Hide Post
From an ongoing maintenance perspective, I would suggest not making the define too complex, as someone else may come in the work on the fex and not understand what is being done.

At the very least, heavily document the program.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Thank you prarie and microfich. Both solutions worked. I used microfich's because it removed one whole series of 'IF' statements which was my goal.
Thanks you again.

Thanks davSmith, that was the term I was looking for....virtual field.


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Report 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] 2 fields in one define? Not sure how to describe.

Copyright © 1996-2020 Information Builders