Skip to main content
September 16, 2025
Solved

Display Information in Each Row

  • September 16, 2025
  • 6 replies
  • 0 views

I am trying to have the information iterated through and displayed in each row but am having trouble.. Can you please advise?

              a!gridField_25r2(
                label: "Online Banking Profile Info",
                labelPosition: "ABOVE",
                data: rule!OOW_returnOBprofileDetails(CIF: ri!CIF),
                columns: {
                  a!gridColumn(
                    label: "Account Username",
                    value: fv!row.userId
                  ),
                  a!gridColumn(
                    label: "Account Nickname",
                    value: rule!OOW_returnProfileNicknames(CIF: ri!CIF)
                  ),
                  a!gridColumn(
                    label: "Last Log In",
                    value: a!forEach(
                      fv!row,
                      rule!OOW_returnUserProfileLastLogIn(CIF: fv!row.customerCif)
                    )
                  ),

                },
                pageSize: 5,
                borderStyle: "STANDARD",
                shadeAlternateRows: true
              )

This is what is returned from my rule.

    Best answer by mikes0011

    In your rule you probably want to construct the dictionary that you want to use in your grid.  Using an a!map() dictionary you have a lot of flexibility.

    You're on the right track with your local!getUserProfileNickname and local!eventDates local variables - but your structure is wrong by a bit.  Instead of declaring these local variables and not using them, you should probably be iterating over local!activeProfiles once and building the array of dictionary you want from there.

    a!localVariables(
      local!search: rule!OOW_GET_customerProductsByCIF(customerNumber: ri!CIF).result.body,
      local!productKey: a!forEach(
        local!search.productSummaries.productKey,
        fv!item
      ),
      
      local!activeProfiles: a!flatten(
        /* use this approach instead of the legacy "reject/ifnull" setup */
        a!forEach(
          items: property(
            rule!OOW_GET_userProfileID(CIF: ri!CIF).result.body,
            "userProfile",
            null()
          ),
          /* FYI: i always recommend using property() to get properties, and index() only to get indexes */
          expression: if(
            fv!item.userStatus = "ACTIVE",
            fv!item,
            /*null*/
            {}   /* return an empty set, and empty entries are automatically excluded from the result array.  a!flatten() handles the one corner case where all entries are blank (without flatten, you'd get an array of empty sets in that case). */
          )
        )
      ),
      
      
      /* construct an array of map for our output: */
      a!forEach(
        local!activeProfiles,
        
        a!map(
          userId: fv!item.userProfileId,
          /* include any other fields here that you want from the original CDT (or, optionally, make a value of the map the original CDT itself) */
          
          userProfileNickname: property(
            property(
              property(
                rule!OOW_GET_userProfileNickName(
                  userProfileId: fv!item.userProfileId,
                  productKey: index(local!productKey, 1, null)
                ), "result", null(),
                "body", null(),
              ), "nickname", null()
            )
          ),
          
          eventDate: rule!OOW_GET_userProfileByProfileId(
            userProfileId: fv!item.userProfileId,
            includeEvents: true()
          ).result.body.eventDates.lastLogonFromMobileAppDateTime
        )
      )  
    )

    6 replies

    shubhama926776
    September 17, 2025

    Modify your data source rule rule!OOW_return0BprofileDetails() to return properly structured data with one row per account, ensuring each account has its own nickname and last login time as separate items in the array.

    Also could you help us with what’s exactly your source data and what’s expected output to looklike.

    harshas2775
    September 17, 2025

    Your rule referenced in data attribute, is returning a single text instead of List of Text. If you expect the values to be displayed as an array then split the last expression in your rule using

    split(local!variable (or whatever final expression you have) ,”;”) 

    No need to modify anything in main rule just split the final output so that it turns into a list of strings then try!

    mikes0011
    Brainy
    September 17, 2025

    a!gridColumn() is supposed to reference a single column of a single row of data, but here, in the column you're having it return that column's value for all rows, which is of course incorrect.  What you should be doing is making sure the "nickname" is included in the "return... ProfileDetails()" rule, and reference the value via i.e. "fv!row.nickname" (or whatever the property's name is in the returned data set).

    September 17, 2025

    Hi Mike! That makes sense, so I combined all of the info to return in one rule. Now the challenging part for me is to combine it into a data set... I would like local!getUserProfileNickname and local!eventDates to be within the dictionary of  local!activeProfiles.

    Can you please advise?

    a!localVariables(
      local!search: rule!OOW_GET_customerProductsByCIF(customerNumber: ri!CIF).result.body,
      local!productKey: a!forEach(
        local!search.productSummaries.productKey,
        fv!item
      ),
      local!activeProfiles: reject(
        fn!isnull,
        a!forEach(
          items: index(
            rule!OOW_GET_userProfileID(CIF: ri!CIF).result.body,
            "userProfile",
            null
          ),
          expression: if(
            fv!item.userStatus = "ACTIVE",
            fv!item,
            null
          )
        )
      ),
      local!getUserProfileNickname: a!forEach(
        local!activeProfiles,
        index(
          index(
            index(
              rule!OOW_GET_userProfileNickName(
                userProfileId: fv!item.userProfileId,
                productKey: index(local!productKey, 1, null)
              ),
              "result",
              null
            ),
            "body",
            null
          ),
          "nickname",
          null
        )
      ),
      local!eventDates: reject(
        fn!isnull,
        a!forEach(
          items: local!activeProfiles.userProfileId,
          expression: rule!OOW_GET_userProfileByProfileId(
            userProfileId: fv!item,
            includeEvents: true
          ).result.body.eventDates.lastLogonFromMobileAppDateTime
        )
      ),
      local!activeProfiles
    )

    mikes0011
    mikes0011Answer
    Brainy
    September 17, 2025

    In your rule you probably want to construct the dictionary that you want to use in your grid.  Using an a!map() dictionary you have a lot of flexibility.

    You're on the right track with your local!getUserProfileNickname and local!eventDates local variables - but your structure is wrong by a bit.  Instead of declaring these local variables and not using them, you should probably be iterating over local!activeProfiles once and building the array of dictionary you want from there.

    a!localVariables(
      local!search: rule!OOW_GET_customerProductsByCIF(customerNumber: ri!CIF).result.body,
      local!productKey: a!forEach(
        local!search.productSummaries.productKey,
        fv!item
      ),
      
      local!activeProfiles: a!flatten(
        /* use this approach instead of the legacy "reject/ifnull" setup */
        a!forEach(
          items: property(
            rule!OOW_GET_userProfileID(CIF: ri!CIF).result.body,
            "userProfile",
            null()
          ),
          /* FYI: i always recommend using property() to get properties, and index() only to get indexes */
          expression: if(
            fv!item.userStatus = "ACTIVE",
            fv!item,
            /*null*/
            {}   /* return an empty set, and empty entries are automatically excluded from the result array.  a!flatten() handles the one corner case where all entries are blank (without flatten, you'd get an array of empty sets in that case). */
          )
        )
      ),
      
      
      /* construct an array of map for our output: */
      a!forEach(
        local!activeProfiles,
        
        a!map(
          userId: fv!item.userProfileId,
          /* include any other fields here that you want from the original CDT (or, optionally, make a value of the map the original CDT itself) */
          
          userProfileNickname: property(
            property(
              property(
                rule!OOW_GET_userProfileNickName(
                  userProfileId: fv!item.userProfileId,
                  productKey: index(local!productKey, 1, null)
                ), "result", null(),
                "body", null(),
              ), "nickname", null()
            )
          ),
          
          eventDate: rule!OOW_GET_userProfileByProfileId(
            userProfileId: fv!item.userProfileId,
            includeEvents: true()
          ).result.body.eventDates.lastLogonFromMobileAppDateTime
        )
      )  
    )