Normal Topic REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery) (Read 1067 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery)
May 8th, 2012 at 12:47am
Print Post Print Post  
Ray, my 'lockup' problem has continued (intermittent but persistent) - "for quite a while now, intermittently we would have a user working in PO's, and be unable to make changes to a PO because Sesame said it was 'locked',  but no one else would be in PO's at all.  The only way to unlock the PO was to go exit the Sesame client on a computer in the warehouse that we use to 'receive' incoming inventory.

I've been methodically sifting through the haystack in search of the needle, and tonight I finally got to it, I believe.  I think the culprit is the REPORT_MODE_PRINT_ONLY_PREVIEW command in the following code.  If I run this command in a print button, the record becomes locked to other Sesame clients.  If I instead use REPORT_MODE_HTML_PREVIEW, then no lockup occurs.

     vPONum = PONum

     vRS5 = @XResultSetSearch(@FN, "Purch!POLines", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!PONum=" + vPONum)
                                         
         If vRS5 > -1 
                             
            {
           //vTot = @XResultSetTotal(vRS5)
                                                      
           XResultSetSort(vRS5, "PODate:-1;PONum:-1")
                                         
           vRpt = @XResultSetPrintReport("Purch-PONum-Specific", vRS5, REPORT_MODE_HTML_PREVIEW) // REPORT_MODE_PRINT_ONLY_PREVIEW) //REPORT_MODE_HTML_PREVIEW)
          }
     XResultSetClose(vRS5)


**********
UPDATE:  apparently REPORT_MODE_PRINT_ONLY also locks the record, not just PREVIEW.

I changed the above code to the following, thinking I would view in a browser (instead of 'print preview'), and still give the option to print to a printer if desired.  But I'm back to being stymied for method to printer print without locking the record ...

     vRS5 = @XResultSetSearch(@FN, "Purch!POLines", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!PONum=" + vPONum)
                                         
         If vRS5 > -1 
                             
            {
           //vTot = @XResultSetTotal(vRS5)
                                                      
           XResultSetSort(vRS5, "PODate:-1;PONum:-1")

             vQuestion1 = @PromptForUserInput("To view this report onscreen, enter 'V' and click <OK>; To print to the printer, enter 'P' and click <OK>","")
           If vQuestion1 = "V"
                  {
                 vRpt = @XResultSetPrintReport("Purch-PONum-Specific", vRS5, REPORT_MODE_HTML_PREVIEW) // REPORT_MODE_PRINT_ONLY_PREVIEW) //REPORT_MODE_HTML_PREVIEW)
             }
              else if vQuestion1 = "P"
                   {
                     If @UserID = "wcdede"
                        {
                             AlternateDefaultPrinter("wcLaserDeDe")
                                   vRpt = @XResultSetPrintReport("Purch-PONum-Specific", vRS5, REPORT_MODE_PRINT_ONLY)
                             RestoreDefaultPrinter()
                        }
                          else if @UserID <> "wcdede"
                             {
                                   vRpt = @XResultSetPrintReport("Purch-PONum-Specific", vRS5, REPORT_MODE_PRINT_ONLY)
                             }
                 
                   }
                     else if (vQuestion1 <> "V") and (vQuestion1 <> "P")
                          {
                             Writeln("You entered a " + vQuestion1 + ", which is an invalid choice.")
                             vQuestion1 = ""
                          }
          }
     XResultSetClose(vRS5)


**********************
**********************
Update

tried printing from the report menu bar, instead of the command button.  Whenever I printed that report, the record was locked to other users.  However, if I selected/printed a different report with that same result set, then no lockup.  So that pointed the finger at that specific report, not the command.  So when I got to poking around the report, I found an 'on print' contingency that pulled a vendor address via XResultSetSearch, and I HAD OMITTED THE XRESULTSETCLOSE statement (idiot mio).  So Ray was correct 100% in his suspicion. 
However, adding in the CLOSE stmt and updating didn't eliminate the issue - the record still locks up now, so I don't have a solution yet
« Last Edit: May 8th, 2012 at 3:51pm by lksseven »  

Larry
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: REPORT_MODE_PRINT_ONLY_PREVIEW (resolved)
Reply #1 - May 8th, 2012 at 3:45pm
Print Post Print Post  
lksseven wrote on May 8th, 2012 at 12:47am:
RESOLVED!

tried printing from the report menu bar, instead of the command button.  Whenever I printed that report, the record was locked to other users.  However, if I selected/printed a different report with that same result set, then no lockup.  So that pointed the finger at that specific report, not the command.  So when I got to poking around the report, I found an 'on print' contingency that pulled a vendor address via XResultSetSearch, and I HAD OMITTED THE XRESULTSETCLOSE statement (idiot mio).  So Ray was correct 100% in his suspicion. 


I was just getting ready to tell you to look at the programming in the report itself but you went and figured that out. Good job!

-Ray
  

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



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery)
Reply #2 - May 8th, 2012 at 6:26pm
Print Post Print Post  
Ray, you were too quick for me - I edited my previous post from 'resolved' to 'update' because I was still getting a lockup problem (although the problem is definitely with the report).  Here is the programming in the report.  When I comment out the entire code here, then there is no lockup whatsoever.  All I can think of is something I'm doing wrong with XResultSetParent.

Question - does XResultSetParent need a closing stmt, too?

vPONum = PONum
vRS1 = @XResultSetSearch(@FN, "Purch!POLines", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!PONum=" + vPONum)

       If vRS1 > -1
       {
           vRSp = @XResultSetParent(vRS1)
             If vRSp > -1
             {
                 vCount = @XResultSetTotal(vRSp)
                   If vCount = 1
                 {
                       vVendorAddress = @XResultSetValue(vRSp, "VendorAddress1")
                       VendorAddress = vVendorAddress
                 }
           }
           
       }
XResultSetClose(vRS1)
  

Larry
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: REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery)
Reply #3 - May 8th, 2012 at 6:58pm
Print Post Print Post  
lksseven wrote on May 8th, 2012 at 6:26pm:
Question - does XResultSetParent need a closing stmt, too?


Answer - Yes!

Code
Select All
	vPONum = PONum
	vRS1 = @XResultSetSearch(@FN, "Purch!POLines", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!PONum=" + vPONum)
	If vRS1 > -1
	{
		vRSp = @XResultSetParent(vRS1)
		If vRSp > -1
		{
			vCount = @XResultSetTotal(vRSp)
			If vCount = 1
			{
				vVendorAddress = @XResultSetValue(vRSp, "VendorAddress1")
				VendorAddress = vVendorAddress
			}
			XResultSetClose(vRSp)
		}
		XResultSetClose(vRS1)
	} 



-Ray
  

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



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery)
Reply #4 - May 9th, 2012 at 1:05am
Print Post Print Post  
fantastic.  I'll do it and report back.  Thanks, Ray.
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: REPORT_MODE_PRINT_ONLY_PREVIEW (lockup mystery)
Reply #5 - May 9th, 2012 at 1:47am
Print Post Print Post  
That did the trick. 

I've been chasing that ghost for almost a year (casually for much of that time - just a mild irritant - but pretty intensely for the last month or two).   Ahhhh - a moment like this makes me want to start smoking!

Thanks, Ray!
  

Larry
Back to top
IP Logged