Sort an array

Certified Associate Developer

how can i sort an Array?

  Discussion posts and replies are publicly visible

Parents
  • +1
    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
  • +1
    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