Cognos Analytics

 View Only
  • 1.  Autocomplete Feature using Custom Control

    Posted Wed September 11, 2019 12:29 PM
    Hi Cognos Analytics Team,

    I am trying to implement  an autocompleted for all value prompt using  the Custom control .

    For maintainability business is looking  only Custom control. Autocompleted feature that I have already  implemented using   inline JavaScript ( using html  item) but the issue here I am facing  challenge to convert this JavaScript into jQuery based custom control. 

    For example.

    In value prompt contains the list of fruits products such as Apple, Mango, Orange, Banana etc... 
    when you inter B in value prompt Banana should display.

    Your help will be highly appreciated. 

    Thanks


    ------------------------------
    Pankaj Kishore
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Autocomplete Feature using Custom Control

    Posted Thu September 12, 2019 04:45 AM
    Hi

    I once created a javascript using the custom control to do this.
    Please find the javascript and the report xml attached.
    The code uses the datalist html tag to create the autocomplete so it doesn't work in older browsers, but you can still modify it.

    The advantage of this javascript is that you can reuse it for any autocomplete you want to create.
    Just create a query in your report that contains the autocomplete values and attach it to the custom control.

    Kind regards

    ------------------------------
    Daan Lambrechts
    ------------------------------

    Attachment(s)



  • 3.  RE: Autocomplete Feature using Custom Control

    Posted Fri September 13, 2019 01:45 AM
    Hi

    You can't type in a value prompt. If you want to create a value prompt where you also have the option to type part of the value you are searching, you will need to create such a control in the javascript.
    jQuery has an example of it: https://jqueryui.com/autocomplete/#combobox

    Kind regards

    ------------------------------
    Daan Lambrechts
    ------------------------------



  • 4.  RE: Autocomplete Feature using Custom Control

    Posted Fri September 13, 2019 05:35 AM
    Hi Daan,

    Firstly I would like to thank you for your great help and assisting me.

    Autocompleted feature using Value prompt has been implemented using the inline JavaScript  but the issue  here is unable to convert this JavaScript into Custom control jQuery Code.

    For your reference I am attaching the screenshot and JavaScripts for your kind reference.

    Thanks 

    Pankaj Kishore

    ------------------------------
    Pankaj Kishore
    ------------------------------



  • 5.  RE: Autocomplete Feature using Custom Control

    Posted Fri September 13, 2019 05:53 AM
    I think that function like getFormWarpRequest do not work with custom controls, so I'm afraid you can't just copy the entire code.
    I'm not an export in writing javascript code so I can't develop an autocomplete value prompt in a few minutes.
    The basics of getting the data to fill the autocomplete are already in the javascript file I sent you.
    I'm sure that with a bit of time you will be able to write the code yourself based on the old code.

    ------------------------------
    Daan Lambrechts
    ------------------------------