autocomplete using database

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
jgreen
New User
Posts: 4
Joined: Thu Aug 05, 2010 8:16 am
First Name: John
Last Name: Green
Company Name: Auction Software
Phone: 931-680-7427
Address 1: 221 Highland Circle
City: Shelbyville
State / Province: Tennessee
Zip / Postal Code: 37160
Country: United States
Contact:

autocomplete using database

Post by jgreen »

I would like to use autocomplete to have the user key and select a name and then use the selected name to return the account number associated with the name to the screen. I have tried unsuccessfully. Is this possible? If so where can I find a step by step guide?

Thx.

I agree with others on this forum this is a GREAT product!
michael.mayer-oakes
New User
Posts: 1
Joined: Mon Aug 30, 2010 12:45 pm
First Name: Michael
Last Name: Mayer-Oakes
Company Name: Copart
Phone: 707-639-5128
Address 1: 4665 Business Center Drive
City: Fairfield
State / Province: California
Zip / Postal Code: 94534
Country: United States
Contact:

Re: autocomplete using database

Post by michael.mayer-oakes »

New to the product myself but this appears to be done with the Database-Driven Auto-Complete functionality in the UI Visual Developer. It looks like you just give it a db file and option fields, so a name field and a ID field for example from the db file.
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: autocomplete using database

Post by David »

Yes, this is certainly possible.

To enable this functionality, start with a textbox control. Set the "choices database file" to the desired file. At runtime, this file will be located using the current library list of the application's job.

Set the "choices options field" property to the desired field name from the file that you'd like the user to search on -- in this case the name field. There is a field selection button that you can use in this property to select the field from a listing of fields in the file.

Set the "choice values field" property to the field you'd like to return to the program for this field -- in this case the id field.

When set up this way, the user will see/search on the names as they type. The program will get the id value into the field which is bound to the textbox's "value" property when the screen is submitted to the server.

When the screen is redisplayed, you could have RPG code move the id value into another output field on the screen (through "value" property binding) so that the id can be seen on the screen also.

If you'd like to show the selected id value automatically before the screen submits, you can use the "onselect" event to call some JavaScript code to do this.

You could create an output field widget on the screen and assign a unique value to the "id" property.

You could then create a JavaScript function (for example "myFunction") and assign the name to the "onselect" property.

When the user makes a selection, the function will be called and the selected record will be passed in to the function.

The function would be written like this:

Code: Select all


function myFunction(record) {

  var outputField = document.getElementById("fieldId"); // case-sensitive "id" property of output field.

  outputField.innerHTML = record["fieldName"]; // name of "choice values" field.

}

For populating the id value into the output field on first screen load (for example in "edit" mode), you could use "value" property binding to move the id in from RPG.
Post Reply

Who is online

Users browsing this forum: BrianRees and 2 guests