OnDataBroadcast

I am trying to develop a function that will update my fk’s when data is changed on a form. For example, if a key value is changed in a form that is linked to another form it is not updating immediately. I have UPDATE CASCADE set on all my FK’s in mysql, but for some reason they are not updating immediatey in servoy. The updates are posted immediately in mysql via the fk constraint. On the other hand, if I add or delete the record it is broadcasted to all clients.

The table I am working has a composite pk (PK1+PK2+Pk3) . I realize this is not optimal,but it’s where were at right now. If I change PK3 of the composite key, changes are not updated to all forms immediately in servoy. I would like to force a refresh. Below is what I have so far:

function OnDataBroadcast()
{

	var form = currentcontroller.getName();
   databaseManager.refreshRecordFromDatabase(forms[form].foundset,-1);	 //this code has issues because it will only refresh the current form the user is on
                                                                                                                         //possibly using flushAllClientCache might work.....
}

How do you update all client’s cache when a PK is updated? I can see the change notification, but the key value is not updated in the related table. Any ideas how to update the changes in all clients without killing performance?

i guess you really have to call the flushAllClientsCache(server,table) of the raw sql plugin to really flush everything everywhere…

I hope that you don’t have todo that very often because this will hit performance very hard.

why won’t pk data update in all client forms like non key fields?

because you do a cascade update in the database, servoy doesn’t know about that,
you should try to avoid updating stuff outside of servoy.

Hi Johan,

jcompagner:
because you do a cascade update in the database, servoy doesn’t know about that

Well a cascade update is standard functionality in RDBMS’s. So it would be nice if Servoy would start supporting this in their relationship definitions.
When defined there then Servoy DOES know about it :)

I guess I will file a feature request.

At the moment, I disabled the field that is part of the pk. If the user wants to update this field they must delete the record and create a new one with the correct value. This will ensure that all fk’s are up to date because servoy does broadcast the adds and deletes. However, this creates a problem in our business process.

Is there any way outside the flushAllClientCache(server,table).

ROCLASI:
Hi Johan,

jcompagner:
because you do a cascade update in the database, servoy doesn’t know about that

Well a cascade update is standard functionality in RDBMS’s. So it would be nice if Servoy would start supporting this in their relationship definitions.
When defined there then Servoy DOES know about it :)

I guess I will file a feature request.

I filed feature request SVY-875.