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]Reference a field based on another fields value

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Reference a field based on another fields value
 Login/Join
 
Gold member
posted
I have a table output where I have multiple different task numbers as different fields. These will be dynamic based on an index table that is maintained by the business units. The value in these task fields is a date the task was completed. So for example, let's say I have these fields: Task1,Task2,Task3,Task4, and Task5.

I also have another field in my dataset that is just called Task. This Task field will have a numeric value such as 1,2,3,etc.

What I am wanting to do is use the output of the Task field to reference the other Task1,Task2,etc fields. Is this possible to do in WebFOCUS? Is there some type of function where the output of a field can be used to reference another field?

This message has been edited. Last edited by: <Emily McAllister>,


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
 
Posts: 83 | Registered: April 13, 2015Report This Post
Expert
posted Hide Post
Something like this?

COMPUTE TASK_COMPLETION_DATE/HYYMD = 
     IF TASK EQ 1 THEN TASK1
ELSE IF TASK EQ 2 THEN TASK2
ELSE IF TASK EQ 3 THEN TASK3
ELSE IF TASK EQ 4 THEN TASK4
ELSE IF TASK EQ 5 THEN TASK5
ELSE '';


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
I'd suggest using DB_LOOKUP, there's no need to recode when another 'new' task comes up as opposed to using COMPUTE/DEFINE.


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
 
Posts: 198 | Location: Amsterdam | Registered: August 24, 2011Report This Post
Gold member
posted Hide Post
I ended up using something similar to what you suggested Francis, but using some parameters to keep it somewhat dynamic.

SWES, I'll do some more research on DB_LOOKUP to see if it will get me there in a cleaner way.

Here's how I did it with parameters:

TASKCOMPARE/YYMD MISSING ON =  IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK1NAME' THEN &TASK1NAME ELSE
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK2NAME' THEN &TASK2NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK3NAME' THEN &TASK3NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK4NAME' THEN &TASK4NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK5NAME' THEN &TASK5NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK6NAME' THEN &TASK6NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK7NAME' THEN &TASK7NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK8NAME' THEN &TASK8NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK9NAME' THEN &TASK9NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK10NAME' THEN &TASK10NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK11NAME' THEN &TASK11NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK12NAME' THEN &TASK12NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK13NAME' THEN &TASK13NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK14NAME' THEN &TASK14NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK15NAME' THEN &TASK15NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK16NAME' THEN &TASK16NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK17NAME' THEN &TASK17NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK18NAME' THEN &TASK18NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK19NAME' THEN &TASK19NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK20NAME' THEN &TASK20NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK21NAME' THEN &TASK21NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK22NAME' THEN &TASK22NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK23NAME' THEN &TASK23NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK24NAME' THEN &TASK24NAME ELSE 
            IF 'TASK'|TRIM_(LEADING, '0', EDIT(TASK)) EQ '&TASK25NAME' THEN &TASK25NAME ELSE
            MISSING ;



Thanks


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
 
Posts: 83 | Registered: April 13, 2015Report This Post
Virtuoso
posted Hide Post
Why not this instead of evaluating TRIM and EDIT function 25 times ?
TSKRCV /A20V = 'TASK'|TRIM_(LEADING, '0', EDIT(TASK));
TASKCOMPARE/YYMD MISSING ON =  DECODE TSKRCV ('&TASK1NAME'  &TASK1NAME
                                              '&TASK2NAME'  &TASK2NAME
                                              '&TASK3NAME'  &TASK3NAME
                                              '&TASK4NAME'  &TASK4NAME
                                              '&TASK5NAME'  &TASK5NAME
                                              '&TASK6NAME'  &TASK6NAME
                                              '&TASK7NAME'  &TASK7NAME
                                              '&TASK8NAME'  &TASK8NAME
                                              '&TASK9NAME'  &TASK9NAME
                                              '&TASK10NAME' &TASK10NAME
                                              '&TASK11NAME' &TASK11NAME
                                              '&TASK12NAME' &TASK12NAME
                                              '&TASK13NAME' &TASK13NAME
                                              '&TASK14NAME' &TASK14NAME
                                              '&TASK15NAME' &TASK15NAME
                                              '&TASK16NAME' &TASK16NAME
                                              '&TASK17NAME' &TASK17NAME
                                              '&TASK18NAME' &TASK18NAME
                                              '&TASK19NAME' &TASK19NAME
                                              '&TASK20NAME' &TASK20NAME
                                              '&TASK21NAME' &TASK21NAME
                                              '&TASK22NAME' &TASK22NAME
                                              '&TASK23NAME' &TASK23NAME
                                              '&TASK24NAME' &TASK24NAME
                                              '&TASK25NAME' &TASK25NAME ELSE MISSING);

Note that I don't know what format should be TSKRCV, so you may need to ajust.


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
Gold member
posted Hide Post
That makes more sense Martin, thanks. Admittedly, I haven't used decode much, so it didn't pop in my mind.


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
 
Posts: 83 | Registered: April 13, 2015Report This Post
Virtuoso
posted Hide Post
You may need to use the .EVAL
DECODE TSKRCV ('&TASK1NAME.EVAL'  &TASK1NAME
...

I forgot in my first post


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
Master
posted Hide Post
When we needed to do something like this recently, it helped to separate the 'column determination' from the 'final report' creation.
DEFINE FILE GGSALES
-* Not part of technique, just creating data.  
 TASKNAME/A10 = DECODE SEQ_NO(1 'CAR'
                              2 'COUNTRY'); 
END
-*
-* Pull requested column names.  
-*
TABLE FILE GGSALES
PRINT TASKNAME
IF SEQ_NO EQ 1 OR 2
ON TABLE SAVE AS SVMETADT
END
-RUN
-SET &WORK = &LINES;
-*
-* Create report using requested column names.  
-*
TABLE FILE CAR
PRINT
-REPEAT END_COL_DEFINITION &WORK TIMES
-READ SVMETADT &COLUMN_NAME.A10.
&COLUMN_NAME
-END_COL_DEFINITION
ON TABLE SET ONLINE-FMT STANDARD
END  

1 PAGE     1
  
  
  CAR               COUNTRY                                                     
  ---               -------                                                     
  JAGUAR            ENGLAND   
  JENSEN            ENGLAND   
  TRIUMPH           ENGLAND   
  DATSUN            JAPAN     
  TOYOTA            JAPAN     
  ALFA ROMEO        ITALY     
  MASERATI          ITALY     
  AUDI              W GERMANY 
  BMW               W GERMANY 
  PEUGEOT           FRANCE   

No problem with combining the two processes, just an alternative approach that worked in our scenario.
 
Posts: 822 | Registered: April 23, 2003Report 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]Reference a field based on another fields value

Copyright © 1996-2020 Information Builders