Visual Builder

Get Involved. Join the Conversation.

Topic

    Ronald Konijnenberg
    Moving items from one list to another
    Topic posted August 16, 2019 by Ronald KonijnenbergGreen Ribbon: 100+ Points, last edited August 16, 2019, tagged Action Flows, Business Objects, UI 
    26 Views, 6 Comments
    Title:
    Moving items from one list to another
    Summary:
    How can we move items from one list to another? Our approach using ADP's and list views ends in an error while removing items.
    Content:

    Hi all,

    Goal

    Currently me and my colleagues are trying to show two lists on a page. One with 'available' items and one with 'selected' items. Each item in the list also contains a button. The idea is that a user can select items from the list of available items and that these items then 'move' from the list of available items to the list of selected items.

     

    Approach

    Our approach is to use two ADP's, based on the same item type (which in turn is based on the REST endpoint of a business object). In a fictitious example these ADP's contain respectively :

    • Available truck drivers
    • Selected truck drivers

     

    Upon a button click event, our action chain is started that contains two actions:

    1. Fire data provider event aimed at adding the item to the ADP containing selected items: This works!
    2. Fire data provider event aimed at removing the item from the ADP containing available items: This fails!

     

    The second fire data provider event action is configured as follows:

    • Event target: ADP containing available truck drivers
    • Type: Mutate
    • Parameters
      • add: not mapped
      • remove: $chain.variables.key mapped to item[i] of keys in the remove parameters.
      • update: not mapped

     

    $chain.variables.key gets its value from $current.key in the list view.

     

    Problem

    We have difficulty removing items from the ADP, using the fire data provider event and get the following error:

    "unable to dispatch the mutation event due to inadequate information [object Object]"

    We have no idea what this cryptic error message means.

     

    Questions

    1. How do we remove an item from an ADP, using the fire data provider event in our current approach?
    2. Do you suggest a different approach to reach our goal (stated above)?
    3. Somewhat related: is it possible to define filtercriteria on an ADP, as you can with an SDP?

     

     

     

    Version:
    19.1.3
    Image:

    Comment

     

    • Ronald Konijnenberg

      Second screenshot:

    • Ronald Konijnenberg

      Third screenshot:

      • Shay Shmeltzer

        Does it work if you hard code a key into the keys?

        Try adding an empty data item like this:

        {
         "keys": [
          666
         ],
         "data": {}
        }

         

      • Shay Shmeltzer

        I think your issue is that your value is marked as "Static content" - when you need it to be an expression - and you need the expression to have the full structure.

    • Ronald Konijnenberg

      Hi Shay,

      Thank your for your replies.

      I tried the three things you suggested, but unfortunately without success.

      1. I first tried to changed the mapping value from 'static' to 'expression' and tested after that; no change, same error.
      2. I then tried adding the empty data item (and leaving the value set to 'expression') and tested after that; no change, same error.
      3. Next, I replaced the variable "{{ $chain.variables.key }}" with a hard coded key value 666 (and leaving the value set to 'expression') and tested after that; no change, same error.
      4. I then set the value back to 'static', leaving the hard coded key value and empty data item in play and tested after that; no change, same error.

      With each attempt I also refreshed the page.

      Any other suggestions? Can you reproduce this error?

       

    • Ronald Konijnenberg

      Hi all,

      In the meantime we fixed the removal of items from an ADP, using the built in Fire Data Provider event and its remove parameters.

      We forgot to configure the ADP's 'Id Attribute'. Now we set it to id (being the id of the truckdriver), the removal works flawlessly. Regarding the remove parameters, there was no need to set the value to expression, or to add an empty data item; the parameters as shown in the third screenshot now work.

      We figured this out while trying to replace the data provider actions with JavaScript. While looking at the logs, we saw that unexpected key values were being used while adding items to the selected truck drivers ADP. By rewatching Shay's video on multi select tables, we figured that unexpected key values could be related to the ADP's configuration.