Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Date Criteria to MSSQL

Status
Not open for further replies.

JSHoltsIT

IS-IT--Management
Apr 12, 2007
66
US
I have a report that analyzes data based upon prompting for a date range. Within the report, I am looking at sales data from this range, the same range last year, and the YTD for the current range year and the prior range year.

My Select Expert Formula and Show SQL results are below. It doesn't seem like this is an efficient manner to pull data from SQL. How can I pass to SQL the @Prior FY Start Date value to limit the record dump from SQL to CR?

JS

SE Formula ----------------
{?SKU} = {AAcsbycpi.itemnmbr} and
{AAcsbycpi.glpostdt} >={@Prior FY Start Date}
SE Formula ----------------

Show SQL

SELECT
AAcsbycpi."custnmbr", [truncated by JS]
FROM
"table1"."dbo"."AAcsbycpi" AAcsbycpi
WHERE
AAcsbycpi."itemnmbr" = '0923884'
ORDER BY
AAcsbycpi."itemdesc" ASC,
AAcsbycpi."custnmbr" ASC,
AAcsbycpi."sopnumbe" ASC
 
What is the content of your formula {@Prior FY Start Date} and any nested formulas within it?

-LB
 
prior FY start date: DateAdd ('yyyy',-1 , {@Current FY Start})
Current FY Start: Date (Year({@End Prompt Date}) , 1 , 1 )
End Prompt Date: Maximum({?Date Range})
 
{?SKU} = {AAcsbycpi.itemnmbr} and
{AAcsbycpi.glpostdt} >= Date(Year(Maximum({?DateRange}))-1,1,1)

-LB

 
Nice. Now the Show SQL Query yields

WHERE
AAcsbycpi."itemnmbr" = 'CASSAV' AND
AAcsbycpi."glpostdt" >= ?

What does the "?" indicate?
 
I guess it refers to the date result based on the parameter value. Your report should run a little faster now.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top