Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 8 Jahren, 6 Monaten
Letzter Beitrag:
vor 8 Jahren, 6 Monaten
Beteiligte Autoren:
Gus, Jimbo, Piet van Zanten

Editing a table and saving the modifications into a file

Startbeitrag von Gus am 25.04.2009 18:37

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

Antworten:

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

von Piet van Zanten - am 26.04.2009 09:16
Hi Gus, editing data in a table can be done, see pictures .. if any questions arise, feel free to ask .. Guenter






von Jimbo - am 26.04.2009 16:45
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

von Gus - am 26.04.2009 18:39
Piet:
BTW, I tried disabling "Backup during row exit" option, but it's still the same.
Gus

von Gus - am 26.04.2009 18:41
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

von Gus - am 26.04.2009 18:57
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.