Page 1 of 1

Data updated through external website

PostPosted: Mon May 22, 2017 4:00 pm
by Grimbert
Hi,

I'm having a problem where I receive data from a website into my database.
All new data is visible immediately in servoy, but whenever data is changed on the website I still see the previous values in servoy until I restart it.
Is there anyway I can force an update on a record?

Re: Data updated through external website

PostPosted: Mon May 22, 2017 8:17 pm
by Bernd.N
Did you try foundset.loadRecords(uuidpk) ?

This is what Servoy says to this function:
Loads a single record by primary key, will remove related sort.
NOTE: This function will return true if the foundset was altered/changed. It is up to the developer to check for the presence of actual data using getSize().
//Loads a single record by primary key, will remove related sort!
foundset.loadRecords(application.getUUID('6b5e2f5d-047e-45b3-80ee-3a32267b1f20'));
@param {UUID} uuidpk single-column pk value
@return Boolean true if successful

And maybe you could create that website (or at least a sub-website of it where the data gets entered) with ServoyNG?
Then there should not be such a problem as far as I know.

Re: Data updated through external website

PostPosted: Mon May 22, 2017 10:18 pm
by ROCLASI
Hi Grimbert,
Grimbert wrote:...but whenever data is changed on the website I still see the previous values in servoy until I restart it.
Is there anyway I can force an update on a record?


This is due to the fact that Servoy is caching this data and is not aware of the changes made. If another Servoy client would change the data it would notify the other clients using a data broadcasting to invalidate this cache and refetch it.

You have 2 options:

  • have a refresh button in your solution to invalidate the cache and reload the data from the database using (for instance)
    databaseManager.refreshRecordFromDatabase(foundset, index) where index can be -1 for all records
  • create a REST API using a pool of Servoy clients (a pool of 1 client already could be enough) that you use to update the data.
    Servoy's databroadcast handles the rest. Just make sure you add your own security!

Hope this helps.

Re: Data updated through external website

PostPosted: Tue May 23, 2017 1:32 pm
by Grimbert
thanks guys!
the "databaseManager.refreshRecordFromDatabase(foundset, index)" worked for me.

Re: Data updated through external website

PostPosted: Wed Jun 07, 2017 1:37 am
by pbromwell
If you want to get fancy, you can do this: https://youtu.be/82Rvcmx753w