Here I want to get the most visited top 3 destinations and the count of journeys on each location.(relationship between 2 tables) So make an expression rule for that. but I need to do with record type with the use of a custom record field, here i found the custom expression rule, anyone guide me on how to use this code with a custom expression rule in record type? code below here
a!localVariables( local!data:a!queryRecordType( recordType: 'recordType!{64a0e01d-65e7-493d-8373-98dd241cb809}VS Journey', fields: a!aggregationFields( groupings: { a!grouping( field: 'recordType!{64a0e01d-65e7-493d-8373-98dd241cb809}VS Journey.relationships.{324614a4-84f3-45b4-bce2-95cbc8b65b6d}vsDestination.fields.{dbe0e7f1-b3d7-456b-9d82-e81a9042d256}name', alias: "name_grouping1" ) }, measures: { a!measure( function: "COUNT", field: 'recordType!{64a0e01d-65e7-493d-8373-98dd241cb809}VS Journey.fields.{1209585a-f527-4ad9-b1fc-cc7ccc5dd973}destinationId', alias: "destinationId_count_measure1" ) } ), filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{64a0e01d-65e7-493d-8373-98dd241cb809}VS Journey.fields.{75d3137b-b408-4bcb-8c31-ac2fd13e123a}customerId', operator: "=", value: 4 ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: a!defaultValue(value: 3, default: cons!VPA_DEFAULT_BATCH_SIZE), sort: { a!sortInfo( field: "destinationId_count_measure1" ) } ) ), /*cast(194,local!data.data)*/ if( ri!returnDataSubset, local!data, if( local!data.totalCount > 1, cast(194,local!data.data), index(local!data,1,null) ) ), )
Discussion posts and replies are publicly visible
I am not sure I understand your use case. Do you somehow want to use this code to calculate a custom record field?
I want this result using the record type. How to do it?
Sorry, but I do not understand your ask. You already use Records and a!queryRecordType.
I want this result within the record type using this
Result:
I hope you understand
I want to make a chart using this result
This is why I asked for the custom record field.
I am not sure whether this kind of aggregation can be done in a custom record field, never tried that. But I also do not see how that would help you to create a chart. Why not just use your existing expression to populate that chart?
Okay, So please any guidance to create a chart using expression rule
Please check this recipe: docs.appian.com/.../recipe-aggregate-data-and-display-in-a-chart.html
Thank you @Stefan Helzle