Normal Topic Search and Add from the same form (Read 794 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Search and Add from the same form
Jan 11th, 2012 at 10:29pm
Print Post Print Post  
I'm trying to set up a very simple file with two elements, DCNumber and Location.  This will be used by our production personnel to track the location of each tool number (DCNumber) we use in our manufacturing.

I'm trying to go back and forth from the search to add mode using two tabs of the same form.  Everything seems to be working except for the add side.

When I enter a new record, I click on a command button with the following programming:


     vNav = @SelectTreeItem("Add Data Menu!Navigation!Save Record")
     vNav = @SelectTreeItem("Add Data Menu!Navigation!Main Advance Record (Ctrl-F10)")
     vNav = @selectTreeItem("Add Data Menu!Navigation!Switch To Search Mode (F7)")

However, when I add the first record it works fine.  But if I go back to the search mode, which puts me on tab 1, and then add another record, the first record I added is still there.  I don't want our operators to have to worry about advancing to the next record.

How can I make the file move to the next record?
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Search and Add from the same form
Reply #1 - Jan 12th, 2012 at 9:49pm
Print Post Print Post  
Try this. It should save the new record, open search mode, then close out of add mode. That way when you go back to add mode, there won't be any other forms there -- just a new, blank, form ready for some new data.

Code
Select All
	vNav = @SelectTreeItem("Add Data Menu!Navigation!Save Record")
	vNav = @selectTreeItem("Add Data Menu!Navigation!Switch To Search Mode (F7)")
	@Exit
 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Search and Add from the same form
Reply #2 - Jan 13th, 2012 at 2:10pm
Print Post Print Post  
That works!  Thanks!  This closes the ADD from and returns me to the retreive spec. 

I don't understand why it works, however.  I use the @exit command to close different forms.  When I use it, it closes the form and returns to my main menu.  I usually have this command as the only line of programming to a command button named ExitForm. 

Why doesn't it close the entire form?
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Search and Add from the same form
Reply #3 - Jan 14th, 2012 at 6:15pm
Print Post Print Post  
Because in that code, we just opened the form in a 2nd tab as Search mode, and @Exit is only closing the Add mode instance of the form. Think of it as closing the tab you have open (the gray ones at the bottom of the Sesame window). Since, you can have the same form open in more than one gray tab, you can use @Exit to close just one of them.

If that isn't clear, I can see why you may be getting confused by the concept. Because, when you are in Search mode and click on the "Add New Records" button in the command area, it actually closes Search mode and opens Add mode. If you were to be using the command tree rather than the command buttons (which is the default) in the command area (you set that in the sesame.ini file or with a command line switch), you would be able to have the same form open in both Add and Search (or Update) modes at the same time. You can also open multiple modes of the same form by using @SelectTreeItem in a custom main menu setup, which is how I build all of my applications.

So, @Exit will only close one of these modes (tabs). Does that make sense?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Search and Add from the same form
Reply #4 - Jan 16th, 2012 at 1:24pm
Print Post Print Post  
I think I understand what you're saying about closing one of the tabs in Sesame; "tab" meaning one of the grey ones at the bottom of Sesame.

Last question: in the programming, the second line the programming changes to the SEARCH mode.  How does Sesame know that the @exit command applies to the ADD mode tab and not the SEARCH mode tab?
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Search and Add from the same form
Reply #5 - Jan 17th, 2012 at 12:23pm
Print Post Print Post  
Because it is being executed in the Add mode tab, so it acts on the tab which is running it.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Search and Add from the same form
Reply #6 - Jan 17th, 2012 at 9:37pm
Print Post Print Post  
Got it!  Thanks for your help.
  
Back to top
 
IP Logged