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
I do not understand what exactly you mean with this. Can you help me?
shubhamy0005 said:count of the related record fields
In queryrecordtype, there is related record param which get the related record data. My query is to get the count of specific column coming from related record.
YOu can get that information from totalCount parameter setting fetchTotalCount =true
You might be able to achieve this by creating a custom record field getting the count and then using the same for your use case
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
The only way to do this AFAIK is to create a custom record field on the parent record.