Filter data between filter of two dates

a!localVariables(
  local!date: todatetime(ri!startTime, ri!endTime),
  local!pId: a!queryEntity(
    entity:cons!DS_DATA,
    query:
    a!query(
      selection:
        a!querySelection(
          columns: {
            a!queryColumn(
              field:"pId",
              alias:"pId"
            )
          }
        ),
      logicalExpression: {
        a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field:"startTime",
              operator: ">=",
              value : local!date
            ),
            a!queryFilter(
              field:"endTime",
              operator: "<=",
              value : local!date
            ),
            
          }
        )
      },
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: -1
      )
    ),
    fetchTotalCount: true
  ).data,

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to R5127

    Changed a little bit. Can you try out this and check if this is what you are looking for

    a!localVariables(
      local!data: a!queryEntity(
        entity:cons!DS_DATA,
        query: a!query(
          logicalExpression: {
            a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field:"startTime",
                  operator: ">=",
                  value : todatetime(ri!startDate),
                  applyWhen: a!isNotNullOrEmpty(ri!startDate)
                ),
                a!queryFilter(
                  field:"endtime",
                  operator: "<=",
                  value : todatetime(ri!startDate),
                  applyWhen: a!isNotNullOrEmpty(ri!startDate)
                ),
    
              }
            )
          },
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: -1
          )
        ),
        fetchTotalCount: true
      ).data,
      index(
        local!data,
        "pId",
        null
      )
    )

Children