array looping function for dynamic layout

I have two CDTs. on the first screen the users select items from the grid and for every selected item I am making a dynamic section to capture details in the myItemDetail_cdt. to create the dynamic layout section I need to know the number of indexes in the array.

I was thinking    1 + enumerate(count(pv!items_cdt)), should give me the count so I know how many items got selected then using type!myItemDetail_cdt() should create a empty array index. what is the looping function to do this? I tried the apply and I have to pass a function.

apply(type!type!myItemDetail_cdt(), 1 + enumerate(count(pv!items_cdt))

Parents
  • If i understand your requirements correctly, you're trying to determine list of selected items from grid and display dynamic section for each of the selected item. I would focus on retrieving selected items list from source itemsList used to populate grid and use unique identifier to identify selected item and store them into a local variable.

    Create these expressions to determine selected items and render a dynamic component for each of the selected item.

    1- Expression to get list of selected items:
    index(ri!itemDetails_cdt,
    wherecontains(ri!selectedUniqueIdentifiers, ri!arrayOfIdentifiers),"")


    2 - Expression to display dynamic component for each of the selected item from the grid:
    a!applyComponents(
    function: rule!renderItemDetails,
    array: 1 + enumerate(length(local!itemDetails_cdt)),
    arrayVariable: local!itemTokens
    )

    3 - Create an interface section to display item details, this will be displayed for each item.
    rule!renderItemDetails

    These are just SAMPLE code snippets and make sure to validate data for NULL and perform exception handling wherever required.
Reply
  • If i understand your requirements correctly, you're trying to determine list of selected items from grid and display dynamic section for each of the selected item. I would focus on retrieving selected items list from source itemsList used to populate grid and use unique identifier to identify selected item and store them into a local variable.

    Create these expressions to determine selected items and render a dynamic component for each of the selected item.

    1- Expression to get list of selected items:
    index(ri!itemDetails_cdt,
    wherecontains(ri!selectedUniqueIdentifiers, ri!arrayOfIdentifiers),"")


    2 - Expression to display dynamic component for each of the selected item from the grid:
    a!applyComponents(
    function: rule!renderItemDetails,
    array: 1 + enumerate(length(local!itemDetails_cdt)),
    arrayVariable: local!itemTokens
    )

    3 - Create an interface section to display item details, this will be displayed for each item.
    rule!renderItemDetails

    These are just SAMPLE code snippets and make sure to validate data for NULL and perform exception handling wherever required.
Children

 Discussion posts and replies are publicly visible