Normal Topic Retrieve Spec Question (Read 357 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Retrieve Spec Question
Nov 2nd, 2012 at 3:10pm
Print Post Print Post  
I have set up a report and created a retrieve spec called FABRIC ONLY.

The retrieve spec sets two elements, one selects only fabric records and the other selects SHIP_DATE for all records "less than" a certain date.

When I attach the retrieve spec to the report, it shows the two elements, with the SHIP_DATE as "<1/1/2013".  This locks the date attached to the report so when I change the retrieve spec in my active file to "<1/1/2014", the retrieve spec changes but my report is stuck with "<1/1/2013".

Is this a quirk of the retrieve spec, or is there a way to keep this as a variable so I don't have to update my report when I want to change the date?
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Retrieve Spec Question
Reply #1 - Nov 2nd, 2012 at 9:39pm
Print Post Print Post  
In most cases (there are exceptions), the "best practice" recommendation it not to attach retrieve specs to a report. (Sort specs, yes -- retrieve specs, no.) This way you can always use the same report with different records.

There are various ways to print a report using some search criteria that you have saved somewhere, other than being attached directly to the report itself. Here are some examples:

1. You can use a saved retrieve spec (which is easily modified and re-saved, if needed) to get the result set, then run the report after that result set is displayed.

2. You can use a command button, located on any form, that uses the XResultSet family of commands to run reports on any database -- even one in another Sesame application with a different file name, that's not even open. You have complete control via programming to have this command button read any stored search criteria from: a database, a GlobalValue, a ClientLocalValue, a popup calendar, user input, etc.

Here's a real world working example of option 2.
Code
Select All
var vAnswer as String
var vRS as Int
var vReportFileName as String

// Display Calendar
vAnswer = @Calendar(@Date, "Pick START DATE for Report - Esc to cancel")

If not @Error
{
	// Build date range specs to be used in XResultSetSearch below
	vAnswer = vAnswer + ".."

	// Get result set
	vRS = @XResultSetSearch(@Fn, "Invoice!Details", 0, 2, "!Date1=" + vAnswer)
	If vRS > -1
	{
		// Run report
		vReportFileName = @XResultSetPrintReport("Daily Revenue", vRS, 1)

		// Close result set
		XResultSetClose(vRS)
	}
} 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged