Normal Topic Running a Report from a different form (Read 1345 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Running a Report from a different form
Aug 16th, 2013 at 3:51am
Print Post Print Post  
Hi all,

I have a question -- I have a common report in my accounting database I would like to give access to, without letting staff have access to the form.

In general terms, I want a prompt box to gather field values to be used in the remote form, and then have it execute the report with those retrieve spec values.

Is there a way to do this?

Thanks!
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Running a Report from a different form
Reply #1 - Aug 16th, 2013 at 2:37pm
Print Post Print Post  
Hello Blair,

Yes, this is possible using @XResultSetSearch() and @XResultSetPrintReport().

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Running a Report from a different form
Reply #2 - Aug 24th, 2013 at 7:49pm
Print Post Print Post  
Hey Ray,

So I've built my first attempt at an external report, and it isn't grabbing my external report or producing an HTML output.  I'm thinking my issue is how I'm calling my external form and report.

Any suggestions?

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, "Pmt Admin Screen", 0, 2, "!PmtDate=" + vAnswer)

	If vRS > -1
	{
		// Run report
		vReportFileName = @XResultSetPrintReport("Revenue Report Branch", vRS, 1)

		// Close result set
		XResultSetClose(vRS)
	}
}
 

  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Running a Report from a different form
Reply #3 - Aug 26th, 2013 at 1:07pm
Print Post Print Post  
Hello Blair,

Well first step is to fill it up with debug so,

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 + ".."
Writeln("vAnswer is " + vAnswer)
	// Get result set

	vRS = @XResultSetSearch(@Fn, "Pmt Admin Screen", 0, 2, "!PmtDate=" + vAnswer)
Writeln("vRS is " + vRS)
	If vRS > -1
	{
Writeln("Total Number of Records is " + @XResultSetTotal(vRS))
		// Run report
		vReportFileName = @XResultSetPrintReport("Revenue Report Branch", vRS, 1)
Writeln("Report name of " + vReportFileName)
		// Close result set
		XResultSetClose(vRS)
	}
}
 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Running a Report from a different form
Reply #4 - Sep 8th, 2013 at 4:00am
Print Post Print Post  
Well, I got this ...

vAnswer is 2013/06/17..
vRS is -1

So clearly the vAnswer is fine, but it isn't liking my @XResultSetSearch

Any suggestions?
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Running a Report from a different form
Reply #5 - Sep 8th, 2013 at 4:24am
Print Post Print Post  
Double check all of the arguments, especially the database name "Pmt Admin Screen". It must be the database name, not the form name, if they are different. Double check that "PmtDate" is the field name, not the element name, and that it is a date field. Lastly, if the application has security, make sure that the user name and password for external access have been set correctly.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Running a Report from a different form
Reply #6 - Sep 24th, 2013 at 2:26pm
Print Post Print Post  
Found the problem! 

Because of all my funky use of subforms, my Payment database became nested in my Debtor database.  Once I tried "Debtors!Payments", the whole thing worked.

Thanks Mark!
  
Back to top
IP Logged