Skip to main content
April 25, 2024
Question

AggregationFields and query filter how can in use together

  • April 25, 2024
  • 7 replies
  • 1 view

Hi!

I need help!!!

I want to use  a!aggregationFields  and filter together how can i get it

7 replies

srmm0001
April 25, 2024

Hi,

a!queryRecordType(
recordType: cons!YOUR_RECORD_TYPE,
fields: a!aggregationFields(
groupings: a!grouping(
field: "yourRecordTypeFields.fieldToGroup",
alias: "aliasForTheField"
)
),
filters: a!queryFilter(
field: "yourRecordTypeFields.fieldToFilter",
operator: "=",
value: "ValueToFilterBy"
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
)

konduruc733182
April 25, 2024

That should not be an issue, you can try the below code and update your values and check.

a!queryRecordType(
  recordType: "RecordType",
  fields: a!aggregationFields(
    groupings: a!grouping(
      field: "recordFieldToAggregateHere",
      alias: "xyz"
    )
  ),
  filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
      a!queryFilter(
        field: "fieldToFilter",
        operator: "=",
        value: true,
        
      )
    },
    ignoreFiltersWithEmptyValues: true
  ),
  pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100),
  fetchTotalCount: true,
  
),
cast(
  recordType,
  null
)

girlc0001Author
April 25, 2024

[mention:2df2892a4df7486f9775b4d2f0e405fd:e9ed411860ed4f2ba0265705b8793d05] 

Thank you for your help.

I have another question。
I want to display other fields after aggregationFields. Is it possible?


oredersid"O1000"(Text)
customerid"0123456"(Text)
caseid"02"(Text)
caseID"02"(Text)  ←  aggregationFields

konduruc733182
April 25, 2024

No. You can either use a!aggregationFields() or recordFields in the fields parameter. Both do not work parallelly.

shubhama926776
Brainy
April 25, 2024

Hello [mention:4187e9f2c0404e4aa25182e3f69c4c03:e9ed411860ed4f2ba0265705b8793d05] 
I would suggest you to go through this documentation to better understand all query recipes.

Query Recipes

शुभम्