Normal Topic Generate a report from another form. (Read 1767 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Generate a report from another form.
Jan 13th, 2021 at 2:33pm
Print Post Print Post  
I have a report in one db (Inspect) that I would like to call and display from another db (CAPA). 

I would also like to limit the data in the report to match the part number being viewed in the second db (CAPA) and limit the time-frame of the report.

Is there a way to do this without having to open the second db (Inspect)?

Thanks for any help!

NHUser
  
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: Generate a report from another form.
Reply #1 - Jan 13th, 2021 at 4:44pm
Print Post Print Post  
Hey Paul,

You'll want to look at the @XResultSetSearch() and @XResultSetPrintReport() commands

-Ray
  

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



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Generate a report from another form.
Reply #2 - Jan 14th, 2021 at 6:40pm
Print Post Print Post  
Thanks, Ray.  I've got the info flowing using your suggestion. 

I have another question:

The data is not displayed cleanly.  it looks like this:

06/18/15 DEF1: Molding rejects Qty1: 45 DEF2: Poor Adhesion Qty2: 19 DEF3:  Qty3: 8
07/13/16 DEF1: Molding rejects Qty1: 1 DEF2: Peeling Qty2: 22 DEF3: Poor Adhesion Qty3: 3
07/13/16 DEF1: Molding rejects Qty1: 5 DEF2: Peeling Qty2: 52 DEF3: Poor Adhesion Qty3: 1
07/13/16 DEF1: Molding rejects Qty1: 102 DEF2:  Qty2: 0 DEF3:  Qty3: 0

I like to make the data look more like it's in a table, or columns.  How would i do that?

Thanks for your help!

Paul



  
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: Generate a report from another form.
Reply #3 - Jan 14th, 2021 at 8:08pm
Print Post Print Post  
Hi Paul,

What are you using as the output format? HTML preview should display exactly the same as if you ran that report from that database and picked HTML preview.

Or is the report set up as a free form report and it should be a columnar report?

-Ray
  

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



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Generate a report from another form.
Reply #4 - Jan 14th, 2021 at 8:30pm
Print Post Print Post  
Ray, I copied from the example in the programming guide, so I'm using writeln() for now.

How do I invoke the HTML preview option?

Thanks for your help!

Paul
  
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: Generate a report from another form.
Reply #5 - Jan 14th, 2021 at 8:36pm
Print Post Print Post  
Hey Paul,

In @XResultSetPrintReport() for Mode you'll want to specify REPORT_MODE_HTML_PREVIEW or 1 if you're not including sbasic_include.sbas.

-Ray
  

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



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Generate a report from another form.
Reply #6 - Jan 14th, 2021 at 9:01pm
Print Post Print Post  
Ray, I've never used this command before.  I keep getting an error message when I test my program.  Would you review the following and tell me what i'm doing wrong?

Thanks!

Paul


#include "Sbasic_Include.sbas"

var vRSHandle as int
var vNoOfRecords as int
var vloop as int
var vDate as date
var vDate1 as date
var vDCNo as string
var vDef1 as string
var vQty1 as int
var vDef2 as string
var vQty2 as int
var vDef3 as string
var vQty3 as int
var vDef4 as string
var vQty4 as int
var vDef5 as string
var vQty5 as int
var vDef6 as string
var vQty6 as int
var vPerc as double


vDCNo = DCNumber
vDate1 = @Date - 365

vRSHandle = @xResultSetSearch(@FN,"INSPECT",Search_Mode_And, Search_Syntax_QA,"!PartNo="+vDCNo,"!RecDate=">vDate)

If(vRSHandle>-1)
     {
           vNoOfRecords=@xResultSetTotal(vRSHandle)
           For vLoop=1 to vNoOfRecords

           If VDate>vDate1
           {
           XResultSetCurrentPosition(vRSHandle,vLoop)
           vDate=@AsFormattedByLE(Junk60,0,(@xResultSetValue(vRSHandle,"MoldDate")))
           vPerc=@xResultSetValue(vRSHandle,"Perc_Rejects")
           vDef1=@xResultSetValue(vRSHandle,"Major Defect")      
           vQty1=@xResultSetValue(vRSHandle,"Qty1")
           vDef2=@xResultSetValue(vRSHandle,"Defect#2")      
           vQty2=@xResultSetValue(vRSHandle,"Qty2")
           vDef3=@xResultSetValue(vRSHandle,"Defect#3")      
           vQty3=@xResultSetValue(vRSHandle,"Qty3")
           }

           Next
     }

@xResultSetPrintReport("Inspect!Daily Report By Molder",vrsHandle,Report_Mode_HTML_Preview)


XResultSetClose(vRSHandle)
}

  
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: Generate a report from another form.
Reply #7 - Jan 15th, 2021 at 3:50pm
Print Post Print Post  
Hi Paul,

@XResultSetPrintReport() returns a value so you have to store that return value. I simplified your code so I believe what you want is

Code
Select All
#include "Sbasic_Include.sbas"

var vRSHandle as int
var vDate as date
var vDate1 as date
var vDCNo as string
Var vReturn as String


vDCNo = DCNumber
vDate1 = @Date - 365

vRSHandle = @xResultSetSearch(@FN,"INSPECT",Search_Mode_And, Search_Syntax_QA,"!PartNo="+vDCNo, "!RecDate=>" + vDate, "!MoldDate=>" + vDate1)

If(vRSHandle>-1)
{
	vReturn = @xResultSetPrintReport("Inspect!Daily Report By Molder",vrsHandle,Report_Mode_HTML_Preview)
	XResultSetClose(vRSHandle)
} 



-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: Generate a report from another form.
Reply #8 - Jan 19th, 2021 at 11:16pm
Print Post Print Post  
I do reports in another form all the time ... here's a sample of my relevant code:

Code
Select All
vRS = @XResultSetSearch(@Fn, "Debtors!Payments", 0, 2, "!PmtDate=" + vAnswer, "!PmtColl=" + vUser, "!PmtCltNo=" + @replace(vStaffLimitClt,"^^",";"))

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

	// Close result set
	XResultSetClose(vRS)
}
 

  
Back to top
IP Logged