1
0
-1
Hi,
I am trying to implement an auto complete text field with makes of cars. I have over 1000 makes.
I have dragged in the TM Auto Suggestion controller in composer, and linked it to my text field. The auto suggest data source is a new service definition, dynamic data type called "Make Look up". In what way do I put my 1000 car makes in the new service definition?
Is there any other steps I have overlooked or need to configure to get this to work?
Am I on the right path? Have tried to follow the TM4 manual but get a bit lost.
Don
  1. Don Sibley
    Hi,
    Any information available on this?
  2. Chantal Thomas
    Hi Don,
    I will chase it up.
    Regards
    Chantal

  3. Unknown User (support)
    Hi Don,

    Transaction Manager


    There are a number of options to store the data.

    1. Database table (preferred option).

    The 'Make Look Up' Dynamic Data service would include a select statement like this:

    select car_desc, make, model, colors, year .... from car_table where car_desc like '%desc"

    The Dynamic Data service would then format the data an return an Array of JSON objects [{"desc" : "Honda Accord 2014", "make" : "Honda", "model" : "Accord", "colors" : "Silver,Red,Blue" , "year" : "2014" ..... } , ..]

    Another scheduled service could be created to synchronize the contents of the database on a nightly basis.

    2. Service Parameter. If a database isn't an option and the data kept in a spreadsheet or text file, the best option is to manipulate it into JSON formatted text. The text would be stored in a Service Parameter associated with the 'Make Look Up' Dynamic Data service.

    {
    "Honda Accord 2014" : {"desc" : "Honda Accord 2014", "make" : "Honda", "model" : "Accord", "colors" : "Silver,Red,Blue" , "year" : "2014" ..... } ,
    "Honda Odyssey 2011" : {"desc" : "Honda Odyssey 2011", "make" : "Honda" , "model" : "Accord", "colors" : "Silver,Red,Blue" , "year" : "2014" ..... } ,

    The 'Make Look Up' Dynamic Data service would read the JSON into a map in memory. The code could select the matching keys "Honda Accord 2014" and return the list of matched entries
    [{"desc" : "Honda Accord 2014", "make" : "Honda", "model" : "Accord", "colors" : "Silver,Red,Blue" , "year" : "2014" ..... }, ...]

    Another scheduled service could be created to synchronize the contents of the Make Look Up - JSON Service Parameter on a nightly basis.

    Composer


    You can achieve this by two ways:

    1. Having an Dynamic Data Service defined in Transaction Manager to populate result data as JSON Array (mentioned in Transaction Manager section above). Normally used by searching a database or requesting a web service.

    Once you got the DDS lookup working in Transaction Manager which assuming returns JSON Array format like this:
    [{"desc" : "Honda Accord 2014", "make" : "Honda", "model" : "Accord", "colors" : "Silver,Red,Blue" , "year" : "2014" ..... }, ...]
    you can drag and drop an auto suggestion controller into the form, and set the following properties (under Data category) in Composer:

    • Dynamic Data Service Name: Must match the DDS name defined in TM.



    • Trigger Field: Point to a text field in form which will become the type ahead input field (this field's name has to match the request parameter in DDS script to retrieve user typed content)



    • Trigger Field Name: JSON object name that you want to search and display in the list. For example, by setting to "desc", it will show "desc" value as a suggestion list



    • Auto Fill Block: point to a block contains text fields which name matching the result JSON name. (For example, text fields named: "make","model","colors","year","desc"). When user selected some car in the list, that car's information will be filled into this block by naming convention


    2. If the result set is static, you can use a reference data widget in Composer instead. This does not require Dynamic Data Service and the implementation article is found in:
    https://avoka.zendesk.com/entries/86453933-How-to-implement-the-Auto-Suggestion-Type-Ahead-feature-using-Form-property-prefill-V4
CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1
    1. Doug Oldmeadow
      Hi Don
      Not sure if you've had this resolved yet, but I eventually had some success with AutoSuggest. I've got an example you can look at based on your scenario athttps://gist.github.com/dougsta/83422f7e06d0e6abcaa0
      Good Luck
      Doug O

    CommentAdd your comment...