Normal Topic Problem with @AskUser answer "no" (Read 973 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Problem with @AskUser answer "no"
Apr 5th, 2010 at 6:56pm
Print Post Print Post  
I use the following code on-element-change to Do Stuff when a user changes the code on a Workorder to flag it as a Quoted job:
Code
Select All
// Sets the Billing description for Quoted jobs
IF (JOB_TYPE_CODE = "Q")
    THEN
	{
	IF @AskUser("This code will delete ALL Billing details", "Are you sure you want to do this?", "")
	THEN
		{
		ClearAllForklifts()
		ClearAllVehicles()
		ClearAllLabor()
		ClearInvoice()
		BILLING_ADDITIONAL_CHARGES_DESCRIPTION = "Total Charge for the above service, as agreed"
		}
	} 


This works fine so far, Doing Stuff when the answer is Yes and Not Doing Stuff when the answer is No.  However, when the answer is No the coding box still retains the Q that whose Stuff was denied, which will probably cause problems later.

I would like the coding box to retain its original code (of non-Q) if the answer is no.  That data may be any number of other letters, or even no value at all.  What is the best way to accomplish this?
  

**
Captain Infinity
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Problem with @AskUser answer "no"
Reply #1 - Apr 5th, 2010 at 8:07pm
Print Post Print Post  
Try the following programming...

Global Code
Code
Select All
Stat sJobTypeCode as String
 



JOB_TYPE_CODE :: On Element Entry
Code
Select All
sJobTypeCode = JOB_TYPE_CODE
 



JOB_TYPE_CODE :: On Element Exit
Code
Select All
// Sets the Billing description for Quoted jobs
IF (JOB_TYPE_CODE = "Q")
    THEN
	{
	IF @AskUser("This code will delete ALL Billing details", "Are you sure you want to do this?", "")
	THEN
		{
		ClearAllForklifts()
		ClearAllVehicles()
		ClearAllLabor()
		ClearInvoice()
		BILLING_ADDITIONAL_CHARGES_DESCRIPTION = "Total Charge for the above service, as agreed"
		}
		Else
		{
			JOB_TYPE_CODE = sJobTypeCode
		}
	}
 

  
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: Problem with @AskUser answer "no"
Reply #2 - Apr 5th, 2010 at 8:32pm
Print Post Print Post  
That's super!   Cheesy   I had a feeling it would require a global static, but I'm on shaky ground when it comes to using those.  Thanks Ben!
  

**
Captain Infinity
Back to top
IP Logged