Page 1 of 1

Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 3:08 pm
by briese-it
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?

Re: Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 4:31 pm
by sean
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)

Re: Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 4:45 pm
by briese-it
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.....

Re: Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 4:59 pm
by sean
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 ?

Re: Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 5:27 pm
by lwjwillemsen
Or Servoy should provide some kind of reload triggering for typeahead / combobox with valuelist by global method...
I asked for it many years ago.

Re: Refresh of valuelist with global method

PostPosted: Mon Apr 24, 2017 5:41 pm
by sean
Hi Lambert,

Thanks for your feedback. This feature is planned for 8.2.

Re: Refresh of valuelist with global method

PostPosted: Tue Apr 25, 2017 8:54 am
by briese-it
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

Re: Refresh of valuelist with global method

PostPosted: Tue Apr 25, 2017 4:56 pm
by sean
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 );

Re: Refresh of valuelist with global method

PostPosted: Wed Apr 26, 2017 8:55 am
by briese-it
Yes, you are right. My mistake, sorry.

Re: Refresh of valuelist with global method

PostPosted: Tue Mar 06, 2018 5:07 pm
by robrecht
Hi Lambert,

Thanks for your feedback. This feature is planned for 8.2.


@sean Has this feature been developed? Can you give me a jira case please? Or the syntax to trigger such a method :)

Thanks !

Re: Refresh of valuelist with global method

PostPosted: Fri Mar 16, 2018 1:01 pm
by jo
sean wrote:Hi Lambert,

Thanks for your feedback. This feature is planned for 8.2.


Any update on this issue?

Re: Refresh of valuelist with global method

PostPosted: Fri Mar 16, 2018 4:55 pm
by sean
I'm sorry the feature that was implemented in 8.2 is different form this request:
lazy loading of global method valuelist (for only display valuelist without a real) if both the component and the globalmethod valuelist are configured correctly.


The case for this is SVY-1376 and is planned for Servoy 8.4.

As stated above, the best way to achieve this now is to use a custom valuelist and update it proactively.
Code: Select all
application.setValueListItems()

The shortfall with this is when the valuelist also needs custom typeahead functionality (i.e. cannot be full cached and reused)