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] Conditional Compute / Compute on Change?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Conditional Compute / Compute on Change?
 Login/Join
 
Master
posted
Folks,
I have a requirement to obfuscate some patient information I am delivering to an external customer (but it must remain consistent).

The closest approximation I have in the car table follows:

My Code:
  
TABLE FILE CAR
PRINT
COUNTRY 
CAR 
MODEL
COMPUTE COUNTER/I6 = COUNTER + 1; NOPRINT
COMPUTE FAKE_MODEL_NAME/A50 = 'MODEL' || EDIT(COUNTER);
WARRANTY
STANDARD
WHERE CAR EQ 'JAGUAR';
END


My Results:
  
COUNTRY CAR MODEL FAKE_MODEL_NAME WARRANTY STANDARD 
ENGLAND JAGUAR V12XKE AUTO MODEL000001 12 MONTHS OR 12000 MILES POWER STEERING 
ENGLAND JAGUAR V12XKE AUTO MODEL000002 12 MONTHS OR 12000 MILES RECLINING BUCKET SEATS 
ENGLAND JAGUAR V12XKE AUTO MODEL000003 12 MONTHS OR 12000 MILES WHITEWALL RADIAL PLY TIRES 
ENGLAND JAGUAR V12XKE AUTO MODEL000004 12 MONTHS OR 12000 MILES WRAP AROUND BUMPERS 
ENGLAND JAGUAR V12XKE AUTO MODEL000005 12 MONTHS OR 12000 MILES 4 WHEEL DISC BRAKES 
ENGLAND JAGUAR XJ12L AUTO MODEL000006 12 MONTHS OR 12000 MILES POWER STEERING 
ENGLAND JAGUAR XJ12L AUTO MODEL000007 12 MONTHS OR 12000 MILES RECLINING BUCKET SEATS 
ENGLAND JAGUAR XJ12L AUTO MODEL000008 12 MONTHS OR 12000 MILES WHITEWALL RADIAL PLY TIRES 
ENGLAND JAGUAR XJ12L AUTO MODEL000009 12 MONTHS OR 12000 MILES WRAP AROUND BUMPERS 
ENGLAND JAGUAR XJ12L AUTO MODEL000010 12 MONTHS OR 12000 MILES 4 WHEEL DISC BRAKES 


My Desired Results:
  
COUNTRY	CAR	MODEL	FAKE_MODEL_NAME	WARRANTY	STANDARD
ENGLAND	JAGUAR	V12XKE AUTO	MODEL000001	12 MONTHS OR 12000 MILES	POWER STEERING
ENGLAND	JAGUAR	V12XKE AUTO	MODEL000001	12 MONTHS OR 12000 MILES	RECLINING BUCKET SEATS
ENGLAND	JAGUAR	V12XKE AUTO	MODEL000001	12 MONTHS OR 12000 MILES	WHITEWALL RADIAL PLY TIRES
ENGLAND	JAGUAR	V12XKE AUTO	MODEL000001	12 MONTHS OR 12000 MILES	WRAP AROUND BUMPERS
ENGLAND	JAGUAR	V12XKE AUTO	MODEL000001	12 MONTHS OR 12000 MILES	4 WHEEL DISC BRAKES
ENGLAND	JAGUAR	XJ12L AUTO	MODEL000002	12 MONTHS OR 12000 MILES	POWER STEERING
ENGLAND	JAGUAR	XJ12L AUTO	MODEL000002	12 MONTHS OR 12000 MILES	RECLINING BUCKET SEATS
ENGLAND	JAGUAR	XJ12L AUTO	MODEL000002	12 MONTHS OR 12000 MILES	WHITEWALL RADIAL PLY TIRES
ENGLAND	JAGUAR	XJ12L AUTO	MODEL000002	12 MONTHS OR 12000 MILES	WRAP AROUND BUMPERS
ENGLAND	JAGUAR	XJ12L AUTO	MODEL000002	12 MONTHS OR 12000 MILES	4 WHEEL DISC BRAKES


I want to be sure I'm not missing something like a 'Conditional Compute/ Compute on Change' or a 'By Compute' option.

Many thanks!
-ABT

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


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
I am not getting the exact output with the code you posted but in any case try:

TABLE FILE CAR
PRINT
COUNTRY 
CAR 
MODEL
COMPUTE COUNTER/I6 = IF MODEL EQ LAST MODEL THEN COUNTER + 1 ELSE 1; NOPRINT
COMPUTE FAKE_MODEL_NAME/A50 = 'MODEL' || EDIT(COUNTER);
WARRANTY
STANDARD
WHERE CAR EQ 'JAGUAR';
END


That should give you the same COUNTER value for each MODEL.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
Please keep in mind that your records *must* be sorted in a specific way for the LAST function to return consistent results.

The code I provided is very simple because it was intended to illustrate a concept. However, it is assumed that the source data is already sorted by COUNTRY, CAR, MODEL.

In addition, the IF EQ LAST may not be sufficient depending on your data. For instance, if the same MODEL exists for 2 different CAR's in the same COUNTRY and you need your counter to be reset upon each change in the whole hierarchy, then you'll need to elaborate more on the IF condition to account for changes in both COUNTRY and CAR as well as MODEL.

I hope that makes sense!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Master
posted Hide Post
Thanks njsden, I'll give it a try today and see what develops.


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
<JG>
posted
The basic idea is correct but the logic back to front

What's also worth noting is that in this instance the CAR file is not really a good source
because of the multi-path nature of what you are looking at.

Having the equivalent of model occur multiple times is not an issue and what you code
is dependant on how you want the counters resetting dependant on sort changes.

For example if you want to reset the counter to 1 for each change in country / car in the example below

COMPUTE COUNTER/I6 = IF XMODEL EQ LAST XMODEL THEN LAST COUNTER ELSE LAST COUNTER + 1; NOPRINT

becomes

COMPUTE COUNTER/I6 = IF COUNTRY NE LAST COUNTRY THEN 1 ELSE
IF CAR NE LAST CAR THEN 1 ELSE
IF XMODEL EQ LAST XMODEL THEN LAST COUNTER ELSE LAST COUNTER + 1; NOPRINT

SET CARTESIAN = ON
-RUN
TABLE FILE CAR
PRINT
COMPUTE XMODEL/A24=MODEL;
WARRANTY
STANDARD
BY COUNTRY
BY CAR
BY TOTAL XMODEL
WHERE CAR EQ 'JAGUAR'
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
PRINT
COUNTRY
CAR
MODEL
COMPUTE COUNTER/I6 = IF XMODEL EQ LAST XMODEL THEN LAST COUNTER ELSE LAST COUNTER + 1; NOPRINT
COMPUTE FAKE_MODEL_NAME/A50 = 'MODEL' || EDIT(COUNTER);
WARRANTY
STANDARD
END
 
Report This Post
Master
posted Hide Post
Thanks everyone for your suggestions. I appreciate your insights to the issue. The methods discussed just never really looked quite straightforward to me (no fault on the suggestors).

Since this was for a one time dataset delivery, I ended up writing out a patient identifier table that generated the 'PATIENT######' fake name and the real patient ID that was held and joined back in later with the rest of the data.

Thanks again to everyone who provided tips and helping me further my journey into WebFOCUS.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report 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] Conditional Compute / Compute on Change?

Copyright © 1996-2020 Information Builders