venuadepu - Wednesday, August 26, 2009 3:39 AM:
Hi everyone,
I created a form with two dropdownlists, I want to load values from a table in the innovatorserver database into those dropdownlists when the form is loading.
Can anyone help on this?
Thanks in advance,
Venu
venuadepu - Friday, August 28, 2009 2:39 AM:
Hi I have written a server side method in VB like this.
Dim tmpInn As Innovator = Me.newInnovator()
Dim rs As Aras.Server.Core.InnovatorDataSet
Dim conn As Aras.Server.Core.InnovatorDatabase = CCO.Variables.InnDatabase
Dim sql As String = _
" SELECT name FROM [SAMPLE_TABLE]"
rs = conn.ExecuteSelect(sql)
If Not rs.Eof() Then
Dim methodName As String = CStr(rs.Value(0, ""))
Return tmpInn.newError(methodName)
End If
This code is always returning the first row in the first column (as I wrote as 0) value only, anyone knows how to get the second row value?
Brian - Wednesday, September 2, 2009 1:42 AM:
Can't you just set the "data source" for the field in the Form?
Brian.
Brian - Wednesday, September 2, 2009 8:53 PM:
Out of interest I tried to do this with a Javascript Client Side method with the following results.
if (this.options.length <= 1 ) // test if the combo box is already filled and skip if it is.
var parts = new Item("Part"); //create a new Item object of type "Part"
{
parts.setAttribute("select","item_number"); // tell the system what specific data I want returned. in this case "Item_number"
var res1 = parts.apply("get"); // retrieve the data from the server
if ( res1.isError() ) // test the return for error.
{
alert(res1.getError());
return;
}
var counter = res1.getItemCount(); // how many items of type "Part" were returned?
for (var i = 0; i < counter; i++) // loop to add them all
{
var theOption = new Option; // the combo box add method takes an "Option" object
theOption.text = res1.getItemByIndex(i).getProperty("item_number"); // set the Option object data
theOption.value = res1.getItemByIndex(i).getProperty("item_number");
this.add(theOption); // add the Option object
}
}
I used a Javascript Client Side method since the User Interface is client side and it is easier to get at the ComboBox item from the Client Side.
This method was implemented in the OnSelect Field Event for the combo box.
Rather than using SQL and other low level techniques for retrieving the data I have used the Innovator Object Model (IOM) to retrieve the data that I need and then extracted the specific information to put into the combo box from the returned data.
This takes around 2 seconds to fill approx 700 items
Cheers,
Brian.