Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
tomkra, Piet van Zanten, Markus K.

New and changed data record

Startbeitrag von tomkra am 17.08.2013 10:26

Hi,

I load with a query, manualy the data records in a table.
I've always used TableDeleteAll() event of a change and reloaded all the data records. But this is to slow.

How can load only the new/changed records (HAdd/HModify)?

Greetings

Thomas

Antworten:

Hi,

for editing existing entries in the table save the index (idx) of the entry you want to edit, After edit (in an other window for example) you can actualize with
table_xy.col_value1[idx] = newValue
table_xy.col_value2[idx] = newValue2

Adding new entries with tableaddline(table_xy, newValue1, newValue2) or with tableinsertline(table_xy, rowIdx, newvalue1, newValue2)

Greetings

von Markus K. - am 17.08.2013 13:37
Hi Thomas,

I use a solution similar to Markus.
Add a hidden column holding the record number of the query. (queries have recordnumbers too)
This is useful in a case where you don't have an index available.

Regards,
Piet

von Piet van Zanten - am 17.08.2013 15:47
Thank you Markus and Piet,

I change the Database with HAdd/HModify. Than I fill the Memory table with HExecutQuery() and TableAddLine(). The user can not directly edit the table.
There is no internal database function (Hyperfile), where I can see which record has been changed / added?

Greetings

Thomas

von tomkra - am 17.08.2013 19:53
Hi Thomas,

It all depends on where the records are modified.
Is it in the same program or is it by other users?
If it's in the same program, when you have added or modified a record the filebuffer always contains the last modified record, so you always know which record has been modified.
Just do a tableseek on the recordnumber and then TableModifyLine if found and tableaddline if not found.
If modifications are made in a multiuser environment, then you use hVersion to check for modifications and you have to fill the whole table again.
Perhaps logging and using hHistoryModification may be useful.
Or you can keep track of modifications yourself by creating a file holding the modifications.

Regards,
Piet

von Piet van Zanten - am 18.08.2013 08:20
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.