Data updated through external website

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Data updated through external website

Postby Grimbert » Mon May 22, 2017 4:00 pm

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?
User avatar
Grimbert
 
Posts: 20
Joined: Wed Apr 15, 2009 3:48 pm

Re: Data updated through external website

Postby Bernd.N » Mon May 22, 2017 8:17 pm

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.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 544
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Data updated through external website

Postby ROCLASI » Mon May 22, 2017 10:18 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Data updated through external website

Postby Grimbert » Tue May 23, 2017 1:32 pm

thanks guys!
the "databaseManager.refreshRecordFromDatabase(foundset, index)" worked for me.
User avatar
Grimbert
 
Posts: 20
Joined: Wed Apr 15, 2009 3:48 pm

Re: Data updated through external website

Postby pbromwell » Wed Jun 07, 2017 1:37 am

If you want to get fancy, you can do this: https://youtu.be/82Rvcmx753w
pbromwell
 
Posts: 6
Joined: Mon May 19, 2014 7:59 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 6 guests