Business Objective:
When Speakers apply to speak at one of our parishes, they supply documents to support their application to be a speaker. Many of Speaker will apply to speak year after year. There are three types of documents
Required documents are customized for each of the Speakers. For example, depending upon their country, there are different agencies that do background checks with their own forms and documents.
There are two areas (interfaces) where the documents are uploaded; the Speaker Interface (this is NOT a portal, as we give the speakers Appian login credentials) and the other is when they are applying for a specific event.
The speakers need to be able to assign those required documents and the optional documents when uploading the document in the appropriate interface.
Technical Setup:
I have a view in SQL that shows the Required Documents and the Optional Documents the speaker can upload. I have a Record Type that points to the CDT. The fields are:
The Expression Rule for the General Documents needs to show the Required General Document types and the Optional Document Types. My first attempt uses the a!queryLogicalExpression and works fine.
a!queryLogicalExpression( ignoreFiltersWithEmptyValues: true, operator: "AND", filters: { a!queryFilter( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.speakerId', operator: "=", value: ri!speakerId ), a!queryFilter( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.eventDocument', operator: "=", value: false ) } ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 50, sort: a!sortInfo( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.sortOrder', ascending: true()
However, this just shows the General Required Documents and not the Optional Documents. I tried to nest two queryLogicalExpressions withon one queryLogicalExpression the complete code is:
a!queryRecordType( recordType: 'recordType!PMSO VW Speaker Required DocTypes', fields: { 'recordType!PMSO VW Speaker Required DocTypes.fields.speakerId', 'recordType!PMSO VW Speaker Required DocTypes.fields.documentTypeId', 'recordType!PMSO VW Speaker Required DocTypes.fields.documentType', 'recordType!PMSO VW Speaker Required DocTypes.fields.eventDocument', 'recordType!PMSO VW Speaker Required DocTypes.fields.sortOrder' }, filters: a!queryLogicalExpression( ignoreFiltersWithEmptyValues: true, operator: "OR", filters: { a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.speakerId', operator: "=", value: 0 ), } ), a!queryLogicalExpression( ignoreFiltersWithEmptyValues: true, operator: "AND", filters: { a!queryFilter( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.speakerId', operator: "=", value: ri!speakerId ), a!queryFilter( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.eventDocument', operator: "=", value: false ) } ), } ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 50, sort: a!sortInfo( field: 'recordType!PMSO VW Speaker Required DocTypes.fields.sortOrder', ascending: true() ) ) ).data
This is throwing an error.
Expression evaluation error at function a!queryRecordType: Cannot apply a filter with a blank field name.
I checked the data and their are no nulls in the data.
All of the fields seems to be referenced correctly.
Any help would be most appreciated!!
Discussion posts and replies are publicly visible
As per the documentation (https://docs.appian.com/suite/help/24.4/fnc_system_a_querylogicalexpression.html) to nest logical expressions you would use the parameter "logicalExpressions" but not "filters".
The issue arises because the queryLogicalExpression cannot be used directly within the filters parameter of another queryLogicalExpression. The filters parameter only accepts a list of queryFilter objects. As a result, this causes the error. Refer to the screenshot below for clarification.you can use queryLogicalExpression in the filters parameter of queryRecordType but not in queryLogicalExpression.
queryLogicalExpression
filters
queryFilter
As Stefan mentioned, simply change "filters" to "logicalExpressions" (as highlighted below):
Thanks guys!!!!!