# Problem using global methods

**URL:** <https://forum.servoy.com/t/problem-using-global-methods/16632>\
**Category:** Classic Servoy\
**Created:** [October 11, 2012, 6:42am UTC](https://forum.servoy.com/t/problem-using-global-methods/16632 "2012-10-11T06:42:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![siavash.roozbehan](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@siavash.roozbehan](https://forum.servoy.com/u/siavash.roozbehan)\
**Post date:** [October 11, 2012, 6:42am UTC](https://forum.servoy.com/t/problem-using-global-methods/16632/1 "2012-10-11T06:42:40Z")

</div>

Hi guys,

I have a form with a couple of comboboxes in it that are based on custom valuelists. When I run the application in the development environment it loads all the values in the valuelists and everything is fine, but when I export the solution and upload it on the server, the moment it tries to open the form and load the valuelists in the comboboxes it will throw an error “can’t setup form”. The reason behind it is the relation that I use to load the dataset from is null at that time though the relation is not null when I run the application in the developer. Is there anything wrong with using relations in the global method to load some values to the valuelists when the solution is running on the server?

can anyone help me with this problem? any ideas of how can I resolve this issue?

Cheers,  
Siavash

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [October 12, 2012, 12:36pm UTC](https://forum.servoy.com/t/problem-using-global-methods/16632/2 "2012-10-12T12:36:45Z")

</div>

Can you show the code that you use to fill the valuelist?

There should not be any functional difference between the developer and the server, but it could for example be that your relation depends on data that is not there on the server.

---

<div class="post-metadata">

**Author:** ![siavash.roozbehan](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@siavash.roozbehan](https://forum.servoy.com/u/siavash.roozbehan)\
**Post date:** [October 14, 2012, 10:51pm UTC](https://forum.servoy.com/t/problem-using-global-methods/16632/3 "2012-10-14T22:51:02Z")

</div>

> Joas:  
> Can you show the code that you use to fill the valuelist?
> 
> There should not be any functional difference between the developer and the server, but it could for example be that your relation depends on data that is not there on the server.

Hi Joas,

Thanks for your reply. Here is the global function that I use to load the valuelist:

```auto
function emp_assignmentComboEmployees(displayValue, realValue, record, valueListName, findMode) {

	var EmpFs = databaseManager.getFoundSet(globals.DB_SERVER_NAME, 'employee');
	EmpFs.loadAllRecords();

	if(EmpFs.find()){
		EmpFs.category = '!1 || ^';
		EmpFs.datefinished = '<today || ^';
		EmpFs.search();
	}
        
        if(!utils.hasRecords(EmpFs)){
            return databaseManager.createEmptyDataSet(0, 2);
        }

	var employeeDs = databaseManager.convertToDataSet(EmpFs, ['employeecode', 'idemployee', 'employeefullname']);
	
	for (var i=1; i < employeeDs.getMaxRowIndex(); i++){
		
		var displayVal = employeeDs.getValue(i,1) + " | " + employeeDs.getValue(i,3);
		employeeDs.setValue(i,1,displayVal);
	}

	employeeDs.removeColumn(3);
	return employeeDs;

}

```

Cheers,  
Siavash

---

<div class="post-metadata">

**Author:** ![siavash.roozbehan](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@siavash.roozbehan](https://forum.servoy.com/u/siavash.roozbehan)\
**Post date:** [October 22, 2012, 10:25pm UTC](https://forum.servoy.com/t/problem-using-global-methods/16632/4 "2012-10-22T22:25:02Z")

</div>

Anyone please?

---

<div class="post-metadata">

**Author:** ![maria.kyselova](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@maria.kyselova](https://forum.servoy.com/u/maria.kyselova)\
**Post date:** [October 24, 2012, 11:18pm UTC](https://forum.servoy.com/t/problem-using-global-methods/16632/5 "2012-10-24T23:18:49Z")

</div>

Um… We also tried to just empty the global method and return an empty dataset.  
That didn’t work.  
Judging from the console output it looks like the field is not there at that point or something: GlobalMethodValueList couldn’t be made for: null ![:shock:]( "Shocked")

[attachment=0]error.JPG[/attachment]

Please help.

Cheers,  
Maria

 ![error.JPG](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/3/3807a308127da092b740d7bd8700472f28b40e52.jpeg)
