Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Table mode data not saving (Read 1929 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Table mode data not saving
Nov 30th, 2010 at 3:43pm
Print Post Print Post  
When working in table view (subforms or parent form), data is not saving when the user leaves the field.

We’ve been wrestling with this issue for quite a while now. Hopefully, this is a known bug with an easy workaround?

Any tips would be appreciated.

We're running client/server version 2.5.2.

Steve
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Table mode data not saving
Reply #1 - Nov 30th, 2010 at 3:59pm
Print Post Print Post  
I'm not sure what you're talking about, Steve. As far as I know, table view saves data fine unless something is read-only or you have a NotifyForm flag set to prevent saving. Under what circumstances does this occur?
  

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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #2 - Nov 30th, 2010 at 4:05pm
Print Post Print Post  
I'm seeing this in update mode when a user tabs out of an LE, the old data OFTEN reverts back to it's original data. It does not happen 'always'.

Anyways, thanks for confirming. I'll take a look at all the form programming and post the results.

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: Table mode data not saving
Reply #3 - Dec 4th, 2010 at 10:17pm
Print Post Print Post  
Erika,

I see that the fields are retaining the changed data when I tab out, but the changes are lost when a command button with programming is pressed. I guess I can make the first line of the command button 'formcommit()' but that does not seem like a proper solution.

Any thoughts?

Steve
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Table mode data not saving
Reply #4 - Dec 5th, 2010 at 2:23pm
Print Post Print Post  
Since table view does not display command buttons, I'm assuming that this command button is on the parent form, yes?
  

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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #5 - Dec 5th, 2010 at 6:03pm
Print Post Print Post  
Yes, you are correct. It's on my invoice type form while changing data on a line item. Seems that the data is not committing.

I don't see this happening in my other aps. Could there be some form programming that would prevent the data from committing to the database?

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


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Table mode data not saving
Reply #6 - Dec 6th, 2010 at 2:28pm
Print Post Print Post  
Hello Steve,

In the programming on the command button are you using any of the FormResultSet commands to reference data that is in the table view subform?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #7 - Dec 6th, 2010 at 2:58pm
Print Post Print Post  
Yes, Ray. That is usually, if not always, the case.
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Table mode data not saving
Reply #8 - Dec 6th, 2010 at 3:10pm
Print Post Print Post  
My guess is that there is a command changing the current record that is in the subform without first saving the changes to the current record. FormFieldValue and @FormFieldValue both change what record is active in the subform, so you'll need to use FormCommit() on at least the subform before the rest of the programming of the command button runs.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #9 - Dec 6th, 2010 at 6:00pm
Print Post Print Post  
Ray,

Adding formcommit() to the top of the program fixed the issue....but why do I have the issue?

I don't see anything in the button code that would cause this issue. The subform has no programming in the form itself or any of the elements. The 'calculate' button that triggers the data loss is below. Perhaps Visibility() or Clear() commands are causing the form to 'reload' and wiping out the changed data? (The code below is a subroutine stored in 'global code' of the parent form (var's are allowed there?)
[quote]
subroutine calculate()
var x as int = 1
var vstatus as string
var vamount as double = 0

visibility(please wait,1)
Clear(back ordered,amount paid,subtotal)
subtotal = 0
tax = 0
total = 0

while x <= @formresultsettotal("order")
{
vstatus = @formfieldvalue("Order", "status",x)
if vstatus = "New Order" or vstatus = "In-Progress" or vstatus = "Shipped" or vstatus = "Complete" or vstatus = "Pending" then
{

subtotal = subtotal + @tomoney(@formfieldvalue("order", "selling Price",x))
vamount = vamount + @tomoney(@formfieldvalue("order","Amount paid", x))
}

if vstatus = "Back-Ordered" then back ordered += @tomoney(@formfieldvalue("order","selling price",x))

vstatus = ""
x=x+1
}

if taxable? = 1 then
{
tax = subtotal * @tonumber(@globalvalue(@userid+"taxrate"))
amount paid = (vamount * (@tonumber(@globalvalue(@userid+"taxrate")) +1))
}
else amount paid = vamount
total = subtotal + tax
visibility(please wait,0)
END SUBROUTINE
[/quote]
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #10 - Dec 6th, 2010 at 6:03pm
Print Post Print Post  
Also,

Rather than add 'formcommit()' to all of my command buttons (there are 20+). Should I just add 'formcommit()' to the 'on form change' of the subform? (Should sesame be doing this already?)

Additionally,

With 3 subforms, is there a particular order to list the formcommit commands? (Should subforms save BEFORE or AFTER the parent form saves?)


(running version 2.5.2)

Thanks!

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


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Table mode data not saving
Reply #11 - Dec 6th, 2010 at 9:24pm
Print Post Print Post  
Hello Steve,

The four statements that are
Code
Select All
@formfieldvalue("Order", "status",x)
@formfieldvalue("order", "selling Price",x)
@formfieldvalue("order","Amount paid", x)
@formfieldvalue("order","selling price",x)
 


are moving to a different subrecord than the current one as 'x' will be every record in the subform. Since the subform has not been told to save the changes to the record that has been saved, the changes are reverted.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Table mode data not saving
Reply #12 - Dec 6th, 2010 at 9:30pm
Print Post Print Post  
Steve_in_Texas wrote on Dec 6th, 2010 at 6:03pm:
Also,

Rather than add 'formcommit()' to all of my command buttons (there are 20+). Should I just add 'formcommit()' to the 'on form change' of the subform? (Should sesame be doing this already?)


On Form Change programming would not be the place to put a FormCommit as it runs after the user F10's, or other wise navigates, from a changed record. You will want to put a FormCommit call in the programming for your command buttons.

Quote:
Additionally,

With 3 subforms, is there a particular order to list the formcommit commands? (Should subforms save BEFORE or AFTER the parent form saves?)


There is no particular order needed. One thing to keep in mind is that the parent will always save the children records, but the child does not save the parent as well.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Table mode data not saving
Reply #13 - Dec 6th, 2010 at 9:43pm
Print Post Print Post  
Quote:
Since the subform has not been told to save the changes to the record that has been saved, the changes are reverted.


So to fix this issue, I need to add a formcommit() at the start of each command button program (to save the changed data that the user typed into the subform field), as well as during the program, just before the 'x = x + 1'

Is that correct?

Thanks for clarifying.

Steve

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


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Table mode data not saving
Reply #14 - Dec 7th, 2010 at 2:10pm
Print Post Print Post  
Hello Steve,

There is no need to place it before the x=x + 1, atleast not in the code that you posted as the subrecord is not changed from the start of the code until that point. So just a FormCommit at the beginning should work for you.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print