1
0
-1

Hi,
I have a form using the TM Auto Suggest controller, which has settings as in "Setting.png"

Attachment:

Settings.png 

And with my Test data as in "Test Data.png" which is

Attachment:

Test Data.png

[{"Suburb": "NICHOLLS", "Postcode":"2913","State":"ACT"},
{"Suburb": "NICHOLLS", "Postcode":"9999","State":"WA"},
{"Suburb": "BURWOOD", "Postcode":"2134","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"1111","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"2222", "State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"3333","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"4444","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"5555","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"6666","State":"NSW"},
{"Suburb": "BURWOOD", "Postcode":"3151","State":"VIC"},
{"Suburb": "PALMERSTON", "Postcode":"8888","State":"WA"}
]

I limit the displayed suggestion items to 3.

Here is the result of my testing

    • Typing NI

 

    • The suggested list displayed with all NI bold

 

    • So far it's ok (Attachment "Nicholls.png")

Attachment:

Nicholls.png

    • Typing BU

 

    • Same suggestion list displayed with BU highlighted ("Burwood.png")

Attachment:

Burwood.png

    • Typing PA

 

    • Same list displayed with no Palmerstonitem("Palmerston.png")

Attachment:

Palmerston.png

If change the Maximum Items in Suggestion Lists to -1("Settings-2.png")

Attachment:

Settings-2.png

    • Typing PA, the whole listof datawill display with PA highlighted ("Whole list.png")

Attachment:

Whole list.png

In general, for a specific number of maximum items setting, in my case is 3,it always displayed the first 3 items no matter what, so even there are more BURWOOD, or PALMERTON, they weren't displayed.

What I expect to see is

    1. Typing BU the list should display 3 items of BURWOOD

 

    1. Typing PA the list should display 1 item of PALMERSTON (as there is only one Palmerston in my test data)



So could you advise me if there is a setting which I suppose to configure to make it happen like that? Otherwise setting the Maximum items to -1 is not ideal if it is a big list of data return.
Thank you.
Regards
Lan

  1. Jye Cusch
    Hi Lan,

    The way you have configured the Auto Suggest Controller is to work with a TM Dynamic Data Service. In a true usage scenario the TM Dynamic Data Service will do the work of sorting and filtering the list of results to be returned (as JSON). As a result, the 'Test Data' section is useful for ensuring the field is displaying in the form as you would expect, but will not filter or sort the results.

    If you want the Auto Suggest Controller to do the work of filtering and sorting the list, you need to instead configure it to useReference Data, this can be done with the following steps:

    1. UnderConfigurationchangeAuto Suggestion Data Source toReference Data (Prepop)

    2. UnderReference Data Configuration tick the box labelledComplex Reference Data (Multiple Columns With Heading)

    3. Swap yourJSONtest data forCSV test data with headings, example below:


    Suburb,Postcode,State
    NICHOLLS,9999,WA
    BURWOOD,2134,NSW
    BURWOOD,1111,NSW
    BURWOOD,2222,NSW
    BURWOOD,3333,NSW
    BURWOOD,4444,NSW
    BURWOOD,5555,NSW
    BURWOOD,6666,NSW
    BURWOOD,3151,VIC
    PALMERSTON,8888,WA

    Hope this helps,
    Jye
  2. Unknown User (support)
    Hi Jye,
    Thank you for your quick response.
    It works with that Reference Data. :-) So in real, my data should be set up in the "Form XML Data" of Form Data Config in TM, right?
    Cheers
    Lan

  3. Jye Cusch
    You're welcome,
    As for getting the data into the XML, there are a number of ways to achieve this. Modifying the Form XML Data as you suggest would work, although I would recommend usingProperty Prefill Mapping orInput XML Prefill Mapping as an alternative as they're easier to manage with regards to new form version releases.
    Reference data should always be mapped to the following location in the form XML:
    <AvokaSmartForm>
    <SFMData>
    <SystemProfile>
    ...
    </SystemProfile>
    <ReferenceData>
    <YourReferenceDataNameHere>
    <![CDATA[
    Suburb,Postcode,State
    NICHOLLS,9999,WA
    BURWOOD,2134,NSW
    BURWOOD,1111,NSW
    BURWOOD,2222,NSW
    BURWOOD,3333,NSW
    BURWOOD,4444,NSW
    BURWOOD,5555,NSW
    BURWOOD,6666,NSW
    BURWOOD,3151,VIC
    PALMERSTON,8888,WA
    ...
    ]]>
    </YourReferenceDataNameHere>
    </ReferenceData>
    </SFMData>
    </AvokaSmartForm>
  4. Unknown User (support)
    Hi Jye,
    The more I look into this, the more questions I like to ask. :-)
    Is there any difference between TM Auto Suggest Controller and TM Reference Data Lookup Block?
    Cheers
    Lan
  5. Jye Cusch
    No worries Lan,
    I'm happy to answer, so long as I know the answers :)
    TheTM Reference Data Lookup Block is a block that contains aTM Auto Suggest Controller and aText Field, it's designed to make setting up a simple auto suggestion field with basic data (data value and display value) easier. In essence they're the same, but using the TM Auto Suggest Controller directly will give you more control over the set up.
    Cheers,
    Jye
  6. Unknown User (support)
    Hi Jye,
    Thank you for the explanation.
    I have another question. :-)
    Now if I want to use the TM Dynamic Data Service which will do the work of sorting and filtering the list of results to be returned (as you said earlier). Thenplease tell me howthe Data Service captures what you are typing in, e.g. "BUR", so itfilters and returns thelist of all items contains"BUR"? And does it also mean the Data Service is called every time you type one more letter like "BURW", "BURWO" and so on?
    Cheers
    Lan
  7. Jye Cusch
    If you're writing theTM Dynamic Data Service inGroovy (which I recommend), then you can access the input field's data by accessing the Request Parameters, something similar to the following should work:
    def input = request.getParameter('YourFieldNameHere')


    TheTM Dynamic Data Service will be called every time a letter is typed into theTrigger field of theTM Auto Suggestion Controller, for this reason it's important to keep the work done in your dynamic data service to a minimum.
  8. Unknown User (support)
    Oh, I know about this request.getParameter('YourFieldNameHere') but I thought it would not called the Data Service until you actually finish entering the text and click some kind of action button.
    Thank you Jye.
    Cheers
    Lan
  9. Unknown User (support)
    Hi Jye,
    If I choose not to select the suburb from the suggestedlist, but type in myself then tab to the next field, my input is cleared??
    Lan
CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1
    1. Jye Cusch
      Hi Lan,
      There is a setting you can change to allow free text entry, by default only values returned from the data service or stored in reference data are valid. The setting can be found in:
      Data >Configuration >Clear Trigger Field When Not Matched
      Cheers,
      Jye
    CommentAdd your comment...