Welcome! Log In Create A New Profile

Advanced

Editing a table and saving the modifications into a file

Posted by Gus 
Hi:
I have a table which I fill programatically, from a file. Now, if the user modifies a row (or a field in that row), I would like to save the changes in the file. How can I make this?

Thanks in advance!
Gus
Piet van Zanten
Re: Editing a table and saving the modifications into a file
April 26, 2009 11:16AM
Hi Gus,

In the "row exit of table" section you could put some code to save that line.
To point to the right record you can use a hidden column that stores the recordnumber when you are filling the table.
Then on exit of a table row:
if hread(MyFile,col_RecNum) then
   MyFile.MyItem1=col_Item1
   etc.
   hModify(MyFile)
end
Even new records can be allowed, because the recordnumber will be zero then.
This technique stores the record even if there are no changes. In most cases this is not a problem. I you want to deal with this then you have to set a flag in each column's "whenever modified" section that will be set if a change is made.
(Or use table..modified, but I don't really trust it)
You can also decide to store all changes at once, when exiting the table or pressing a button. Then you use the table columns line index in the above code.

Regards,
Piet
Jimbo
Re: Editing a table and saving the modifications into a file
April 26, 2009 06:45PM
Hi Gus, editing data in a table can be done, see pictures .. if any questions arise, feel free to ask .. Guenter

<a href="[de.tinypic.com"]; target="_blank"><img src="[i42.tinypic.com]; border="0" alt="Image and video hosting by TinyPic"></a>

<a href="[de.tinypic.com"]; target="_blank"><img src="[i43.tinypic.com]; border="0" alt="Image and video hosting by TinyPic"></a>
Hi Piet:
I tried this, but in the "Row exit" event, the content of the modified field is still the same (the original one) and not the new one...Should I use a different syntax to retrieve the new value introduced in the column?

Thanks;
Gus
Piet:
BTW, I tried disabling "Backup during row exit" option, but it's still the same.
Gus
Hi Piet:

I 'm sorry..I was working on the wrong table! Sometimes, it happens :-(
It's working fine!

Hi Jimbo:
Thanks for that! I will try it right now.

Gus
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: