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.
Table has a numeric column called COLA that can range from any negative number to any positve number. On the HTML if the user leaves COLA blank then count the total number of records else if COLA is >= 0 then count just those records that meet this condition.
I have the second part working WHERE COLA GE &HTML_VAR
How do I incoporate the first condtion into this?This message has been edited. Last edited by: Kerry,
Is there a line size limitaion? Here is the actual line of code I use. It worked with just OFS but when I added DATE_STAMP I get an error
-SET &WHERESTRING = IF &OFS EQ 0 THEN 'WHERE DATE_STAMP EQ DT(&DATE_STAMP);' ELSE 'WHERE ( DAYSOFS GE &OFS ) AND ( DATE_STAMP EQ DT(&DATE_STAMP) );'
I get this error message 0 ERROR AT OR NEAR LINE 13 IN PROCEDURE fdp FOCEXEC * (FOC177) INVALID DATE CONSTANT: DATE_STAMP (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND
humor me and put a space after the &DATE_STAMP and before the first ). and split your code into 2 lines
-SET &WHERESTRING = IF &OFS EQ 0 THEN 'WHERE DATE_STAMP EQ DT(&DATE_STAMP ) ' ELSE -'WHERE ( DAYSOFS GE &OFS ) AND ( DATE_STAMP EQ DT(&DATE_STAMP ) ) '
and those ; at the end of a WHERE statement are just gui artefacts and make me (and other hand-coders) nuts. well, ok, more nuts.
You can also do WHERE statements like this -SET &cmt = IF &OFS EQ 0 THEN '-*' ELSE ''; and in your code TABLE FILE whatever .. WHERE ( DATE_STAMP EQ DT(&DATE_STAMP ) ) &cmt.EVAL AND (DAYSOFF GE &OFS )This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
I get this error message 0 ERROR AT OR NEAR LINE 13 IN PROCEDURE fdp FOCEXEC * (FOC177) INVALID DATE CONSTANT: DATE_STAMP (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND
Any thoughts?
The error message dropped a &, should say: (FOC177) INVALID DATE CONSTANT: &DATE_STAMP
It's elementary dialog manager: You need to add .eval to force evaluation of amper variables appearing within a quote in the RHS expression of a -SET. As it stands, the "&DATE_STAMP" within the quoted WHERE phrases is treated as a literal.
Run this to see the difference:
-SET &ECHO=ON;
-SET &DATE_STAMP='20091231 11:59PM';
-SET &OFS=7;
-SET &WHERESTRING =
- IF &OFS EQ 0
- THEN 'WHERE ( DATE_STAMP EQ DT(&DATE_STAMP) );'
- ELSE 'WHERE ( DAYSOFS GE &OFS ) AND ( DATE_STAMP EQ DT(&DATE_STAMP) );';
* &WHERESTRING
-SET &WHERESTRING =
- IF &OFS EQ 0
- THEN 'WHERE ( DATE_STAMP EQ DT(&DATE_STAMP.EVAL) );'
- ELSE 'WHERE ( DAYSOFS GE &OFS.EVAL ) AND ( DATE_STAMP EQ DT(&DATE_STAMP.EVAL) );';
* &WHERESTRING
The starred lines are echoed as:
* WHERE ( DAYSOFS GE &OFS ) AND ( DATE_STAMP EQ DT(&DATE_STAMP) ); < -- without .eval, no replacement * WHERE ( DAYSOFS GE 7 ) AND ( DATE_STAMP EQ DT(20091231 11:59PM) ); < -- with .eval
Additional Thoughts:
* This would have been easier to spot if you turn &ECHO on, and posted the echoed code in the vicinity of "LINE 13": the & in the middle of the echoed code is a dead giveaway.
* Part of the confusion is the similarity of DATE_STAMP and &DATE_STAMP. Now that you know WF is prone to such scribal errors in its messages, try to keep your amper variable names distinct from Focus (mfd, define) variable names.This message has been edited. Last edited by: j.gross,
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Thanks Jack. I have changed all my screen variables to have a v in front of them. The EVAL worked. One question about the screen varaibles. The results I get depend on the screen variable &vOFS. I should get different results depending on if &vOFS is a number (including 0) or it is not there at all. I looked at the HTML when nothing is sent a the value is " ". I test with IF &vOFS EQ ' '. It doesn'r work. Any ideas?
-IF &vOFS EQ ' ' - THEN 'WHERE ( DATE_STAMP EQ DT(&vDATE_STAMP.EVAL) );' - ELSE 'WHERE ( DAYSOFS GE &vOFS.EVAL ) AND ( DATE_STAMP EQ DT(&vDATE_STAMP.EVAL) );'
That also worked. Good Stuff. After running the report turns out my numbers were off. If DAYSOFS is set to zero then all values that are negative have to be counted. In oracle I use the greatest function. So that if the report wants DAYSOFS >= 0 then you take the greater value (neg number or 0) Of course it is 0. Is there a way to do that in Webfosus other than the road I will explain now? I used a SQL statement to access the data directly. The only problem I have is formating the sql statement with a dynamic where clause. How do I get the WHERESTRING into the SELECT statement?
SET &WHERESTRING = -IF ASIS(&vOFS) EQ '' - THEN 'WHERE DATE_STAMP = &vDATE_STAMP.QUOTEDSTRING ' - ELSE 'WHERE GREATEST(DAYsOFS,0) >= &vOFS.EVAL ) AND DATE_STAMP = &vDATE_STAMP.QUOTEDSTRING ';
SQL SQLORA SET SERVER servername SQL SQLORA SELECT state, SUM(addrcnt), SUM(validcnt), SUM(cnt), FROM table_name WHERE date_stamp = '2009-01-31' and greatest(daysofs,0) >= 0 GROUP BY ROLLUP(state) ORDER BY state NULLS FIRST;
Change the WHEREs to ANDs and include the Dialogue Manager variable in the SELECT statement:
-SET &WHERESTRING =
-IF ASIS(&vOFS) EQ ''
- THEN 'AND DATE_STAMP = &vDATE_STAMP.QUOTEDSTRING '
- ELSE 'AND GREATEST(DAYsOFS,0) >= &vOFS.EVAL ) AND DATE_STAMP = &vDATE_STAMP.QUOTEDSTRING ';
SQL SQLORA SET SERVER servername
SQL SQLORA
SELECT
state,
SUM(addrcnt),
SUM(validcnt),
SUM(cnt),
FROM
table_name
WHERE
date_stamp = '2009-01-31'
and greatest(daysofs,0) >= 0
&WHERESTRING
GROUP BY
ROLLUP(state)
ORDER BY
state NULLS FIRST;
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