Autocomplete in Combodyn boxes?

I hope somebody can help us with some ideas on “Autocomplete Combodyn” boxes using Crossvision Application designer.

We have a box (Combodyn) where a user must enter the name of a town. Currently, we have the alphabet listed below the box, where a user can click on a letter (first character of the town name). A list is then brought back from a mainframe service in a dynamic array. You only know this is complete once the hourglass icon disappears (no town name automatically appears in the combodyn box). You then have to click in the box to see the list, and can type the name to position within the list).

This all seems cumbersome and we are really hoping for something a little more user friendly than this. Ideally, we’d like to start typing within the combodyn box, and let’s say, after typing three characters and a certain delay, the service will be called to bring back town names starting with the same first character, positioning according to what was typed.

Any ideas to improve on what we came up with?

Framework provides for an auto load behaviour at FIELD control. There is a demo server available showing the feature. Have a look http://www.ajax-softwareag.com:8080/cis/servlet/StartCISPage?PAGEURL=/cisdemos/22_fieldautocallpopupmethod.html

If of interest the field is defined like that

field valueprop=“whatEverPropertyName”
width=“150” popupmethod=“openIdValueCombo”
autocallpopupmethod=“true”>
/field

Thank you Martin. I had a look at the example you sent, and it is exactly what we are after.

I am trying to test this and did the following:

  1. Created a FIELD with autocallpopmethod = true, and popupmethod = openIdValueCombo.
  2. I then imported the adapter and am trying to figure out where I need to populate the list of town names (for the autohelp dropdown list). The adapter generated the built-in method findValidValuesForXXX (where XXX = town) where the service will be called. What then?

The help on the field refers me to a chapter called Popup Dialog Management, but it is not in any documentation that I have. What am I missing here? I paste the generated adapter below:

  • PAGE1: PROTOTYPE — CREATED BY Application Designer —
  • PROCESS PAGE USING ‘XXXXXXXX’ WITH
  • TOWN
    DEFINE DATA PARAMETER
    /( PARAMETER
    1 TOWN (A) DYNAMIC
    /
    ) END-PARAMETER
    END-DEFINE

/( PROCESS PAGE
PROCESS PAGE U’/ALIB/WB001M00’ WITH
PARAMETERS
NAME U’town’
VALUE TOWN
END-PARAMETERS
/
) END-PROCESS
*

  • TODO: Copy to your calling program and implement.
    //( DEFINE EVENT HANDLER
  • DECIDE ON FIRST *PAGE-EVENT
  • VALUE U’nat:page.end’
  • /* Page closed.
  • IGNORE
  • VALUE U’findValidValuesForTown’
  • /* TODO: Implement event code.
  • PROCESS PAGE UPDATE FULL
  • VALUE U’onExit’
  • /* TODO: Implement event code.
  • PROCESS PAGE UPDATE FULL
  • NONE VALUE
  • /* Unhandled events.
  • PROCESS PAGE UPDATE
  • END-DECIDE
    //) END-HANDLER

END [/color]

OK now I see it is in context of “Natural for AJAX”. It requires the check if/how can be used in that context. We will keep you posted.

Hi Werner,

For a NATPAGE you use

 nat:page.valueList

to send the validvalues to the client. Your application usually fills in the corresponding values in the findValidValuesForXXX event.

In the NJX-Documentation you’ll find more information in chapter:
Developing the Application Code/Sending Events to the User Interface.

Best Regards,
Christine

Hi Christine

Thank you for your help. As you can probably tell, we only recently started using the Application Designer and Natural for Ajax, and what we are seriously lacking, is examples, specifically regarding the use of Natural code. I had a look at the documentation you refer to, and I am still unsure of the exact format of the parameters I need to send (id and text). Is text an array, or simply a dynamic (A) field- ie, do I compress my list of town names into this field - , or into an array (and somehow delimiting this with a semi-colon)?

PROCESS PAGE UPDATE FULL
AND SEND EVENT ‘nat:page.valuelist’
with parameters
NAME *** VALUE *** /(I assume the id)
NAME *** VALUE *** /
(I assume the text)
end-parameters

Where can I get Natural code examples which may be a little more helpful than what I see in the documentation (we both are referring to).

Thank you much for your help

Regards
Werner

Ok, I have this working now:

PROCESS PAGE UPDATE FULL
AND SEND EVENT ‘nat:page.valueList’
with parameters
NAME ‘id’ VALUE ID
NAME ‘text’ VALUE TEXT

Only one problem left. After selecting the value in the list, I don’t see it in the FIELD. Since it is not an array, I cannot determine which value was selected (to programmatically assign it) - besides, I don’t have any control within the single PROCESS PAGE EVENT to get an opportunity to do so anyway).

Hi Werner,

To implement the Java example, for which Martin sent the link, you have to do the following:

  1. Hold the complete list of ID/TEXT pairs in some application internal data structure. (for instance MYIDS + MYTEXTS)

  2. In the findValidValuesForXXX event do the following:

2a) check if the Natural data field you set as “valueprop” (for instance MYINPVAL) in the field control is empty. If it is empty send the complete ID/TEXT pairs via

...AND SEND EVENT 'nat:page.valueList' with parameters 
NAME 'id' VALUE MYIDS NAME 'text' VALUE MYTEXTS

2b) If MYINPVAL is not empty: check all MYIDS if they start with MYINPVAL.

2c) If in 2b) no MYIDS match, send all MYIDS/MYTEXTS as in 2a)

2d) If in 2b) exactly one matches, set MYINPVAL to the matchig one and send all MYIDS/MYTEXTS as in 2a)

2e) else return only the matching MYIDS and MYTEXTS in the …AND SEND EVENT ‘nat:page.valueList’ statement.

Best Regards,
Christine

Thank you Christine. We finally got it working yesterday by doing the following:

  1. Populate the ‘id’ variable with a list of values (upon selection) you wish returned to the input field.
  2. Populate the ‘text’ variable with whatever other descriptive information you wish (which, upon selection, will not be returned to the input field).

We do check the input field for a value, and return a list of towns starting with whatever portion that was typed in. If nothing was typed in, we only return towns starting with an ‘A’ (the list of all towns in South Africa, which is rather large).

Thank you very much for your help. Without it we’d still be wondering if this was possible.

The time it takes to return the list in the Autopopup help is a little bit disappointing. The Natural service which reads the data is I/O optimised and cannot be made to read it any faster. Any ideas on this? I presume “patience” is the answer?

Regards
Werner