Normal Topic Looking before  leap (or print) (Read 766 times)
Blair Wettlaufer
Junior Member
Members
**
Offline


No personal text

Posts: 98
Location: Hamilton, ON
Joined: Jun 4th, 2005
Looking before  leap (or print)
Nov 30th, 2006 at 7:46pm
Print Post Print Post  
Hi all,

I'm upgrading a print merge spec to WordMergeLite, and it's going much faster and more elegantly than my old WordMerge programming, but I've run into a snag.

I have a command button that executes the WordMerge Lite code that was included in the sample db from Inside Sesame 2006.  I've added a few custom variables, but that's it.

My problem is this -- I want to @promptforuserinput any required fields for the doc that are currently blank, but I'm not having a lot of luck inserting my code into the existing WML blocks.  Can anyone suggest an elegant way to screen my print job before kicking into the hefty WML code?

Here's my old screening code from Word Merge ...

Code
Select All
// Validate record for all proposal information

vOKtoSave = 1

If @UserID <> "manager"
{
	// Assemble a message containing all the errors
	// Clear the OK flag if any validation fails

	if CltBill = ""
	{
		vMsg = vMsg + @NewLine() + "Net/Gross Billing Required!"
		vOKToSave = 0
	}
	if CltComRate = 0
	{
		vMsg = vMsg + @NewLine() + "ComRate Required!"
		vOKToSave = 0
	}
	if CltCt1 = ""
	{
		vMsg = vMsg + @NewLine() + "Contact Name Required!"
		vOKToSave = 0
	}
	if CltSales = ""
	{
		vMsg = vMsg + @NewLine() + "Salesperson Required!"
		vOKToSave = 0
	}
}

// If any validation failed show failures

	If vOKTOSave = 0
	{
		@MsgBox(vMsg, "", "")
	}
 

  

Coesper erat: tunc lubriciles altravia circum&&Urgebant gyros gimbiculosque tophi:&&Moestenui visae borogovides ire meatu:&&Et profugi gemitus exgrabuere rathae
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Looking before  leap (or print)
Reply #1 - Nov 30th, 2006 at 8:21pm
Print Post Print Post  
If you are using the WML code I think you are, there is a piece meant to be put in the On Element Entry event of a button. That piece is a bunch of UDFs followed by a tag that says something like MAIN PROGRAM. Screen your job and set a success/fail flag. This code should appear after MAIN PROGRAM, but before everything else.  Wrap everything after MAIN PROGRAM and after your screen code in a check for the success flag. That way, if your screen fails, nothing else runs.
  

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


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Looking before  leap (or print)
Reply #2 - Nov 30th, 2006 at 8:34pm
Print Post Print Post  
I cannot test right now, but this may be typical of what you could do for each of the critical elements:

Code
Select All
While @IsBlank(CltBill)
CltBill = @PromptForUserInput("Net/Gross Billing Required!", )	 

     

And then there is Jabberwocky ..... Roll Eyes
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Looking before  leap (or print)
Reply #3 - Nov 30th, 2006 at 8:44pm
Print Post Print Post  
You probably don't want to use a While loop for this. Trapping users in endless loops they can't get out of often leads to things involving torches and pitchforks. An "If" should be sufficient.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged