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.
I want to replace a missing value by a default value to my field. I have trouble with it. I tried all Webfocus documentation solutions and more. What is wrong with this code?
SET ALL = PASS JOIN EMPDATA.EMPDATA.PIN IN EMPDATA TO ALL TRAINING.TRAINING.PIN IN TRAINING AS JOIN1 END DEFINE FILE EMPDATA CODE/A10=IF (COURSECODE IS MISSING OR COURSECODE EQ '') THEN 'AAA' ELSE COURSECODE; EXP/D12.2=IF (EXPENSES IS MISSING OR EXPENSES EQ 0) THEN 0 ELSE EXPENSES; EXPSAL/D12.2=EXP + SALARY; END
TABLE FILE EMPDATA PRINT LASTNAME AND FIRSTNAME AND COURSECODE AND EXPENSES AND CODE AND EXP AND EXPSAL BY PIN WHERE EXPENSES GT 3000 END
The problem that you have is most of your defines are occurring on your child data source (TRAINING) plus the filter that you have coded is on EXPENSES which also resides on your child data source.
You could approach it from a different angle and use MATCH or you could hold the data from your original and then issue your defines on the held data file. Either way is relevant and should give you success.
Try these code snippets -
MATCH FILE EMPDATA
SUM LASTNAME
FIRSTNAME
SALARY
BY PIN
RUN
FILE TRAINING
SUM COURSECODE
EXPENSES
BY PIN
AFTER MATCH HOLD AS TEMPHLD1 OLD
END
DEFINE FILE TEMPHLD1
CODE/A10 = IF (COURSECODE IS MISSING OR COURSECODE EQ '') THEN 'AAA' ELSE COURSECODE;
EXP/D12.2 = IF (EXPENSES IS MISSING OR EXPENSES EQ 0) THEN 0 ELSE EXPENSES;
EXPSAL/D12.2 = EXP + SALARY;
END
TABLE FILE TEMPHLD1
PRINT LASTNAME
FIRSTNAME
COURSECODE
EXPENSES
CODE
EXP
EXPSAL
BY PIN
WHERE (EXPENSES GT 3000 OR EXPENSES IS MISSING)
END
and
SET ALL = PASS
JOIN LEFT_OUTER PIN IN EMPDATA TO ALL PIN IN TRAINING AS JOIN1
TABLE FILE EMPDATA
PRINT LASTNAME
FIRSTNAME
SALARY
COURSECODE
EXPENSES
BY PIN
ON TABLE HOLD AS TEMPHLD0
END
DEFINE FILE TEMPHLD0
CODE/A10 = IF (COURSECODE IS MISSING OR COURSECODE EQ '') THEN 'AAA' ELSE COURSECODE;
EXP/D12.2 = IF (EXPENSES IS MISSING OR EXPENSES EQ 0) THEN 0 ELSE EXPENSES;
EXPSAL/D12.2 = EXP + SALARY;
END
TABLE FILE TEMPHLD0
PRINT LASTNAME
FIRSTNAME
COURSECODE
EXPENSES
CODE
EXP
EXPSAL
BY PIN
WHERE (EXPENSES GT 3000 OR EXPENSES IS MISSING)
END
Good luck
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
... or you could just move your defines into the table request as computes -
SET ALL = PASS
JOIN LEFT_OUTER PIN IN EMPDATA TO ALL PIN IN TRAINING AS JOIN1
TABLE FILE EMPDATA
PRINT LASTNAME
FIRSTNAME
COURSECODE
EXPENSES
COMPUTE CODE/A10 = IF (COURSECODE IS MISSING OR COURSECODE EQ '') THEN 'AAA' ELSE COURSECODE;
COMPUTE EXP/D12.2 = IF (EXPENSES IS MISSING OR EXPENSES EQ 0) THEN 0 ELSE EXPENSES;
COMPUTE EXPSAL/D12.2 = EXP + SALARY;
BY PIN
WHERE (EXPENSES GT 3000 OR EXPENSES IS MISSING)
END
Three solutions for the price of one
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004