Filtering using array and "not in" operator

I am trying to filter out some problematic records from an API request. Please could you help with the following code?

a!localVariables(
  /*
  * Run the "queryEntity()" function on "cons!TDW_CHANGE_REQ_DETAILS_DS" to retrieve data for the
  * first 50 data store entities and store this in a local variable named
  * "local!entities".
  */
  local!entities: a!queryEntity(
    entity: cons!TDW_CHANGE_REQ_DETAILS_DS,
    query: a!query(
      filters: {
        a!queryFilter(
        field: "schemeId",
        operator: "not in",
        value: (70011, 70012, 70019, 70306, 70317, 70326, 70328, 70359, 70752, 70924, 71086, 71241, 71243, 71245, 71247, 71249, 71251, 71257, 71262, 71263, 71266)
          )
        }
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: -1
      )
    fetchTotalCount: true
  ).data,

  /*
  * Construct an HTTP response that contains the information that we just stored
  * in "local!entities".
  */
  a!httpResponse(
    /*
    * Set an HTTP header that tells the client that the body of the response
    * will be JSON-encoded.
    */
    headers: {
      a!httpHeader(name: "Content-Type", value: "application/json")
    },
    /*
    * JSON-encode the value of "local!entities" and place it in the response body.
    */
    body: a!toJson(value: local!entities)
  )
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    What is the issue? What did you try? What are the results? What is the goal?

  • I too have the same question as Stefan. But if the problem is with the code, then this might help

    a!localVariables(
      /*
      * Run the "queryEntity()" function on "cons!TDW_CHANGE_REQ_DETAILS_DS" to retrieve data for the
      * first 50 data store entities and store this in a local variable named
      * "local!entities".
      */
      local!entities: a!queryEntity(
        entity: cons!TDW_CHANGE_REQ_DETAILS_DS,
        query: a!query(
          filter: a!queryFilter(
            field: "schemeId",
            operator: "not in",
            value: {
              70011,
              70012,
              70019,
              70306,
              70317,
              70326,
              70328,
              70359,
              70752,
              70924,
              71086,
              71241,
              71243,
              71245,
              71247,
              71249,
              71251,
              71257,
              71262,
              71263,
              71266
            }
          ),
          pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1)
        ),
        fetchTotalCount: true
      ).data,
      /*
      * Construct an HTTP response that contains the information that we just stored
      * in "local!entities".
      */
      a!httpResponse(
        /*
        * Set an HTTP header that tells the client that the body of the response
        * will be JSON-encoded.
        */
        headers: {
          a!httpHeader(
            name: "Content-Type",
            value: "application/json"
          )
        },
        /*
        * JSON-encode the value of "local!entities" and place it in the response body.
        */
        body: a!toJson(value: local!entities)
      )
    )

Reply
  • I too have the same question as Stefan. But if the problem is with the code, then this might help

    a!localVariables(
      /*
      * Run the "queryEntity()" function on "cons!TDW_CHANGE_REQ_DETAILS_DS" to retrieve data for the
      * first 50 data store entities and store this in a local variable named
      * "local!entities".
      */
      local!entities: a!queryEntity(
        entity: cons!TDW_CHANGE_REQ_DETAILS_DS,
        query: a!query(
          filter: a!queryFilter(
            field: "schemeId",
            operator: "not in",
            value: {
              70011,
              70012,
              70019,
              70306,
              70317,
              70326,
              70328,
              70359,
              70752,
              70924,
              71086,
              71241,
              71243,
              71245,
              71247,
              71249,
              71251,
              71257,
              71262,
              71263,
              71266
            }
          ),
          pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1)
        ),
        fetchTotalCount: true
      ).data,
      /*
      * Construct an HTTP response that contains the information that we just stored
      * in "local!entities".
      */
      a!httpResponse(
        /*
        * Set an HTTP header that tells the client that the body of the response
        * will be JSON-encoded.
        */
        headers: {
          a!httpHeader(
            name: "Content-Type",
            value: "application/json"
          )
        },
        /*
        * JSON-encode the value of "local!entities" and place it in the response body.
        */
        body: a!toJson(value: local!entities)
      )
    )

Children