Hi All I am trying to design a generic rule which will take recordtype. filter fields and filter values and filter operators and final filed as inputs and it should give result of that final field after ruining the query Record and applying the aggregation.It is working if the filter are single or multiple and all filter operators are "=","<>","<",">" but not when filters are multiple and operators are mix of in ,= or not in,= .here is the code i have used.
a!localVariables( local!filterFields: { recordFields }, local!filterValues: { a!update(a!map(), "1", { 21, 27 }), true() }, local!filterOperators: { "in", "=" }, index( a!queryRecordType( recordType: recordName, fields: finalOutputField, filters: a!queryLogicalExpression( operator: "AND", filters: a!forEach( items: { local!filterFields }, expression: a!queryFilter( field: fv!item, operator: local!filterOperators[fv!index], value: if( contains( { "in", "not in" }, local!filterOperators[fv!index][1] ), a!localVariables( local!indexData: local!filterValues[fv!index][1], if( a!isNullOrEmpty(local!indexData), local!filterValues[touniformstring(fv!index)][1], local!indexData ) ), local!filterValues[fv!index] ) ) ), ignoreFiltersWithEmptyValues: true ), fetchTotalCount: true(), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 0) ), "totalCount", {} ) )
Discussion posts and replies are publicly visible
Hello Ramesh Palati I understand your requirement but having a hard time to understand the expression at the filters. But coming to your error it must be related to the type mismatch while casting your record type. This implementation can fail at any point if any slight mismatch of input occurs. So, I would recommend using different expressions for querying individual record type.