Sort an array

Certified Senior Developer

how can i sort an Array?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    if(
      rule!GBL_isNull(
        ri!arrayValues
      ),
      {},
      reject(fn!isnull(_),a!flatten(
        todatasubset(
          a!forEach(
            items: ri!arrayValues,
            expression: {
              value: fv!item
            }
          ),
          a!pagingInfo(
            1,
            - 1,
            a!sortInfo(
              field: "value",
              ascending: or(
                ri!ascending
              )
            )
          )
        ).data.value
      ))
    )

    Here you have two create two rule inputs.
    1.arrayValues(Any Type)
    2.ascending(Boolean)

Reply
  • 0
    Certified Associate Developer

    if(
      rule!GBL_isNull(
        ri!arrayValues
      ),
      {},
      reject(fn!isnull(_),a!flatten(
        todatasubset(
          a!forEach(
            items: ri!arrayValues,
            expression: {
              value: fv!item
            }
          ),
          a!pagingInfo(
            1,
            - 1,
            a!sortInfo(
              field: "value",
              ascending: or(
                ri!ascending
              )
            )
          )
        ).data.value
      ))
    )

    Here you have two create two rule inputs.
    1.arrayValues(Any Type)
    2.ascending(Boolean)

Children