Hi All,
Can anyone please help me how to get the count of the related record fields from queryRecordType in appian.
Discussion posts and replies are publicly visible
Hi shubhamy0005 I don't completely understand whatt are you trying to achieve, but I will give you an answer based on what I understood.
Example:
Main record - Vehicle
Related record - Maintenance
Output - Total maintenance records related to a single vehicle with vehicle ID "1", you can work with this code to achieve what you may desire
a!queryRecordType( recordType: 'recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095}AA Vehicle', fields: a!aggregationFields( measures: { a!measure( function: "COUNT", field: 'recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095}AA Vehicle.relationships.{7f130d4d-d0c7-477e-a98b-41a8119d8411}maintenance.fields.{02dee6e9-599c-4cc6-970a-49dd8d9e7e17}vehicleId', alias: "totalMaintenance" ) } ), filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{99b0bb09-e2c0-4f75-a70b-26f247e2d095}AA Vehicle.fields.{0d5995ff-5e2d-40ad-8ce7-1dc2ebe91919}vehicleId', operator: "=", value: 1 ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 100 ) ).data