I'm going through the Appian Developer's course, and am not able to get through "Build An Application: Step 6". I'm getting a "Invalid index: Cannot index property 'vehicleMake' of type Text into type RecordType]." Can't figure out where the bug's coming from since I'm just copying the code straight out of the exercise. Here's the code for the filter:
a!recordFilterList( name: "Make", options: a!forEach( items: local!vehicleMakes.data, expression: a!recordFilterListOption( id: fv!index, name: fv!item.make, filter: a!queryFilter( field: 'recordType!AE Vehicle'.vehicleMake, operator: "=", value: fv!item.make ), dataCount: fv!item.count ) )
Any ideas for why this is wrong?
Discussion posts and replies are publicly visible
Hi , in queryFilter configuration, you have not written correct value for parameter "field". Please check and try to use correct field name
What's wrong with it? Why is it causing this type mismatch error?
I used the prefix "AE" instead of "AX" throughout the duration of these exercises.
You are getting indexing error because it's not able to find field "vehicle make". Just try to retype this field.
Can you confirm if the whole field reference is combined together into a little tag or does the field name show after it in a different format? For context, here's what the correct and incorrect field references look like.
I made some changes to that "field:" but am still getting the same error
It's combining it into a tag. It shows as "AE Vehicle.vehicleMake" (all within the tag) which expands to "recordType!AE Vehicle.fields.vehicleMake" on hovering over. In both cases it doesn't show anything in a different format, though I have seen that before.
Can you also share what your local variable is doing? i don't see where it is initially defined in the expression above.
Hi Peter, thanks.
Here's the rest of the code, before the recordFilterList, and where the locals are defined:
a!localVariables( local!vehicleMakes: a!queryRecordType ( recordType: 'recordType!AE Vehicle', fields: a!aggregationFields( groupings: { a!grouping( Field: 'recordType!AE Vehicle.fields.vehicleMake', alias: "make" ) }, measures: { a!measure( field: 'recordType!AE Vehicle.fields.vehicleMake', function: "COUNT", alias: "count" ) } ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 5000 ) ),
Code looks ok, Just try to refer correct record type fields as Peter Lewis said.
Yeah I agree - this looks fine to me. Is it possible that the error is not in the user filter but in the grid or somewhere else? Often in cases like this I try to remove parts of the code / interface until it starts to work to identify what is causing the problem.
This was the problem. I had actually made this correction in the expression editor, but didn't "Save Changes" so Appian was still going back to the previous, incorrect version.
This is why those exercises are so insistent on hitting the "Save Changes" button regularly!