I have Room (roomID column) and a Key (with keyID, roomID, and keyDescription columns) . A room can have multiple keys. I setup a one to many relationship between the Room and a Key using the roomID.
I used the Room record to populate a gridField. The search is not returning anything if I put an information that should match the keyDescription. I have the code below. I am only after for keys that are active which is one active key per room. Even if I remove the filter in the code, it does not return anything. Is this expected for a One to Many relationship?
{ a!gridField( data: a!recordData( recordType: <room_record>, relatedRecordData: a!relatedRecordData(relationship: '<roomRecord-keyRecord>', filters: { a!queryFilter( field: '<keyRecord.isActive>', operator: "=", value: true ) } ), columns: {
a!gridColumn( label: "Room ID", sortField: 'roomRecord.roomID', value: fv!row['roomRecord.roomID'], ),
a!gridColumn( label: "Key Description", sortField: 'roomRecord-keyRecord.keyDescription', value: fv!row['roomRecord-keyRecord.keyDescription'], ))}
Discussion posts and replies are publicly visible
I may be wrong, but the search only works on fields configured in the record object list, not the grid you make on interfaces. I suggest you look into the record object and see if your key description field is on that list.
Hi Joshua, thanks for the reply. Search should work even if the fields are not in the list. I have another app with Many to One relationship and search is returning the results of the related fields even if they were not included in the list defined in the record.
I tried your suggestion just to make sure. Still not finding a match.
Hi Vernon,
In the query filter can you try putting values like below
a!queryFilter( field: '<roomRecord.relationships.keyRecord.isActive>', operator: "=", value: true )
and if you want only specific related record data, please pass filters in
relatedRecordData: a!relatedRecordData(relationship: '<roomRecord-keyRecord>', filters:queryFilter())
Hope this helps
Thanks Virat. I dont have a problem with the query. My problem is with the search.
Your suggestion will generate an error. As documented in , it should be done this way
relatedRecordData: {
/*Only return related Employees that have a status of active*/
a!relatedRecordData(
relationship: recordType!Department.relationships.employee,
filters: {
a!queryFilter(
field: recordType!Employee.fields.status,
operator: "=",
value: "Active"
)
}
Hi please use the code box for inserting the code
Thanks for the tip Ujjwal.
Hi Vernon Pinawin, Can you please update if got any solution for this
you got any solution for this case , search not working for related records fields , it looks to me only the primary record type data getting the search results