Hi John,
Thanks for the response.
Have tried what you suggested but it still does not work. What happens is that the names i select in the drop down are returned to the form field and not the record id value which is what i need to store in the database column.
This is the method as how you suggested:
var maxRows = 100
var query = “select (cast(id as varchar(10)) + ’ ’ + firstname + ’ ’ + lastname) as ‘Name’, id from dbo.Members with (nolock) where leaderId = " + memberId + " order by firstname, lastname”
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxRows)
application.output(‘recs=’+dataset.getMaxRowIndex())
if (dataset.getMaxRowIndex() > 0)
{
application.setValueListItems(‘memberid’, dataset)
}
This is the method as how is in the documentation:
var maxRows = 100
var query = “select (cast(id as varchar(10)) + ’ ’ + firstname + ’ ’ + lastname) as ‘Name’, id from dbo.Members with (nolock) where leaderId = " + memberId + " order by firstname, lastname”
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxRows)
var labelArray = dataset.getColumnAsArray(1)
var idArray = dataset.getColumnAsArray(2)
application.output(‘labelArray=’+labelArray)
application.output(‘idArray=’+idArray)
application.output(‘recs=’+dataset.getMaxRowIndex())
if (dataset.getMaxRowIndex() > 0)
{
application.setValueListItems(‘memberid’, labelArray, idArray)
}
In either of these two cases the 2nd col (id) is not returned back to the form field, the 1st col (‘Name’) is, which is no good as the database col is an int col to hold the rec id.
Please confirm what I am doing wrong!