Normal Topic @XResultSetPrintReport Problem (Read 1525 times)
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
@XResultSetPrintReport Problem
Feb 25th, 2011 at 4:11pm
Print Post Print Post  
Hello! I would start a Report with name EXPORT(exporting a ascii file) located in external application Aufnahme.DB . This Routine works well if the starting Database is in Sesame server loaded and the externe Database AUFNAHME.DB not.
So if both Databases are loaded in the server my report does not work.
What am I doing wrong here?

Thank you for the help

hier is my Code:

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\CHEMIEHeute.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

Subroutine Aedern()
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 ="F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"
var vStr as String
var vRun as Int
var vSpec as String
var vdatei as String


     vSpec   = "Importiere von AUFNAHME"

      vRun    = @LoadImportSpec(vSpec)
     If vRun = 1
     {
           If FileExists(vASC )
           {
                 RunImportSpec(vASC)
@Msg("Waiting")
     Loiter(1000)
@Msg("Done Waiting")
           }
           Else
           {
                 @Msg("Could not find the import file " + vASC)
           }
     }
     Else
     {
           @Msg("Could not find the Import spec named " + vSpec)
     }


End Subroutine


IF @Mode() = 0
{

vList1  = "DIVERSE;Abbrechen"

           PopupSelectPosition(3, @XPos(ThisElement) + (@Width(ThisElement) / 2) , @YPos(ThisElement) + @Height(ThisElement))

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


IF vDatei <> "Abbrechen" then
{
//vRSMax = @XResultSetSearch(@FN,"AUFTRAEGE", 0,2, "!LfdNr=Max 1")
vRSMax = @XResultSetSearch(@FN,@layout, 0,2, "!LfdNr=Max 1")

IF vRSMax > -1 then
{
vMax = @XResultSetValue(vRSMax, "LfdNr")
vMax = @str(@replace(vMax,",00000000",""))
writeln(vRSmax + @nl() + vMax)
}
XResultSetClose(vRSMax)
vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=>" + vMax ,  "!AuftraegeABuch=" + "DRO;STEIN" )
//vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=>" + vMax ,  "!Allergie=YES" )
     //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)
     
Aedern()

}
}

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

Throwfocus(Ruhe)
  

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 Problem
Reply #1 - Feb 25th, 2011 at 4:49pm
Print Post Print Post  
Hello Amor,

Try the following code and let me know what the writeln window says

Code
Select All
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\CHEMIEHeute.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

Subroutine Aedern()
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 ="F:\Sesame2\Data\EXPORT\AUFNAHMEHeute.TXT"  
var vStr as String
var vRun as Int
var vSpec as String
var vdatei as String


	vSpec   = "Importiere von AUFNAHME"
	vRun    = @LoadImportSpec(vSpec)
	If vRun = 1
	{
		If FileExists(vASC )
		{
                	RunImportSpec(vASC)
			@Msg("Waiting")
			Loiter(1000)
			@Msg("Done Waiting")
		}
		Else
		{
			@Msg("Could not find the import file " + vASC)
		}
	}
	Else
	{
		@Msg("Could not find the Import spec named " + vSpec)
	}

End Subroutine  


IF @Mode() = 0
{

	vList1  = "DIVERSE;Abbrechen"

	PopupSelectPosition(3, @XPos(ThisElement) + (@Width(ThisElement) / 2) , @YPos(ThisElement) + @Height(ThisElement))

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


	If vDatei <> "Abbrechen" Then
	{
		//vRSMax = @XResultSetSearch(@FN,"AUFTRAEGE", 0,2, "!LfdNr=Max 1")
		vRSMax = @XResultSetSearch(@FN, @Layout, 0,2, "!LfdNr=Max 1")
Writeln("vRSMax: " + @Str(vRSMax))
		If vRSMax > -1 Then  
		{
			vMax = @XResultSetValue(vRSMax, "LfdNr")
			vMax = @str(@replace(vMax,",00000000",""))
			writeln(vRSmax + @nl() + vMax)
		}
		XResultSetClose(vRSMax)

		vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=>" + vMax ,  "!AuftraegeABuch=" + "DRO;STEIN" )
		//vRSHandle = @XResultSetSearch("Data\MDLAUFNAHME.DB", "Aufnahme", 0,2, "!LfdNr=>" + vMax ,  "!Allergie=YES" )
Writeln("vRSHandle: " + @Str(vRSHandle))

		If(vRSHandle > -1) Then  
		{
			XResultSetSort(vRSHandle, "LfdNr:1")
			vRSRecordCount = @XResultSetTotal(vRSHandle)
Writeln("vRSRecordCount: " + @StR(vRSRecordCount))
			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)
			Aedern()
		}

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

Throwfocus(Ruhe) 



-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 Problem
Reply #2 - Feb 26th, 2011 at 12:01pm
Print Post Print Post  
Hello Ray-

With a no loaded external Database  Aufnahme.db  on server i get a Sesame Slate :
vRSMax: 0
vRSHandle: 0
vRSRecordCount: 6

with a loaded loaded Database  Aufnahme.DB i get:
vRSMax: 0
vRSHandle: -1


The Report EXPORT in the Aufnahme.DB

the Code in the Globalcode:

stat sFH as Int
stat sPath as String

sPath     =  "\\srv2003\Daten\Sesame2\Data\EXPORT\"

IF Not fileexists("C:\sesame2\ichbinhier.txt") then
{
sPath     =  "\\srv2003\Daten\Sesame2\Data\EXPORT\"
}
else
{
sPath      = "C:\Sesame2\Data\EXPORT\"
}

FileDelete(sPath + "AUFNAHMEHeute.TXT")
sFH = FileOpen(sPath +"AUFNAHMEHeute.TXT")


the Code in the unbound field : OutputRecords

FileWriteLn(sFH, @chr(34) +@Str(Eingang)+ @chr(34) +
"," + @chr(34) +  Erfasst              + @chr(34) +
"," + @chr(34) +  @Str(LabNr)            + @chr(34) +
"," + @chr(34) +  @Str(LfDNr)          + @chr(34) +
"," + @chr(34) +  Vorname              + @chr(34) +
"," + @chr(34) +  Nachname              + @chr(34) +
"," + @chr(34) +  Titel                + @chr(34) +
"," + @chr(34) +  Geb                  + @chr(34) +
"," + @chr(34) +  @Str(Age)                + @chr(34) +
"," + @chr(34) +  VARIA                  + @chr(34) +
"," + @chr(34) +  CHEMIE                  + @chr(34) +
"," + @chr(34) +  SEROLOGIE                  + @chr(34) +
"," + @chr(34) +  ABUCH                  + @chr(34) +
"," + @chr(34) +  ENTERITIS                  + @chr(34) +
"," + @chr(34) +  ALLERGIE                  + @chr(34) +
"," + @chr(34) +  ICD10                  + @chr(34)

 )

LE0:
FileClose(sFH)



                 
« Last Edit: Feb 28th, 2011 at 10:20am by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: @XResultSetPrintReport Problem
Reply #3 - Feb 28th, 2011 at 10:20am
Print Post Print Post  
Quote:
Hello Ray-

With a not loaded external Database  Aufnahme.db  on server i get a Sesame Slate :
vRSMax: 0
vRSHandle: 0
vRSRecordCount: 6

with a loaded Database  Aufnahme.DB i get:
vRSMax: 0
vRSHandle: -1


The Report named EXPORT in Database Aufnahme.DB

the Code in the Globalcode:

stat sFH as Int
stat sPath as String



IF Not fileexists("C:\sesame2\ichbinhier.txt") then
{
sPath     =  "\\srv2003\Daten\Sesame2\Data\EXPORT\"
}
else
{
sPath      = "C:\Sesame2\Data\EXPORT\"
}

FileDelete(sPath + "AUFNAHMEHeute.TXT")
sFH = FileOpen(sPath +"AUFNAHMEHeute.TXT")


the Code in the unbound field : OutputRecords

FileWriteLn(sFH, @chr(34) +@Str(Eingang)+ @chr(34) +
"," + @chr(34) +  Erfasst              + @chr(34) +
"," + @chr(34) +  @Str(LabNr)            + @chr(34) +
"," + @chr(34) +  @Str(LfDNr)          + @chr(34) +
"," + @chr(34) +  Vorname              + @chr(34) +
"," + @chr(34) +  Nachname              + @chr(34) +
"," + @chr(34) +  Titel                + @chr(34) +
"," + @chr(34) +  Geb                  + @chr(34) +
"," + @chr(34) +  @Str(Age)                + @chr(34) +
"," + @chr(34) +  VARIA                  + @chr(34) +
"," + @chr(34) +  CHEMIE                  + @chr(34) +
"," + @chr(34) +  SEROLOGIE                  + @chr(34) +
"," + @chr(34) +  ABUCH                  + @chr(34) +
"," + @chr(34) +  ENTERITIS                  + @chr(34) +
"," + @chr(34) +  ALLERGIE                  + @chr(34) +
"," + @chr(34) +  ICD10                  + @chr(34)

 )

LE0:
FileClose(sFH)



                 

  

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 Problem
Reply #4 - Feb 28th, 2011 at 4:07pm
Print Post Print Post  
Hello Amor,

Are both DB files loaded on the same Sesame Server? If one file was open in Sesame standalone this could happen.

What is the Start in folder for your Sesame Server?

When you open Aufnahme.db on a Sesame client what is the full path that is displayed at the top of the Sesame window right after the version number.

-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 Problem
Reply #5 - Feb 28th, 2011 at 5:33pm
Print Post Print Post  
Hello Ray,

Are both DB files loaded on the same Sesame Server?   YES

What is the Start in folder for your Sesame Server?  \\srv2003\Daten\Sesame2\DATA\MDLAUFNAHME.DB

   

Thanks.

Belhareth
  

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 Problem
Reply #6 - Feb 28th, 2011 at 5:41pm
Print Post Print Post  
Hello Amor,

Quote:
\\srv2003\Daten\Sesame2\DATA\MDLAUFNAHME.DB
Is that the full path that is displayed?

What is the Start in folder specified in the Sesame Server icon?

-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 Problem
Reply #7 - Feb 28th, 2011 at 7:39pm
Print Post Print Post  
Sorry Ray-

the Start in folder specified in the Sesame Server icon is:   "F:\Sesame2\Programm\Sesame.exe -server  srv2003:20000:20001"

Thank.
  

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 Problem
Reply #8 - Feb 28th, 2011 at 8:12pm
Print Post Print Post  
Hello Amor,

That should be the target of the icon. I am going to take a guess that the start in is actually "F:\Sesame2\"

If that is the case what is happening is the Programming is trying to open "F:\Sesame2\Data\MDLAUFNAHME.DB" but that file is locked. It is locked because the Sesame Server already has it open as "\\srv2003\Daten\Sesame2\DATA\MDLAUFNAHME.DB". With two completely different file paths Sesame has no way of knowing they are the exact same file.

To fix this and probably speed up the clients you should open the file as "F:\Sesame2\Data\MDLAUFNAHME.DB" not as "\\srv2003\Daten\Sesame2\DATA\MDLAUFNAHME.DB". Remove the "\\srv2003\Daten\Sesame2\DATA\MDLAUFNAHME.DB" listing from the recently used file list and any shortcuts that it may appear in. You only want to open the file as "F:\Sesame2\Data\MDLAUFNAHME.DB".

-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 Problem
Reply #9 - Mar 1st, 2011 at 8:11pm
Print Post Print Post  
Problem solved!

Ray i thank you so much.
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged