Normal Topic [Solved] Form control (Read 950 times)
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
[Solved] Form control
Oct 25th, 2007 at 4:58pm
Print Post Print Post  
Someone smart once told me...
"Control the data not the data entry person!"


I'm looking to stop a form from being closed or exited without curtain elements being completed when other elements are. I have this code on "form exit"  and want it to stop the exit from happening.

// If the form is complete and has not been posted it tells the data entry person to Post it.
If (Dispatch0 = "Complete") and
(Not @IsBlank(brp_1)) and (@IsBlank(P10))
     {
           @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
     }

« Last Edit: Oct 29th, 2007 at 3:36pm by Hammer »  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Form control
Reply #1 - Oct 26th, 2007 at 3:06pm
Print Post Print Post  
Hi Flip,
Rather than forcing the user to remain on the form until it is posted, have you considered using the NotifyForm commands to prohibit saving, advancing or retreating from the record until it is complete?

Global Code - Subroutine:
Code
Select All
Subroutine CheckPosted() // If the form is complete but has not been posted it tells the data entry person to Post it.
If Dispatch0 = "Complete" and @IsBlank(brp_1) = False Then
{
	 If @IsBlank(p10) Then
	 {
	     NotifyForm(1)
	     @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")

	 }
	 Else
	 {
	     NotifyForm(0)
	     @Msgbox("","THIS FORM HAS BEEN SAVED.","")
	 }
}
End Subroutine
 



On Form Exit
Code
Select All
CheckPosted() 

  
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Form control
Reply #2 - Oct 26th, 2007 at 3:29pm
Print Post Print Post  
Hello Ben,
Yes, the work around I am using is through the navigation button codes I have on the form. It looks like this.... But I think Im going to try yours.

Var vNav as Int

If @mode()=1 and @ResultSetCurrentPosition() <> @ResultSetTotal()
     {
           // If the form is complete and has not been posted it tells the data entry person to Post it.
           If (Call_Date > (@Date - 45)) and (Dispatch0 = "Complete")  //Doesn't enforce old or out of date completed dispatches
           and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
           or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
           or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
                 {
                       @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
                       stop
                 }

           vNav = @SelectTreeItem("Search Update Menu!Navigation!Save Record")
           vNav = @SelectTreeItem("Search Update Menu!Navigation!Advance Record (F10)")
     }


This works most of the time but seems to have a random hang up with a (Dispatch0 = "Open") form every once and a while and it shouldn't.
I was hoping for an easy fix with a @DisciplineTheDataEntryPerson function as opposed to the @FigureItOut function.

  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Form control
Reply #3 - Oct 26th, 2007 at 5:07pm
Print Post Print Post  
FlipGilbert wrote on Oct 26th, 2007 at 3:29pm:
If @mode()=1 and @ResultSetCurrentPosition() <> @ResultSetTotal()
     {
           // If the form is complete and has not been posted it tells the data entry person to Post it.
           If (Call_Date > (@Date - 45)) and (Dispatch0 = "Complete")  //Doesn't enforce old or out of date completed dispatches
           and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
           or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
           or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
                 {
                       @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
                       stop
                 }

           vNav = @SelectTreeItem("Search Update Menu!Navigation!Save Record")
           vNav = @SelectTreeItem("Search Update Menu!Navigation!Advance Record (F10)")
     }


Flip,
Your going to want to stop using Stop in your programming, it is not a good programming practice.
  
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Form control
Reply #4 - Oct 26th, 2007 at 5:31pm
Print Post Print Post  
removed it first thing this morning, I'm going with your subroutine Idea to eliminate the random acts of violence.

This is what I'm going with until I can figure out how to do the same thing on a subroutine.

// If the form is complete and has not been posted it tells the data entry person to Post it.
If (Call_Date > (@Date - 90)) and (Dispatch0 = "Complete") 
and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
     {
           @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
     }
Else
     {
           On_Form_Exit()
     }

How would I get it to do " this" on one element, and "that" on a different element on a subroutine?

If @mode()=1 and @ResultSetCurrentPosition() <> @ResultSetTotal()
     {
           // If the form is complete and has not been posted it tells the data entry person to Post it.
           If (Call_Date > (@Date - 90)) and (Dispatch0 = "Complete") 
           and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
           or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
           or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
                 {
                       @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
                 }
     Else
           {
                 vNav = @SelectTreeItem("Search Update Menu!Navigation!Save Record")
                 vNav = @SelectTreeItem("Search Update Menu!Navigation!Advance Record (F10)")
           }
           
     }


Thank you for your help
« Last Edit: Oct 26th, 2007 at 7:02pm by FlipGilbert »  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Form control
Reply #5 - Oct 26th, 2007 at 7:17pm
Print Post Print Post  
Once again I think I'm going about this the wrong way. It should be a @AskUser and then perform the function for the data entry person....

[quote]/* Move to the Next record in the set, If there is one. If Updating, this will save
the current record and move on.  If Adding records, this will save the current
record and move to a new form. select the Menu Tree Item based on where you currently
are in the application */

Var vNav as Int

If @mode()=1 and @ResultSetCurrentPosition() <> @ResultSetTotal()
     {
           // If the form is complete and has not been posted it tells the data entry person to Post it.
           If (Call_Date > (@Date - 90)) and (Dispatch0 = "Complete") 
           and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
           or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
           or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
           or (Not @IsBlank(brp_4)) and (@IsBlank(P40))
           or (Not @IsBlank(brp_5)) and (@IsBlank(P50))
           or (Not @IsBlank(brp_5)) and (@IsBlank(P50))
           or (Not @IsBlank(brp_6)) and (@IsBlank(P60))
           or (Not @IsBlank(brp_7)) and (@IsBlank(P70))
           or (Not @IsBlank(brp_8)) and (@IsBlank(P80))
           or (Not @IsBlank(brp_9)) and (@IsBlank(P90))
           or (Not @IsBlank(brp_10)) and (@IsBlank(P100))
           or (Not @IsBlank(brp_11)) and (@IsBlank(P11))
           or (Not @IsBlank(brp_12)) and (@IsBlank(P12))
           or (Not @IsBlank(brp_13)) and (@IsBlank(P13))
           or (Not @IsBlank(brp_14)) and (@IsBlank(P14))
                 {
                       If Not @AskUser("You Must Post This Form If It Is Complete.","Would You Like To Proceed Without Posting It?) Then
                             {
                                   InvPost()
                             }
                 }
     Else
           {
                 [highlight]vNav = @SelectTreeItem("Search Update Menu!Navigation!Save Record")[/highlight] //this gives error
                 vNav = @SelectTreeItem("Search Update Menu!Navigation!Advance Record (F10)")
           }
           
     }
Else If @Mode()=1 and @ResultSetCurrentPosition() = @ResultSetTotal()
     {
           ThrowFocus(Company_Name)
           @Msg("There are No More Records In This Set")
     }
Else If @mode()=0 
     {
           // If the form is complete and has not been posted it tells the data entry person to Post it.
           If (Call_Date > (@Date - 90)) and (Dispatch0 = "Complete") 
           and (Not @IsBlank(brp_1)) and (@IsBlank(P10))
           or (Not @IsBlank(brp_2)) and (@IsBlank(P20)) 
           or (Not @IsBlank(brp_3)) and (@IsBlank(P30))
           or (Not @IsBlank(brp_4)) and (@IsBlank(P40))
           or (Not @IsBlank(brp_5)) and (@IsBlank(P50))
           or (Not @IsBlank(brp_5)) and (@IsBlank(P50))
           or (Not @IsBlank(brp_6)) and (@IsBlank(P60))
           or (Not @IsBlank(brp_7)) and (@IsBlank(P70))
           or (Not @IsBlank(brp_8)) and (@IsBlank(P80))
           or (Not @IsBlank(brp_9)) and (@IsBlank(P90))
           or (Not @IsBlank(brp_10)) and (@IsBlank(P100))
           or (Not @IsBlank(brp_11)) and (@IsBlank(P11))
           or (Not @IsBlank(brp_12)) and (@IsBlank(P12))
           or (Not @IsBlank(brp_13)) and (@IsBlank(P13))
           or (Not @IsBlank(brp_14)) and (@IsBlank(P14))
                 {
                       @Msgbox("","THIS FORM NEEDS TO BE POSTED IN ORDER TO BE COMPLETED, EITHER LEAVE IT OPEN OR POST THIS FORM TO ADJUST THE INVENTORY","")
                 }
     Else
           {
                 vNav = @SelectTreeItem("Add Data Menu!Navigation!Save Record")
                   vNav = @SelectTreeItem("Add Data Menu!Navigation!Advance Record (F10)")
           }
           
     }

ThrowFocus(Company_Name)[/quote]


and it still does not work.....  :-/[highlight][/highlight]
« Last Edit: Oct 26th, 2007 at 11:54pm by FlipGilbert »  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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) Form control
Reply #6 - Oct 29th, 2007 at 10:35am
Print Post Print Post  
Quote:
vNav = @SelectTreeItem("Search Update Menu!Navigation!Save Record") //this gives error


Have you tried FormCommit() ?
  

**
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: (Solved) Form control
Reply #7 - Oct 29th, 2007 at 1:37pm
Print Post Print Post  
I see that this thread was marked solved.

1. Please leave that to the Admins. Thanks!

2. There still seem to be some questions.  Is this actually solved, or are there still open issues?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Form control
Reply #8 - Oct 29th, 2007 at 3:34pm
Print Post Print Post  
Hello Erika, I apologize for the (solved) issue. It wont happen again. as for the question on the programing,  yes it is solved. after the weekend to think about it, a statement you made to me once was "control the data, not the data entry person". By a little programing in a subroutine I was able to do the post issue without the data entry persons input or (lack of it).  This will be faster and more effective.

FormCommit() was the fix also!

Thank you all for your support!
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged