How to find first of in a datasubset?

A Score Level 2

Hello,

Is there a way to find the first of in a datasubset? For example I have a datasubset with 5 records. The 4th record has an id=null. If I pass in a datasubset and where id=null, it would return the index of 4. How would I approach creating an expression for this? Thanks

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi Miked,

    I hope this code will help you.

    load(
    local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    ),
    local!datasubset: todatasubset(
    {
    {
    id: 1,
    firstName: "A"
    },
    {
    id: 2,
    firstName: "B"
    },
    {
    id: 3,
    firstName: "C"
    },
    {
    id: null,
    firstName: "D"
    },
    {
    id: 5,
    firstName: "E"
    }
    },
    local!pagingInfo
    ),
    index(
    local!datasubset.data,
    wherecontains(
    tointeger(
    null()
    ),
    tointeger(
    local!datasubset.data.id
    )
    ),
    {}
    )
    )

Reply
  • 0
    Certified Lead Developer

    Hi Miked,

    I hope this code will help you.

    load(
    local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    ),
    local!datasubset: todatasubset(
    {
    {
    id: 1,
    firstName: "A"
    },
    {
    id: 2,
    firstName: "B"
    },
    {
    id: 3,
    firstName: "C"
    },
    {
    id: null,
    firstName: "D"
    },
    {
    id: 5,
    firstName: "E"
    }
    },
    local!pagingInfo
    ),
    index(
    local!datasubset.data,
    wherecontains(
    tointeger(
    null()
    ),
    tointeger(
    local!datasubset.data.id
    )
    ),
    {}
    )
    )

Children
No Data