Convert Text Array to datasubset

I'm trying to covert an array of text to datasubset to display in a paging grid, but when applying the todatasubset function to this array an error message pops up saying "The given data type is not a complex type" even though it says that the arrayToPage parameter can be of simple or complex type. Is there any workaround to be able to page an array of text in a gridField?

  Discussion posts and replies are publicly visible

  • Hi aaronp0001,

    I am able to convert a list of text string to a datasubset. Please find the sample code below,

    load(
      local!data: {
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine",
        "Ten",
        "Eleven",
        "Twelve"
      },
      local!gridPagingInfo: a!pagingInfo(
        1,
        10
      ),
      with(
        local!datasubset: todatasubset(
          local!data,
          local!gridPagingInfo
        ),
        a!gridField(
          totalCount: local!datasubset.totalCount,
          columns: {
            a!gridTextColumn(
              label: "Number",
              data: local!datasubset.data
            )
          },
          value: local!gridPagingInfo,
          saveInto: local!gridPagingInfo
        )
      )
    )

    What's the exact issue that you were facing!!? If you can share the code snippet, that would be helpful to debug!

     

    Thanks,

    Hema

  • Thanks Hema,

    My code looks very similar:
    with(
    local!datasubset: todatasubset(local!activeUnassignedPeople,local!unassignedPagingInfo),
    a!gridField(
    showWhen: local!showUnassignedUsers,
    value: local!unassignedPagingInfo,
    saveInto: local!unassignedPagingInfo,
    totalCount: local!datasubset.totalCount,
    columns: a!gridTextColumn(
    label: "",
    field: "userId",
    data: a!forEach(
    items: local!datasubset.data,
    expression: rule!LE2E_firstnameLastnameConcat(fv!item)
    ),
    links: a!forEach(
    items: local!datasubset.data,
    expression: a!recordLink(
    recordType: cons!LE2E_PERSON_RECORD_TYPE,
    identifier: fv!item
    )
    )
    )
    )
    )

    where local!activeUnassignedPeople is of type List of Text String

     

    The exact issue is that an error message pops up in the interface stating that the array local!activeUnassignedPeople is not a complex type

  • Hi,

    Can you provide whole code because array "local!activeUnassignedPeople" is not cleared what data it have?

    regards
    Abhay
  • Thanks for your reply Abhay, the code for local!activeUnassignedPeople doesn't make much sense without various sub-rules, but I have fixed it now. Casting the text to an array of CDTs did the trick.