Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) [Solved] User is printing faster than Sesame (Read 2622 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
[Solved] User is printing faster than Sesame
Oct 9th, 2007 at 11:11am
Print Post Print Post  
Solution: Have print button offer to print all the records. See code later in thread.

I don't know how to title this question, so if a forum Moderator can think of a better title, please change it.

Here's what's happening:

On my Invoice form I have a button which sends data to a pre-printed form, via a whole bunch of Printstring commands.  It works fine when I use it (except for frequently mangled printouts, which is a different issue....Ray and Ben, did my email of Oct. 1 reach you?)  My Accounts Receivable user is a different story.

She will stack invoice numbers in a retrieve spec, such as "23456;23457;23458" and so on.  Once the stack has been retrieved she will hit the Print button, then use the "advance to next record" arrow in the bar on the menu bar, hit the button, hit the arrow, button, arrow, and so on.  And then she comes to me to complain that some of the invoices have printed twice, and some not at all.

I was able to duplicate this result this morning, and I think it has to do with advancing the record before the full print routine code has shot the result to the printer.  That is, she's advancing to the next record too quickly.  I mentioned this as a possibility last Friday and she whined "but I shouldn't have to wait".

Sigh.

Is there a way to force the program to wait?  I mean, can I program it so that advancing to the next record is impossible until the full output has been sent to the printer?  Or maybe some kind of progress bar?  It wouldn't have to be very long, just a matter of five seconds or so.
« Last Edit: Oct 9th, 2007 at 4:15pm by Hammer »  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: User is printing faster than Sesame
Reply #1 - Oct 9th, 2007 at 12:29pm
Print Post Print Post  
Why don't you have your program offer to print her whole batch so she doesn't have to do this at all?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: User is printing faster than Sesame
Reply #2 - Oct 9th, 2007 at 1:17pm
Print Post Print Post  
Quote:
Why don't you have your program offer to print her whole batch so she doesn't have to do this at all?

I don't know how to do that, sorry.
  

**
Captain Infinity
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: User is printing faster than Sesame
Reply #3 - Oct 9th, 2007 at 2:10pm
Print Post Print Post  
Hello Scott,

Yes we did recieve your e-mail, and I just got a line on a dot matrix printer that I'm going to go borrow tonight and have Ben set up tomorrow morning.

Sesame naturally waits for Sbasic to finish before it does anything else. I just tested it here with over 400,000 Printstring lines(I'm still waiting for the document to actually print, It was sent to the printer over 15 minutes ago. It's only 42 Megs) and I could not get Sesame to advance to the next record no matter what I clicked or what keys I hit, until the code had finished running. I'll try later with your app but my gut says that your Accounts Receivable user is mis-clicking. Do any of the printed invoices have mixed data on them, i.e. Top half from one record and bottom half from another?

-Ray
  

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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: User is printing faster than Sesame
Reply #4 - Oct 9th, 2007 at 2:42pm
Print Post Print Post  
Quote:
I could not get Sesame to advance to the next record no matter what I clicked or what keys I hit, until the code had finished running. I'll try later with your app but my gut says that your Accounts Receivable user is mis-clicking.

Well, it happened for her again just a few minutes ago.  She stacked 2 Invoices.  Then she hit print, advance, print.  Two copies of the second Invoice printed.  The first did not print.
Quote:
Do any of the printed invoices have mixed data on them, i.e. Top half from one record and bottom half from another?

In the run that happened a few minutes ago, both are exact dupes and match what is saved in the database, no mixing with the one that didn't print.

I've told her to slow down, to wait for the printer to start printing before advancing.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: User is printing faster than Sesame
Reply #5 - Oct 9th, 2007 at 2:46pm
Print Post Print Post  
Quote:
Yes we did recieve your e-mail, and I just got a line on a dot matrix printer that I'm going to go borrow tonight and have Ben set up tomorrow morning.

Maybe I should ship my printer to you.    Undecided
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: User is printing faster than Sesame
Reply #6 - Oct 9th, 2007 at 2:59pm
Print Post Print Post  
Infinity wrote on Oct 9th, 2007 at 1:17pm:
Quote:
Why don't you have your program offer to print her whole batch so she doesn't have to do this at all?

I don't know how to do that, sorry.

Would you like to know?  Smiley
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: User is printing faster than Sesame
Reply #7 - Oct 9th, 2007 at 3:07pm
Print Post Print Post  
Quote:
Would you like to know?

You bet!
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: User is printing faster than Sesame
Reply #8 - Oct 9th, 2007 at 3:32pm
Print Post Print Post  
Infinity wrote on Oct 9th, 2007 at 3:07pm:
Quote:
Would you like to know?

You bet!


Code
Select All
var vChoice as String
var vPos as Int
var vLoop as Int
var vCount as Int

SUBROUTINE PrintStuff()

	NewPage(850, 1100)
	PrintString("A Value to Print", 100, 200, 0, "BArial", 33, 0)
	FinishPage()

END SUBROUTINE


	vChoice = @PopupChoiceList("This Record;All Retreived Records", "SELECT RECORDS TO PRINT")
	If vChoice = "This Record"
	{
		PrintStuff()
	}
	Else If vChoice = "All Retreived Records"
	{
		vPos = @ResultSetCurrentPosition()	// Remember the starting point
		vCount = @ResultSetTotal()		// Get how many records we have
		For vLoop = 1 To vCount			// Print each record
			ResultSetCurrentPosition(vLoop)
			PrintStuff()
		Next
		ResultSetCurrentPosition(vPos)		// Return to starting point
	}


 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: User is printing faster than Sesame
Reply #9 - Oct 9th, 2007 at 4:12pm
Print Post Print Post  
Thanks Erika!  I modified it a bit with an @AskUser(), just in case some accidentally retrieved all 32,648 Invoices:
Code
Select All
var vChoice as String
var vResultSetPosition as Int   // changed from vPos because my print routine uses that elsewhere
var vLoop as Int
var vCount as Int
Var vTotalString as String

//  Allows user to print the record showing or all retrieved records

vChoice = @PopupChoiceList("This Record;All Retrieved Records", "SELECT RECORDS TO PRINT")
If vChoice = "This Record"
	{
	PrintStuff()
	}
Else If vChoice = "All Retrieved Records"
{

// Ask the user if the current result set is what he wants

vTotalString = @STR(@ResultSetTotal()) + " Miara Invoices."

IF @AskUser("This will print", vTotalString, "Are you sure you want to do this?")
THEN
	{
	vResultSetPosition = @ResultSetCurrentPosition()	// Remember the starting point
	vCount = @ResultSetTotal()		// Get how many records we have
	For vLoop = 1 To vCount			// Print each record
		ResultSetCurrentPosition(vLoop)
		PrintStuff()
	Next
	ResultSetCurrentPosition(vResultSetPosition)		// Return to starting point
	}
} 



Thanks again for your help, I think this will solve the mystery of the duplicate printouts!
  

**
Captain Infinity
Back to top
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: User is printing faster than Sesame
Reply #10 - Oct 9th, 2007 at 5:57pm
Print Post Print Post  
Infinity wrote on Oct 9th, 2007 at 4:12pm:
 I modified it a bit with an @AskUser(), just in case some accidentally retrieved all 32,648 Invoices:

I'd go one further. I would prevent them printing more than a reasonable number of invoices, say 50 or 100. If you don't, then inevitably someone will ignore the warning and tie up Sesame for everyone for [a period of time], and cause all sorts of problems. I'd have 3 tiers (my figures just as examples) ..

1-10 records - no warning, just print them
11-50 records - Are you sure?
51+ - no can do.

If they really need to print more than the maximum, they can do so in batches.
  

Alec
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: [Solved] User is printing faster than Sesame
Reply #11 - Oct 9th, 2007 at 6:24pm
Print Post Print Post  
Another great idea from Alec, who has the uncanny ability to see into the future and must, somehow, have had experience with the users at J.A. Miara Transportation, Inc.

Thanks!
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: User is printing faster than Sesame
Reply #12 - Oct 10th, 2007 at 12:48am
Print Post Print Post  
Alec wrote on Oct 9th, 2007 at 5:57pm:
1-10 records - no warning, just print them
11-50 records - Are you sure?
51+ - no can do.

Alec,

What a terrific twist.

I really like your idea not to bother the user for small batches, and to all-out restrict an almost obvious mistake of printing a very large batch.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: [Solved] User is printing faster than Sesame
Reply #13 - Oct 10th, 2007 at 10:51am
Print Post Print Post  
Here's the code I came up with.  It looks clunky but it works.  I set my breaks at:
10 or less, no questions
11 to 20, ask
> 20, no can do.
Code
Select All
var vChoice as String
var vResultSetPosition as Int
var vLoop as Int
var vCount as Int

SUBROUTINE PrintStuff()
NewPage(850, 1100)
[My Invoice print routine]
FinishPage()
END SUBROUTINE


SUBROUTINE PrintResultSet()
var vResultSetPosition as Int
var vLoop as Int
var vCount as Int
vResultSetPosition = @ResultSetCurrentPosition()	// Remember the starting point
vCount = @ResultSetTotal()		// Get how many records we have
For vLoop = 1 To vCount			// Print each record
	ResultSetCurrentPosition(vLoop)
	PrintStuff()
Next
ResultSetCurrentPosition(vResultSetPosition)		// Return to starting point
END SUBROUTINE



//  Allows user to print the record showing or all retrieved records if less than 21 retrieved.

vChoice = @PopupChoiceList("This Record;All Retrieved Records", "SELECT RECORDS TO PRINT")
IF vChoice = "This Record"
	{
	PrintStuff()
	}
ELSE IF vChoice = "All Retrieved Records"
IF NOT @ResultSetTotal() > 20
THEN
	IF @ResultSetTotal() < 11
	THEN PrintResultSet()
	ELSE
	{
	vTotalString = @STR(@ResultSetTotal()) + " Miara Invoices."
	IF @AskUser("This will print", vTotalString, "Are you sure you want to do this?")  // Ask the user if the current result set is what he wants
	THEN PrintResultSet()
	} 



I got an error message about the PrintResultSet() subroutine's variables until I moved them into the actual subroutine: "Loop invariants (FOR-NEXT-counter) must be simple local variables".  I'm curious about that, don't know exactly what it means but moving them worked.

Thanks again for everyone's help; this is a wonderful solution to my original problem and goes far beyond what I originally had in mind.  And it's sure to make my A/R user very happy.  Smiley
  

**
Captain Infinity
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: [Solved] User is printing faster than Sesame
Reply #14 - Oct 10th, 2007 at 1:14pm
Print Post Print Post  
Hello Scott,

Since you moved the declarations for vLoop and vCount into the Subroutine, you will probably want to remove the originals so that you don't confuse yourself.

Also you may want to include a message that tells your users that they can not print more than 20 invoices at a time incase they try to print 21. This way you save yourself the "IT'S NOT WORKING" message from your users.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print