Update New Sequence Column

Certain I’m missing something basic here?

I have created a new column in a previously populated table, and I’m going to set it to a new PK value (eventually). Initially its set to allow Nulls so I can populate it - and its set to a Servoy Sequence.

I need to populate the empty rows with the Servoy sequence. How do I do that? I need to do this is in a number of legacy tables so looking for the simplest route. Do I need to:

  1. Cycle through all the records using code - making each individual record current (so Servoy will populate the column)?
  2. Write a routine to insert the next value?
  3. Click on some very simple (and therefore I am very stupid LOL) command in the Dataproviders toolbox?

Appreciate feedback.

Hi Kahuna,

Kahuna:

  1. Cycle through all the records using code - making each individual record current (so Servoy will populate the column)?

Cycling through the record will not make Servoy fill in the blank fields with a servoy sequence value.
Servoy sequences are auto-enter values, i.e. they are set when you create a new record.

I suggest you write a little method that loops through the foundset and set an incremental value in the empty field. After this method you go into the dataprovider tab and select the correct column, select the Auto Enter tab, hit the ‘Calculate from data’ button. This will fetch the highest used value in that column. Now hit the ‘Update repository’ button and you are set.

Hope this helps.

ROCLASI:
Hi Kahuna,

Kahuna:

  1. Cycle through all the records using code - making each individual record current (so Servoy will populate the column)?

Cycling through the record will not make Servoy fill in the blank fields with a servoy sequence value.
Servoy sequences are auto-enter values, i.e. they are set when you create a new record.

I suggest you write a little method that loops through the foundset and set an incremental value in the empty field. After this method you go into the dataprovider tab and select the correct column, select the Auto Enter tab, hit the ‘Calculate from data’ button. This will fetch the highest used value in that column. Now hit the ‘Update repository’ button and you are set.

Hope this helps.

Thanks Robert - thought there might have been an easier route!

Not to worry - see if I can write a global method to take the table and field name and update it.

Cheers

Hi Kahuna,

Kahuna:
Not to worry - see if I can write a global method to take the table and field name and update it.

But please don’t forget the last portion that I mentioned. You need to tell the repository what the new (high) values are.

Hope this helps.

ROCLASI:
Hi Kahuna,

Kahuna:
Not to worry - see if I can write a global method to take the table and field name and update it.

But please don’t forget the last portion that I mentioned. You need to tell the repository what the new (high) values are.

Hope this helps.

Got that - thanks Robert.