CA Service Management

  • 1.  cascade select in table

    Posted Jun 12, 2018 02:16 AM

    Hi,

     

    I want to achieve cascade select in a table.

     

    There are two dropdown in the table row.

    The selected value of the first dropdown will be the input variable of second dropdown's query.

    e.g. The first dropdown is country list. The second dropdown is city list.

     

    In second dropdown:

    I know it is able to pass the variable with the "Report/Plug-in Variables".

    I know it is able to use the "_val" to get the current dropdown value.

     

    But how to get the first dropdown value?

     

    Thanks.



  • 2.  Re: cascade select in table

    Posted Jun 12, 2018 08:56 AM

    ca_fdGetSelectedOptionValues()

    It returns an array of the selected values (Because if the dropdown is set to multi, you can select more than one  ).

    Since it returns an array, you need to access the first array item.

     

     

     

    In the properties of your second dropdown, write (assuming the variable in your report object is called country) :

    $({'country':ca_fdGetSelectedOptionValues(ca_fd.formId,'firstDropdown_id')[0]})

     

    In the properties of your first dropdown, write :

    ca_fd.js.firstDropdown__onChange();

     

     

    You need to create a function to call on the onChange event on the first dropdown. Add this to your script :

     

    firstDropdown__onChange : function()

    {

       var selectedValue = ca_fdGetSelectedOptionValues(ca_fd.formId,'firstDropdown_id')[0];

       if(typeof selectedValue != "undefined" && selectedValue != "")

           ca_fdFetchSelectData(ca_fd.formId,'secondDropdown_id');

    }



  • 3.  Re: cascade select in table

    Posted Jun 16, 2018 05:06 AM

    Hi pier-olivier.tremblay

     

    Thanks for reply.

     

    Your solution is for the cascade dropdowns 'outside' the table.

     

    When inside the table, it still work if there is only one editing row.

     

    But it doesn't work when there are more than one row in 'editing mode'. (attached screen)

    multiple rows in editing mode

    Do you know how to get the current row number in the onchange event?

    Or do you know how to limit the user to only edit one row in table at the same time?

     

    Thanks.



  • 4.  Re: cascade select in table

    Posted Jun 21, 2018 08:13 AM

    You are right i totally missed the question here

     

    Honestly i am not aware of a supported way to do this but since it's JavaScript, you can do whatever you want.



  • 5.  Re: cascade select in table

    Broadcom Employee
    Posted Jun 15, 2018 08:51 AM

    chison.cai 

    Was the information provided by pier-olivier.tremblay  helpful?



  • 6.  Re: cascade select in table

    Posted Jun 20, 2018 10:48 PM

    pier-olivier 's answer is for "cascade select in form". Not the solution to "cascade select in table".

    I think it's better to un-mark the "correct answer" flag, to avoid misleading others..



  • 7.  Re: cascade select in table
    Best Answer

    Posted Jun 21, 2018 11:32 PM

    To sum up, to build "cascade select in form", please refer to pier-olivier's solution.

     

    It seems there is no safe way to achieve "cascade select in table" in SC 17.1

    Although we can use javascript freely to manipulate html elements in DOM level, I think it is not standard customization way which is hard to maintain and risky for version upgrade.

     

    So we will reject this requirement to the end user.

    As a workaround, we provide below table to combine all the "cascade select dropdowns" into one dropdown.

     

    Category-Application-Function column

    ----------------------------------------------------

    Category1-Application1-Function1

    Category1-Application1-Function2

    Category1-Application2-FunctionC

    Category1-Application2-FunctionD

    Category2-Application4-FunctionY

    Category2-Application4-FunctionZ

     

    In this single dropdown, user can type the keyword to search. So the selection time per row is actually faster than selecting three dropdowns one-by-one.