a!querylogicalExpression

I have a query entity where i am passing date column AA to fetch some info from table. Now based on Source,i need to use different date columns.
Example: For Source A i have to pass column DateAAAA, for source BB pass DateBBB etc.

I dont find a way to pass the source here. Like if source is A,then do this ... 

a!queryFilter(
field: "dateFilterXXXX",
operator: ">=",
value: gmt(
todatetime(
workday(
local(now(), "America/New_York"),
-10,
ri!holidays
) & " " & totime("16:00 PM")
)
)
),

else....

a!queryFilter(
field: "dateFilterBBBB",
operator: ">=",
value: gmt(
todatetime(
workday(
local(now(), "America/New_York"),
-10,
ri!holidays
) & " " & totime("16:00 PM")
)
)
),

I am not passing parameters from any other place into this rule, so i dont find a way to pass the source. I need to get the source first and then define filters accordingly.

Please suggest on how i can get the source from entity and then pass filters here. I tried to querycolumn for source but unable to notate it or index it anywhere.

 

a!queryEntity(
  entity: cons!TABLE_NAME,
  query: a!query(
    selection: a!querySelection(
      columns: {
        a!queryColumn(field: "id"),
        a!queryColumn(field: "type"),
        a!queryColumn(field: "source").....
      }
    ),
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "fieldAAAA",
          operator: "<>",
          value: "AAAA"
        ),
        a!queryFilter(
          field: "fieldBBB",
          operator: "<>",
          value: "BBBB"
        ),
        
        a!queryFilter(
          field: "dateFilterXXXX",
          operator: ">=",
          value: gmt(
            todatetime(
              workday(
                local(now(), "America/New_York"),
                -10,
                ri!holidays
              ) & " " & totime("16:00 PM")
            )
          )
        )
      },
      logicalExpressions: {
        a!queryLogicalExpression(
          operator: "OR",
          logicalExpressions: {
            a!forEach(
              items: ri!dailyPriorityCriteria,
              expression: {
                a!queryLogicalExpression(
                  operator: "AND",
                  filters: {
                    a!queryFilter(
                      field: "type",
                      operator: if(
                        rule!APN_isEmpty(fv!item.type),
                        "is null",
                        "="
                      ),
                      value: fv!item.type
                    ),
                    a!queryFilter(
                      field: "status",
                      operator: "=",
                      value: fv!item.status
                    ),                    
                    a!queryFilter(
                      field: "priority",
                      operator: "<",
                      value: ""
                    )
                  }
                )/*END AND*/

              }
            )/*END FOR EACH*/

          }
        )/*END OR*/

      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: cons!FAS_MAX_CASES_TO_INCREASE_PRIORITY
    )
  ),
  fetchTotalCount: false
).data

  Discussion posts and replies are publicly visible

Parents Reply Children