Normal Topic @XResultSetPrintReport on server (Read 1073 times)
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
@XResultSetPrintReport on server
Jan 4th, 2012 at 2:44pm
Print Post Print Post  
wen the Form B has been opened by an interactive client (a user)  Starting externally the Report  from one Form A and using @XResultSetPrintReport() the report does not start!

It starts only wen the the Form A is unloaded.

is that correct?

 
« Last Edit: Jan 4th, 2012 at 5:01pm by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @XResultSetPrintReport on server
Reply #1 - Jan 9th, 2012 at 9:40pm
Print Post Print Post  
Hello Amor,

I run XResultSetPrintReports() quite often with the form of another database open. Can you post the code you are using as maybe I can spot the error in there?

-Ray
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: @XResultSetPrintReport on server
Reply #2 - Jan 9th, 2012 at 10:10pm
Print Post Print Post  
Hello Ray!

Hier ist my Code:


Subroutine Aendere()
var n as Int
var vLfdNr as Int
var vsucheab as String
var VCL as String
var vFile as String 
var vFH as Int
var vASC as String
var vStr as String
var vRun as Int
var vSpec as String
var vdatei as String

IF Not fileexists("C:\sesame2\ichbinhier.txt") then
{
vASC      = "F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
}
else
{
vASC       =  "C:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
}

     vSpec   = "Importiere von AUFNAHME"

       vRun    = @LoadImportSpec(vSpec)
     If vRun = 1
     {
           If FileExists(vASC )
           {
                 RunImportSpec(vASC)

     Loiter(200)

           }
           Else
           {
                 @Msg("Could not find the import file " + vASC)
           }
     }
     Else
     {
           @Msg("Could not find the Import spec named " + vSpec)
     }

End Subroutine


Subroutine ImportierenReste(LfdNrs as String)
var vRSHandle as Int
var vFilename as String
var vFormName as String
var success as int
var vRSRecordCount as Int
var vLabor as String
var vExportFile as String ="F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
var vLoop as Int
var vSpec as String
var vList1 as String
var vDatei as String
var vGeraet1 as String
var vGeraet2 as String
var vRSMax as Int
var vMax as Int

IF @Mode() = 0 or @Mode() = 2
{
// From sbasic_include.sbas: //SEARCH_MODE_AND = 0 // SEARCH_SYNTAX_QA = 2
vList1  = "CHEMIE;*Abbrechen"
PopupSelectPosition(3, @XPos(ThisElement) + (@Width(ThisElement) / 2) , @YPos(ThisElement) + @Height(ThisElement))

           vDatei = @PopupChoiceList("@b@S13" + @Replace(vList1, ";", ";@b@S13"), " Welche Datei möchten Sie importieren?")
           vdatei = @Replace(vdatei, "@b@S13", "")


IF vDatei <> "*Abbrechen" then
{

vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=" + LfdNrs ,  "!AuftraegeChemie=/=" )
     //writeln(vRSHandle )
IF(vRSHandle > -1) Then
{
     XResultSetSort(vRSHandle, "LfdNr:1")
     vRSRecordCount = @XResultSetTotal(vRSHandle)
    IF @ASKUSER("SIND SIE SICHER DASS SIE  ",  vRSRecordCount + " DATENSÄTZE EXPORTIEREN","UND HIER IMPORTIEREN MÖCHTEN?") = "YES"
      THEN {
vFileName = @XResultSetPrintReport("EXPORT",vRSHandle, 4)

XResultSetClose(vRSHandle)
Aendere()
}
}

}
else
@MSGBOX(" Leider KEINE Datensätze für den export ","zu " +  vExportFile," gefunden Für Hilfe fragen Sie einfach Herrn Dr. Belhareth")       
}


Throwfocus(Ruhe)


End Subroutine
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @XResultSetPrintReport on server
Reply #3 - Jan 11th, 2012 at 3:11pm
Print Post Print Post  
Hello Amor,

Try the following and let me know the output of the Writeln() window. I rearranged the code slightly as under certain circumstances the XResultSet() was not being closed after being opened. It is important that every place a XResultSet() is opened that it is closed.

Code
Select All
Subroutine Aendere()
var n as Int
var vLfdNr as Int
var vsucheab as String
var VCL as String
var vFile as String
var vFH as Int
var vASC as String
var vStr as String
var vRun as Int
var vSpec as String
var vdatei as String

IF Not fileexists("C:\sesame2\ichbinhier.txt") then
{
vASC      = "F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
}
else
{
vASC       =  "C:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
}

     vSpec   = "Importiere von AUFNAHME"

       vRun    = @LoadImportSpec(vSpec)
     If vRun = 1
     {
           If FileExists(vASC )
           {
                 RunImportSpec(vASC)

     Loiter(200)

           }
           Else
           {
                 @Msg("Could not find the import file " + vASC)
           }
     }
     Else
     {
           @Msg("Could not find the Import spec named " + vSpec)
     }

End Subroutine


Subroutine ImportierenReste(LfdNrs as String)
var vRSHandle as Int
var vFilename as String
var vFormName as String
var success as int
var vRSRecordCount as Int
var vLabor as String
var vExportFile as String ="F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
var vLoop as Int
var vSpec as String
var vList1 as String
var vDatei as String
var vGeraet1 as String
var vGeraet2 as String
var vRSMax as Int
var vMax as Int

IF @Mode() = 0 or @Mode() = 2
{
	IF vDatei <> "*Abbrechen" then
	{
		vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=" + LfdNrs ,  "!AuftraegeChemie=/=" )
		writeln("Handle: " + vRSHandle)
		IF(vRSHandle > -1) Then
		{
			XResultSetSort(vRSHandle, "LfdNr:1")
			vRSRecordCount = @XResultSetTotal(vRSHandle)
			IF @ASKUSER("SIND SIE SICHER DASS SIE  ",  vRSRecordCount + " DATENSÄTZE EXPORTIEREN","UND HIER IMPORTIEREN MÖCHTEN?") = "YES" THEN
			{
				vFileName = @XResultSetPrintReport("EXPORT",vRSHandle, 4)
				Writeln("FileName: " + vFileName)
				Aendere()
			}
			XResultSetClose(vRSHandle)
		}
	}
	Else
	{
		@MSGBOX(" Leider KEINE Datensätze für den export ","zu " +  vExportFile," gefunden Für Hilfe fragen Sie einfach Herrn Dr. Belhareth")
	}
}
Throwfocus(Ruhe)

End Subroutine  

  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: @XResultSetPrintReport on server
Reply #4 - Jan 11th, 2012 at 3:53pm
Print Post Print Post  
Hello Ray!

The output writeln is : 

165788
Handle: 0
FileName: C:\SESAME2\REPORTS\EXPORT_2012_01_11_17_00_35.htm
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @XResultSetPrintReport on server
Reply #5 - Jan 11th, 2012 at 5:10pm
Print Post Print Post  
Okay it's looking like the report ran correctly. You should have a report in the C:\SESAME2\REPORTS folder named EXPORT_2012_01_11_17_00_35.htm.

Do you have that report in there?

-Ray
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: @XResultSetPrintReport on server
Reply #6 - Jan 11th, 2012 at 8:04pm
Print Post Print Post  
Yes, i have it.
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @XResultSetPrintReport on server
Reply #7 - Jan 11th, 2012 at 9:55pm
Print Post Print Post  
Hello Amor,

Can you elaborate some more on the problem that you are having so that I can set up a test case and see what is happening?

-Ray
  

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