Normal Topic Need help with 1.1.3 changes (Read 1182 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Need help with 1.1.3 changes
Dec 2nd, 2005 at 7:17pm
Print Post Print Post  
Since upgrading, I’m seeing that when adding a new record (current record is showing 0 of 0) and the command @formcommit(“”) is issued, the record saves and forcefully advances to a new blank record (record 2 of 2). The user then has to back up to record 1 to continue work on the record.

However, if the new record being added is considered record 1 or greater, the @formcommit(“”) command correctly saves the form and keeps the user on the current record (does not advance and leave them on a new, blank record....or it advances and then retreats quickly enough to not interupt the user.)

To summarize, what can I do to commit a record without kicking the user to the next record, or can I start a user on record 1 instead of record 0 when entering add mode?

Thanks,
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need help with 1.1.3 changes
Reply #1 - Dec 3rd, 2005 at 12:48am
Print Post Print Post  
If you commit the 1st record before entering any data, it will stay on the 1st record.

Maybe you can temporarily (until a fix is released) place FormCommit("") in On Record Entry while in add mode. This does present a potential problem... what if someone opens add mode, but then exits without entering any data? You may end up with some blank records. Undecided

Wait a minute! I just tested it. The blank record is not saved, which means you can use this code in the form's On Form Entry event:
Code
Select All
If @Add
      FormCommit("")
 


This seems to work well, with no side effects.
  


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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with 1.1.3 changes
Reply #2 - Dec 3rd, 2005 at 12:51am
Print Post Print Post  
Carl, your the man!

Thanks for your time and knowledge. I'll give it a try.

Sincerely,

Steve
  
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: Need help with 1.1.3 changes
Reply #3 - Dec 21st, 2005 at 2:24pm
Print Post Print Post  
Quote:
Wait a minute! I just tested it. The blank record is not saved, which means you can use this code in the form's On Form Entry event:
Code
Select All
If @Add
	FormCommit("")
 


This seems to work well, with no side effects.


Would this work the same way?
Code
Select All
If @Mode() = 0
	FormCommit("")
 



If so, is one way better than the other?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Need help with 1.1.3 changes
Reply #4 - Dec 21st, 2005 at 4:32pm
Print Post Print Post  
Yes, they both will do the same thing. Which one you use is up to you.

Happy Holidays,
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: Need help with 1.1.3 changes
Reply #5 - Dec 21st, 2005 at 8:27pm
Print Post Print Post  
Thanks Ray, this is working great now.  I'll lay off of the questions for a while, give you a break.  Thanks again!
  

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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with 1.1.3 changes
Reply #6 - Jan 5th, 2006 at 11:13pm
Print Post Print Post  
Ray,

If the focus is in a table mode subform and the user presses a button to run formcommit(""), which form will save?

If the form has subforms, should I use something like:

formcommit("my_parent_form")

?

Thanks,
Steve
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with 1.1.3 changes
Reply #7 - Jan 5th, 2006 at 11:48pm
Print Post Print Post  
Maybe It would help if I tell you the issue I'm experiencing....

In my 'invoice' application, we enter customers data into the parent form (shown as record 0 of 0) and use sbasic to xlookup data from a products database and then use the 'formfieldvalue' command to post the data into a lineitems subform. Because of various issues, we have experienced crashes during the order entry process and have lost the 'unsaved' data in the parent form, while the lineitem data becomes orphaned.

At the very least, I want to prevent this issue by saving the parent form at various times throughout the order entry process, but I'm trouble with @save, formcommit("") and other means of 'quietly' saving the record without disturbing the user.

Any thoughts?

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



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need help with 1.1.3 changes
Reply #8 - Jan 6th, 2006 at 2:08am
Print Post Print Post  
Steve,

You should be using FormCommit("My_Parent_Form"), since it will save the parent and link the subforms.

The following quote is from page 171 in the latest Programming Guide.
Quote:
FormCommit(form_name)
Type: Forms/Records
Parameters: Form name as a string
Returns: Nothing

Calling this command causes the open record in the named form to be committed
(saved). Only the open (selected) record in the specified form is saved. In an
application with subforms, this command should be used in place of an
@SelectTreeItem("Add Data Menu!Navigation!Save Record") command. If the form
name is left blank("") the action will take place on the form from which the command
is run.

In the case of subforms, this command will commit the subform record, but does not
save (link) it to the parent record. The parent record must be saved independently.

In the case of a parent record, all previously committed subforms will be linked to the
parent and the parent form will be committed.

Examples:

     FormCommit("Countries")
     FormCommit("")
  


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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with 1.1.3 changes
Reply #9 - Jan 6th, 2006 at 2:14am
Print Post Print Post  
THANK YOU, Carl.

I completely overlooked the details about FormCommit in the new manual. (I thought we were using an undocumented feature.)

It's much clearer now.

Thanks again.
Steve
  
Back to top
IP Logged