Code works in Developer, Doesn't work in Client

I have two, totally unrelated pieces of code that work perfectly in Developer…

They don’t work at all in client…

Has anyone else experienced this?

Nope, what do you do in the code and can you show the code?

I have a text field of length 250 on my Navigation toolbar called: categories.

It has a value list attached called ValueList_Fields with no Custom Values radio button checked, and no values in the list.

It also has a method attached to the field called ChangeUserSubList with the following code:

if(globals.gListValues == ‘Edit…’)
{
globals.gListValues == null

var x = ‘a,b,c’

var myArray = x.split(‘,’)

for ( var i = 0 ; i < myArray.length ; i++ )
{
var m = myArray

  • }*

}
else if(globals.gListValues == ‘Add…’)
{

  • var x = plugins.dialogs.showInputDialog(‘Add Item’, ‘Item to add:’)*

  • if(x)*

  • {*

  • forms.ValueList.controller.newRecord(true)*

  • forms.ValueList.person_name = globals.gListNames*

  • forms.ValueList.valuelist = x*

  • forms.ValueList.controller.saveData()*

  • globals._Get_Column_Values();*

  • }*

  • else*

  • {*

  • globals.gListValues == null*

  • }*
    }
    else
    {

  • forms.contact_main.user_value_list_value = globals.gListValues*
    }
    [/quote]
    There is a label above it called categories and it links to a form called: ValueList.
    The OnShow on the ValueList form has a method called Get_Field_Names with the following code:
    > globals.gListNames = globals.gUsersName
    >
    > var query = “select valuelist_item from valuelist where user_id = " + globals.gUsersID + " order by valuelist_item”
    > var dataset = databaseManager.getDataSetByQuery (controller.getServerName(), query, null, 1000);
    >
    > application.setValueListItems(‘ValueList_Fields’,dataset);
    On that form (ValueList) is a button called Add Category Item with the attached code:
    > var selectedcolumn = globals.gListNames
    > var newvalue = plugins.dialogs.showInputDialog(‘Add item to the list ’ + globals.gListNames ,’');
    >
    > if(newvalue)
    > {
    > controller.newRecord()
    > user_id = globals.gUsersID
    > valuelist_item = newvalue
    *> *
    > controller.saveData();
    > Get_Field_Names();
    > }
    Below that is a global field called: gListNames with the method Get_Column_Values attached to OnDataChange with the following code:
    > globals.gListValues = “”
    > //Get a dataset based on query
    > var maxReturedRows = 1000;// choose a max number of items for the valuelist
    > var query = 'select valuelist from valuelist where ’ +
    > “person_name = '” + globals.gListNames + “'”; // warning: certain dbs may require the expression NULL instead of null
    > var dataset = databaseManager.getDataSetByQuery(currentcontroller.getServerName(), query, null, maxReturedRows);
    >
    > if(dataset.getMaxRowIndex() > 0)
    > {
    > application.setValueListItems( ‘ValueList_Values’, dataset)
    > }
    > else
    > {
    > application.setValueListItems( ‘ValueList_Values’, new Array(‘ERROR! User Not Found’))
    > }
    >
    > return;
    Below that is a global field called gListValues with the method Change_Item_Value attached to OnDataChange with the following code:
    > var oldvalue = arguments[0]
    > var query = "select valuelist_item from valuelist where user_id = " + globals.gUsersID
    > var dataset = databaseManager.getDataSetByQuery (controller.getServerName(), query, null, 100);
    >
    > var answer = plugins.dialogs.showQuestionDialog( “Value List”, “Delete '” + globals.gListValues + "’ from the list " + globals.gListNames + “?”, “Delete”, “Modify”, “Cancel”)
    >
    > if ( answer == “Delete” )
    > {
    > controller.find()
    > valuelist_item = globals.gListValues
    > user_id = globals.gUsersID
    > var x = controller.search()
    *> *
    > if(x > 0)
    > {
    > //something found
    > controller.deleteRecord()
    *> *
    > Get_Field_Names();
    > }
    *> *
    > }
    > else
    > {
    > if ( answer == “Modify” )
    > {
    > var newvalue = plugins.dialogs.showInputDialog(‘Modify value’,‘New value’);
    > if(newvalue)
    > {
    > controller.find()
    > valuelist_item = globals.gListValues
    > user_id = globals.gUsersID
    > var x = controller.search()
    *> *
    > if(x > 0)
    > {
    > //something found
    > valuelist_item = newvalue
    > controller.saveData()
    *> *
    > Get_Field_Names();
    > }
    > }
    *> *
    >
    > }
    > }
    > //refresh the value list items
    > Get_Column_Values();
    Is it clear now? :D

hmmm, that’s a lot.

OK, that’s the code.

Now, what do you want to archieve and what is not working?

Two things:

  1. Since the recent rc2 I experienced a somewhat similar problem in that a simple valuelist that was created WITH rc2 works fine in Developer (showing and returning proper values). In client however I was getting a java error where I would seem some nonsense (‘134@198428’ or something like that - I can’t reproduce it now). I think - not sure - that it might have had to do with some sort of mix up with running Developer and Server at the same time but really not sure. Today it seems fine after starting everything correctly.

  2. I notice in your first two lines this:

if(globals.gListValues == 'Edit...') 
{ 
globals.gListValues == null

It seems that the ‘if’ statement checks to see if globals.gListValues has the value ‘Edit..whatever’. But then the first line that follows is not setting globals.gListValues to null but again evaluating. I don’t know why that would work in Developer but not in Client but that seems to me as though it is wrong. But maybe it is just a copy/paste thing. There was a LOT of code there but that just jumped out at me on the first line (as I have typo-ed the ‘=’ and ‘==’ so many times…).