Skip to main content
ayusha9505
January 31, 2023
Question

Sort an array

  • January 31, 2023
  • 2 replies
  • 0 views

how can i sort an Array?

    2 replies

    ayusha3676
    January 31, 2023

    
    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)

    stefanhelzle0001
    January 31, 2023