Refresh of valuelist with global method

Questions, answers, tips and ideas on Servoy Client

Refresh of valuelist with global method

Postby briese-it » Mon Apr 24, 2017 3:08 pm

Hello,
I have a valuelist which is used as typeAhead on a text field.
This valuelist is filled by a global method (QBSelect) and returns a dataset with informations out of the table "itemTable".
When a user adds a record to this table, the tableview is not updated until the user restarts the application.
I can see that the query "datasources.db.sqlDB.itemTable.createSelect" ... databaseManager.getDataSetByQuery(query,1000) in my global method is not loading the actual data, it's only cached data.
How can I refresh/load the updated data for a valuelist with a global method?
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Refresh of valuelist with global method

Postby sean » Mon Apr 24, 2017 4:31 pm

Hi Michael,

If you are using getDataSetByQuery(), then it should be hitting the database table directly and not running from cache.

You said that your "tableView" is not updated ? I assume you mean a form's foundset does not show the new record.
This could be the case if the foundset is filtered, or is limited in another way, i.e. with find()
You can check with hasConditions()
What is the result after calling foundset.loadAllRecords() ?

Also, just to clarify, the record was added in a Servoy session or from another application ?
(If latter, then you won't get a data broadcast event)
Software Engineer
Servoy USA
sean
 
Posts: 88
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Refresh of valuelist with global method

Postby briese-it » Mon Apr 24, 2017 4:45 pm

Sorry, my mistake :-). Forget about the tableview.
I meant that the valuelist items are not updated if the same user adds records to the table on an other form in Servoy. Only the old entries are shown and I have no possibility to refresh the valuelist.

I agree that getDataSetByQuery() should get the data directly out of the table but in this case I get only the old records. I don't know why.....
Attachments
Servoy2.png
Missing record "9" in valuelist
Servoy2.png (3.01 KiB) Viewed 648 times
Servoy1.png
Added record "9" on a form
Servoy1.png (6.92 KiB) Viewed 648 times
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Refresh of valuelist with global method

Postby sean » Mon Apr 24, 2017 4:59 pm

Hi Michael,

The global method value list doesn't run proactively (i.e. on another datachange)
So it should show the values when selected, but won't update items which are already displayed.

Can you set a breakpoint in your method and debug, so you can tell if it is actually running when you expect it?

Perhaps you should look into using a "custom" value list, that you proactively update, using application.setValueListItems ?
Software Engineer
Servoy USA
sean
 
Posts: 88
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Refresh of valuelist with global method

Postby lwjwillemsen » Mon Apr 24, 2017 5:27 pm

Or Servoy should provide some kind of reload triggering for typeahead / combobox with valuelist by global method...
I asked for it many years ago.
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 569
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Refresh of valuelist with global method

Postby sean » Mon Apr 24, 2017 5:41 pm

Hi Lambert,

Thanks for your feedback. This feature is planned for 8.2.
Software Engineer
Servoy USA
sean
 
Posts: 88
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Refresh of valuelist with global method

Postby briese-it » Tue Apr 25, 2017 8:54 am

Looks like an issue with getDataSetByQuery. Now I tested the following:

var itemSelect = datasources.db.boss_sql.it_artikel.createSelect( );
itemSelect.where.add(
itemSelect.or
.add( itemSelect.columns.rec_del.isNull )
.add( itemSelect.columns.rec_del.eq( 0 ) )
);

var itemFs = databaseManager.getFoundSet( itemSelect );
var itemQueryFs = itemFs.getQuery();

application.output("Result from Fs: " + databaseManager.getDataSetByQuery( itemQueryFs, -1 ));

application.output("Result from Ds: " + databaseManager.getDataSetByQuery( itemSelect, -1 ));

Output:

Result from Fs: JSDataSet:size:10,selectedRow:-1
Custom query: SELECT FROM src_boss_entwicklung:dbo:it_artikel<db:/boss_sql/it_artikel>#itartikel2364 <anonymous> (((src_boss_entwicklung:dbo:it_artikel<db:/boss_sql/it_artikel>#itartikel2364.1073772033=rec_del<-7,0,0>)=([<anonymous>=<null>]) OR (src_boss_entwicklung:dbo:it_artikel<db:/boss_sql/it_artikel>#itartikel2364.1073772033=rec_del<-7,0,0>)=([<anonymous>=0]))) not executed because no columns are specified to be selected
Result from Ds: JSDataSet:size:0,selectedRow:-1
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Refresh of valuelist with global method

Postby sean » Tue Apr 25, 2017 4:56 pm

HI Michael,

It looks like your query is missing an columns in the result.
Loading a foundset with a query shouldd always have the PK column(s) in the result of the query.
Try it again with the following:
Code: Select all
itemSelect.result.addPK() // add the PK Column(s) to the result of the query
var itemFs = databaseManager.getFoundSet( itemSelect );
Software Engineer
Servoy USA
sean
 
Posts: 88
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Refresh of valuelist with global method

Postby briese-it » Wed Apr 26, 2017 8:55 am

Yes, you are right. My mistake, sorry.
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany


Return to Servoy Client

Who is online

Users browsing this forum: No registered users and 2 guests