Display Information in Each Row

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.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    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).

  • 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
    )

  • +1
    Certified Lead Developer
    in reply to cindyl5142

    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
        )
      )  
    )

Reply Children
No Data