# Valuelist not refreshing on value change

**URL:** <https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615>\
**Category:** Classic Servoy\
**Created:** [February 28, 2018, 9:37am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615 "2018-02-28T09:37:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavesh.panchal](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bhavesh.panchal](https://forum.servoy.com/u/bhavesh.panchal)\
**Post date:** [February 28, 2018, 9:37am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/1 "2018-02-28T09:37:31Z")

</div>

Hello,  
we are using dropdown devex component, where we are facing an issue.

There is “valuelist” property same as servoy dropdown component. Now by default 500 records are coming and there is few more records even after and so when we type then data should be come which is actually after 500, like happening in servoy dropdown but not happening for our component. So can you please guide that what needs to be trigger or call any event/API to achieve it?

Thanks  
Bhavesh

---

<div class="post-metadata">

**Author:** ![rafig](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/rafig/32/4463_2.png) [@rafig](https://forum.servoy.com/u/rafig)\
**Post date:** [February 28, 2018, 10:23am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/2 "2018-02-28T10:23:46Z")

</div>

Hi,  
easiest thing to do is to load valuelist yourself using SQL before displaying dropdown. (Servoy dynamic loading is limited to 500 values & only shows others when set to ‘typeahead’)  
If values don’t change often, do it in onSolutionOpen  
If they do, do it in ‘onShow’ of form

something like

```auto
	var query1 = "SELECT description FROM stock WHERE archived = 0 AND item_number IS NOT NULL ORDER BY item_number";
	var dataset1 = databaseManager.getDataSetByQuery ( server_name, query1, null, 10000 );

	var displayDataArray = dataset1.getColumnAsArray ( 1 );
	var query2 = "SELECT stockid FROM stock WHERE archived = 0 AND item_number IS NOT NULL ORDER BY item_number";

	var dataset2 = databaseManager.getDataSetByQuery ( server_name, query2, null, 10000 );

	var realDataArray = dataset2.getColumnAsArray ( 1 );
	application.setValueListItems ( 'valuelistname', displayDataArray, realDataArray );

```

if you only need display values, just use one query and parameter

Rafi

---

<div class="post-metadata">

**Author:** ![jdbruijn](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jdbruijn](https://forum.servoy.com/u/jdbruijn)\
**Post date:** [February 28, 2018, 10:38am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/3 "2018-02-28T10:38:59Z")

</div>

> rafig:  
> Hi,  
> easiest thing to do is to load valuelist yourself using SQL before displaying dropdown. (Servoy dynamic loading is limited to 500 values & only shows others when set to ‘typeahead’)  
> If values don’t change often, do it in onSolutionOpen  
> If they do, do it in ‘onShow’ of form
> 
> something like
> 
> ```auto
> var query1 = "SELECT description FROM stock WHERE archived = 0 AND item_number IS NOT NULL ORDER BY item_number";
> 
> ```

```
var dataset1 = databaseManager.getDataSetByQuery ( server_name, query1, null, 10000 );

var displayDataArray = dataset1.getColumnAsArray ( 1 );
var query2 = "SELECT stockid FROM stock WHERE archived = 0 AND item_number IS NOT NULL ORDER BY item_number";

var dataset2 = databaseManager.getDataSetByQuery ( server_name, query2, null, 10000 );

var realDataArray = dataset2.getColumnAsArray ( 1 );
application.setValueListItems ( 'valuelistname', displayDataArray, realDataArray );

```

> ```auto
> 
> if you only need display values, just use one query and parameter
> 
> Rafi
> 
> ```

Better to do it in one query:

```auto
   var query1 = "SELECT stockid, description FROM stock WHERE archived = 0 AND item_number IS NOT NULL ORDER BY item_number";
   var dataset1 = databaseManager.getDataSetByQuery ( server_name, query1, null, 10000 );

   var realDataArray = dataset1.getColumnAsArray ( 1 );
   var displayDataArray = dataset1.getColumnAsArray ( 2 );

```

---

<div class="post-metadata">

**Author:** ![rafig](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/rafig/32/4463_2.png) [@rafig](https://forum.servoy.com/u/rafig)\
**Post date:** [February 28, 2018, 10:43am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/4 "2018-02-28T10:43:10Z")

</div>

> jdbruijn:  
> Better to do it in one query:

Good point, I was quickly copying from an old solution, not how I’d do it now of course ![;-)]( "Wink")

---

<div class="post-metadata">

**Author:** ![bhavesh.panchal](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bhavesh.panchal](https://forum.servoy.com/u/bhavesh.panchal)\
**Post date:** [February 28, 2018, 2:09pm UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/5 "2018-02-28T14:09:20Z")

</div>

Thanks for your feedback.

But thing is that we are using and pointing direct database table.  
And same approach we are using thoroughly in our application mostly. So what to do now can you please suggest?

Thanks,  
Bhavesh

---

<div class="post-metadata">

**Author:** ![jdbruijn](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jdbruijn](https://forum.servoy.com/u/jdbruijn)\
**Post date:** [March 1, 2018, 8:17am UTC](https://forum.servoy.com/t/valuelist-not-refreshing-on-value-change/19615/6 "2018-03-01T08:17:14Z")

</div>

If you are using your own component here, I think you will have to take care of loading the next block of records your self, I am not sure how to do.  
Maybe someone from Servoy can answer this better for you.
