Subject Re: setting default value of fields
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 7 Jul 2024 12:44:28 +0200
Newsgroups dbase.getting-started

On 2024/07/07 10:49, Mustansir Ghor wrote:
> Dear Mervyn Sir, Ken Sir and Heintz
>
> Thank You all for you solutions but in my case I can not use it.
>
> The creation of table has 31 columns (days on month). I am using updateset object  AppendUpdate method to either update or append records. The problem arises when the newly append records for a particular day are done. For these newly added records the other days fields gets null value. Hence for a particular record, to use its fields for calculations becomes difficult.
>

The updateset class can save one a lot of work but it only does what the
original programmer thought was necessary.  If one wants something even
slightly different then one needs to write one's own code.

In this case, if the appendUpdate() method is updating existing records
without causing problems, you may be able use the update() method
instead of appendUpdate() to deal with existing records in the main
table.  You would then only need to write code to deal with new records
which have to be added to the main table.

Go to first() in update rowset.
Scroll through the update rowset and findkey() the index key in the main
table rowset.
   If found, skip.
   If not found append record to main table.
   Replace all fields with the required default.
   Replace field in main table with field from update rowset with new data.
Save
Repeat to end of update rowset.
Requery main rowset

Mervyn.