Hello I need help with the format of final result:
{ a!localVariables( local!data: a!queryRecordType( recordType: 'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}BWP Clients', fields: {'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}BWP Clients.fields.{f759f435-fee5-4c98-8bd8-dc9c00f703a5}companyName'}, pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100) ).data., local!resut: a!forEach( items: local!data, expression: fv!item ), local!resut ) }
The result of this execution is:
List of BWP Clients - 45 items
What I need as result of this is just a simple list with company Names
comanyName: "Company1"
companyName "Space"
any help will be appreciated.
Discussion posts and replies are publicly visible
You will want to utilize the property() function in your a!forEach, to return only the companyName field. Such as below (update on line 11):
{ a!localVariables( local!data: a!queryRecordType( recordType: 'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}', fields: {'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}.fields.{f759f435-fee5-4c98-8bd8-dc9c00f703a5}'}, pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100) ).data., local!resut: a!forEach( items: local!data, expression: property(fv!item,"companyName",null) ), local!resut ) }
Hello Chris, I have tried similar approach but the returned result is the null value, for all results.
okay I have figured it out!
{ a!localVariables( local!data: a!queryRecordType( recordType: 'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}BWP Clients', fields: {'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}BWP Clients.fields.{f759f435-fee5-4c98-8bd8-dc9c00f703a5}companyName'}, pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100) ).data, local!resut: a!forEach( items: local!data, expression: property(fv!item,'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}BWP Clients.fields.{f759f435-fee5-4c98-8bd8-dc9c00f703a5}companyName', null()) ), local!resut ) }https://community.appian.com/tinymce/apis/embeddables/configure?typeId=dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2&id=undefined#
Yes, sorry, beat me to it! The "companyName" in my property example should be instead recordType!record.fields.companyName, as you noted.
Another method to achieve your list would be with a!grouping() as well:
property( a!queryRecordType( recordType: 'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}', fields: a!aggregationFields( groupings: a!grouping( field: 'recordType!{4e239f9b-3c32-4a2d-9080-0a76750fe5eb}.fields.{f759f435-fee5-4c98-8bd8-dc9c00f703a5}', alias: "companyName" ) ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100) ).data, "companyName", null )
this solution seems to be more efective and inteligent, no need to foreach the results.