CA Service Management

 View Only
Expand all | Collapse all

Drop down list in Catalog

  • 1.  Drop down list in Catalog

    Posted Dec 13, 2019 03:44 PM
    Hello community!!

    I need obtain from a list of arguments by example:


    First drop down list contain 10 arguments.(Disable = false)
    Second drop down list contain 100 arguments. (Disable =true)


    After to select the option in the first drop down list (Disable =false) and show in the second drop down list only the arguments corresponding to the one selected in the first drop down list.


    I create two data objects in Report Builder to obtain the list in every dropdown list but i dont have idea what more do. I think i need add an script in the form but this new for me.

    Thanks to all


  • 2.  RE: Drop down list in Catalog

    Posted Dec 16, 2019 08:13 AM
    Say I have two tables defined as follow

    table_1 :
    id
    Name

    table_2 :
    id
    name
    id_from_tbl_1

    First report object has a query looking something like :
    select id as value, name as label from table_1

    Second report object has a query looking something like :
    select id as value, name as label from table_2 where id_from_tbl_1 = %INTEGER%


    First dropdown is a standard one with first report object as report object ID.
    First dropdown : attribute onChange : ca_fdFetchSelectData(ca_fd.formId,'dropdown_2');


    Second dropdown is a standard one with second repport object as report object ID.
    Second dropdown : attribute Report variables : $({'INTEGER':ca_fdGetSelectedOptionValues(ca_fd.formId,'dropdown_1')[0]})


    Have fun



  • 3.  RE: Drop down list in Catalog

    Posted Dec 16, 2019 02:35 PM
      |   view attached
    Ok Pier, i try this and this is the result loaded in my enviroment

    The first drop down list is ok, but the second drop down list not work. i attached a .doc whit the screenshot and code.

    Attachment(s)

    docx
    DropDownList.docx   156 KB 1 version


  • 4.  RE: Drop down list in Catalog

    Posted Dec 16, 2019 08:25 PM
    Edited by Douglas Molina Dec 16, 2019 08:26 PM
    I think have two errors:

    I modify my code like this:

    First drop down list: ca_fdFetchSelectData(ca_fd.aperturaClaves,'cmbComponente');
    Second drop down list: $({'INTEGER':ca_fdGetSelectedOptionValues(ca_fd.aperturaClaves,'cmbSistema')[0]})

    Where aperturaClaves is the _id name of my form, now..........In the first drop down list load nice, but when i press the second drop down list only say Loading.... but not appear nothing.


  • 5.  RE: Drop down list in Catalog

    Broadcom Employee
    Posted Dec 17, 2019 08:34 AM
    Please, could you share the report query you are using?

    Usually I use like this, taking into consideration you doesn't have any variable in the first field:

    On the First Lookup Field:
    Report/Plug-in ID: id_from_my_report
    OnChange: ca_fdFetchSelectData(ca_fd.formId,'second_field_id')

    On the second lookup Field
    Report/Plug-in ID: id_from_my_second_report
    Report/Plug-in Variables: $('variable_2nd_field':ca_fdGetSelectedOptionValues(ca_fd.formId,'first_field_id')[0]})

    That's all you have to do.
    Sometimes I had problem testing those on Form Design Screen and it only worked after I added the form to a Service Offering, you could try that as well if loading... message still appearing, but in my experience, it still like loading... it's because it's not finding the variable, so, your information from OnChange from first field or/and the information from report/plug-in Variables are wrong. You could try as well to force a value you know is correct like:
    Add to Report/Plug-in Variables: $('variable_2nd_field':Integer). It should force the second lookup to display the values once you are providing the variable a number.



  • 6.  RE: Drop down list in Catalog

    Posted Dec 17, 2019 09:09 AM
    Edited by Douglas Molina Dec 17, 2019 09:17 AM
    Hi @Thomas Ponga​ in upload a .doc with the screenshot of my report query and all the components of each field, please confirm if you can see that.

    And yes, i force the value like this:

    SELECT persid as ID, nombre_componente as Componente
    FROM componentes
    WHERE persid_sistema= 200

    And remove onChenge parameter and works correctly only for those who hold the value 200 so....my query is fine but i don't know why with the variable is not working.





  • 7.  RE: Drop down list in Catalog

    Broadcom Employee
    Posted Dec 17, 2019 09:29 AM
    Try to add onChange in the first field: alert(ca_fdGetSelectedOptionValues(ca_fd.formId,'cmbSistema')[0]) ; just to see what is the number it's getting from this step. I usually use Alert() in all steps to make sure I'm providing/receiving the right information for each field.


  • 8.  RE: Drop down list in Catalog

    Posted Dec 17, 2019 09:48 AM
    Ok so this is the result and it's ok.....200 is the value of "Escritorio BAM"



  • 9.  RE: Drop down list in Catalog

    Posted Dec 19, 2019 09:28 AM
    Fields and Query definition do not match in your second report object :

    Query should be : select persid as ID, nombre_componente as Nombre_Componente from compenentes were persid_sistema=%INTEGER%


  • 10.  RE: Drop down list in Catalog

    Posted Dec 19, 2019 08:13 PM
    Edited by Douglas Molina Dec 19, 2019 08:14 PM
    I put now this, but i have the same......still Loading and no more.



    SELECT persid as ID, nombre_componente as Componente
    FROM componentes
    WHERE persid_sistema= %INTEGER%


  • 11.  RE: Drop down list in Catalog

    Broadcom Employee
    Posted Dec 20, 2019 06:48 AM
    It's just a guess, but maybe worth to do.
    Maybe it's considering the 200 as string not integer?
    have you tried to add '%INTEGER%' to your query?

    SELECT persid ID, nombre_componente Componente
    FROM componentes
    WHERE persid_sistema= '%INTEGER%'

    Or

    SELECT persid ID, nombre_componente Componente
    FROM componentes
    WHERE CAST(persid_sistema as varchar(10)) = '%INTEGER%'



  • 12.  RE: Drop down list in Catalog

    Posted Dec 20, 2019 09:50 AM
    Another thing that come to mind,

    I had a lot of issues with Capital letters and report object.

    I would suggest you put everything in lower case. (The alias in your query definition, your fields and your report object IDs.)

    Catalog relies a lot on JavaScript so capitalizing is important.


  • 13.  RE: Drop down list in Catalog

    Posted Dec 20, 2019 02:55 PM
    can be this the problem?

    This values are not INT so.....i will change this values from nchar to int and update here tomorrow.

    And i will try yours options @Thomas Ponga and @Pier Olivier Tremblay

    ​​​​


  • 14.  RE: Drop down list in Catalog
    Best Answer

    Posted Dec 20, 2019 06:18 PM
    Problem solved .....

    The problem was the values ​​in the database, I change these parameters from nchar to INT and now my drop-down menu is fine.

    Thank you all