I am getting this error "Cannot sort by field [teamMemberId] because it is from a one-to-many record relationship." when trying to apply sort field gridcoloumn
a!gridColumn( label: "Members", sortField:recordType!WFM RID.relationships.wfmRIDmember.fields.MemberId value: count( fv!row['recordType!WFM RID.relationships.wfmRIDmember.fields.MemberId'] )
Discussion posts and replies are publicly visible
The code you've shared doesn't logically work. First your value is a count of "MemberId", implying that the value shown on a given cell in the grid will be the total number of MemberIds associated with the "wfmRIDmember" on that row. I assume that would be fine, assuming that's what you want to be showing.
But then, what would sorting by "MemberId" even be expected to do? Each row of your grid has its own set of MemberIds, for one thing, so sorting on those is not meaningful, let alone not possible.
In this case it's probably best to just not add a sort field to the grid column. Not all columns require sortability.
So, is there any other way to sort the field having one to many relationships.
Mike gave a good answer to this question. Do you have a more specific question?
What Stefan said...
Do you have a use case? What would this sorting look like? Usually sorting is reserved for columns with a comprehensible and intuitive sorting methodology available (sorting text in alphanumeric order i.e.), but this doesn't end up making much sense for "one to many relationships" unless you mean something you can specify...
Hey Mike and Stefan, I have a use case where I need to sort a column which has one-to-many record relationship, the column is essentially a status column, which needs to be alphabetically sorted.
Kaushik Agrawal said:I have a use case where I need to sort a column which has one-to-many record relationship
What have you tried so far? What exactly isn't working?