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] Date in report header based off of SQL query

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date in report header based off of SQL query
 Login/Join
 
Member
posted
I am using a SQL query in my report with the where condition:

VARIABLE BETWEEN TRUNC(SYSDATE-3,'MON') AND LAST_DAY(SYSDATE-3)

How can I get the header of the report to show the max date of the query result?

Currently doing something like:

HEADING
"Original booking date month-to-date through &DATEDMtYY"


Version is 8008

Thank you Smiler

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 14 | Registered: June 04, 2019Report This Post
Silver Member
posted Hide Post
Not totally certain how to do this in one pass, but you could save your results in a hold file, then access that hold file to save your max value as a variable, then create your final report and place that variable in the header.

So a quasi example:

  

SQL
SELECT *
FROM GGORDER
WHERE ORDER_DATE BETWEEN '1996/01/01' AND '1996/02/01';
TABLE ON TABLE HOLD AS HOO1
END
-RUN

-SET &ORDER_DATE = ;

TABLE FILE HOO1
BY HIGHEST 1 ORDER_DATE
ON TABLE HOLD AS MAX_DATE
END
-RUN
-READFILE MAX_DATE
-RUN
-TYPE ORDERDATE = &ORDER_DATE

TABLE FILE HOO1
PRINT ORDER_DATE
STORE_CODE
ORDER_NUMBER
QUANTITY
ON TABLE SUBHEAD
"Original booking date month-to-date through &ORDER_DATE"
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET CACHELINES 100
ON TABLE SET STYLE *
ENDSTYLE
END

-RUN



Hope this helps.

This message has been edited. Last edited by: Mike Williams,


WF Version 8105
 
Posts: 45 | Registered: October 07, 2015Report This Post
Master
posted Hide Post
quote:
I am using a SQL query


What SQL engine are you using? Sql Server, Oracle, etc?


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Member
posted Hide Post
quote:

What SQL engine are you using? Sql Server, Oracle, etc?


Oracle
 
Posts: 14 | Registered: June 04, 2019Report This Post
Expert
posted Hide Post
Any reason that you've decided the following would not suffice?

ON TABLE SUBHEAD
"Original booking date month-to-date through <MAX.ORDER_DATE"


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, 2004Report This Post
Member
posted Hide Post
quote:
Originally posted by Tony A:
Any reason that you've decided the following would not suffice?

ON TABLE SUBHEAD
"Original booking date month-to-date through <MAX.ORDER_DATE"


T



I cannot select 'ORDER_DATE' in the query because then I would have to Group By it as well which would break the results. I could aggregate it in the SQL query to avoid grouping by it but I was unaware I could reference a SQL variable within the HEADING quotes with '<'. Looks like my silly brain was over complicating the issue Smiler


It works with the following:

SELECT
MAX(ORDER_DATE) AS MAXDATE

HEADING
"Original booking date month-to-date through
Thank you
 
Posts: 14 | Registered: June 04, 2019Report This Post
Member
posted Hide Post
quote:
Originally posted by Mike Williams:
Not totally certain how to do this in one pass, but you could save your results in a hold file, then access that hold file to save your max value as a variable, then create your final report and place that variable in the header.

So a quasi example:

  

SQL
SELECT *
FROM GGORDER
WHERE ORDER_DATE BETWEEN '1996/01/01' AND '1996/02/01';
TABLE ON TABLE HOLD AS HOO1
END
-RUN

-SET &ORDER_DATE = ;

TABLE FILE HOO1
BY HIGHEST 1 ORDER_DATE
ON TABLE HOLD AS MAX_DATE
END
-RUN
-READFILE MAX_DATE
-RUN
-TYPE ORDERDATE = &ORDER_DATE

TABLE FILE HOO1
PRINT ORDER_DATE
STORE_CODE
ORDER_NUMBER
QUANTITY
ON TABLE SUBHEAD
"Original booking date month-to-date through &ORDER_DATE"
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET CACHELINES 100
ON TABLE SET STYLE *
ENDSTYLE
END

-RUN



Hope this helps.


When I attempted this solution I was getting

(FOC295) A VALUE IS MISSING FOR: &MAXDATE

Not sure the issue, but thanks for the lead!
 
Posts: 14 | Registered: June 04, 2019Report This Post
Silver Member
posted Hide Post
Could you share your code?


WF Version 8105
 
Posts: 45 | Registered: October 07, 2015Report This Post
Silver Member
posted Hide Post
Oh, I thought you didn't have a resolution on the question.

You may want to edit your post and put a [SOLVED] in the subject.


WF Version 8105
 
Posts: 45 | Registered: October 07, 2015Report 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] Date in report header based off of SQL query

Copyright © 1996-2020 Information Builders