Hello all,
Just checking to see if anyone knows how to sort a grid's field when the data property is not a typical query. Please see code below for what I mean.
The grid displays as expected with values and all, but when trying to sort the fields I get the error in the Subject above. Are there any other ways to sort other than [recordType.field] or [recordType.relationship.field]?
I did see an earlier post solution on here with similar error, but that scenario was quite direct working with recordData for the data property of the grid. Any input regarding this particular scenario would be much appreciated. Thanks
a!gridField( label: "Grid for ", labelPosition: "COLLAPSED", emptyGridMessage: "No reports for this day", data: index(local!reportsPerDayOfLastSevenDays, local!selectedDay), columns: { a!gridColumn( label: cons!LABEL_NAME, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Rep Sched.fields.{f4d0c828-fe5b-4064-90b2-f12ce802e849}reportId', value: a!linkField( links: a!recordLink( label: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Rep Sched.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}lnurep.fields.{5c4a840d-3d2c-4bc9-9fb5-fc8041123628}reportName' ),
Discussion posts and replies are publicly visible
Hi, Can you confirm whether your doubt is regarding sorting the grid columns (as in line 9) or sorting the grid data (initial/secondary sorts)? I could see the SAIL error says the issue is on the line 120 which I think the issue might be with the grid initial/secondary sorts.
Also, can you share the entire code, full error message and the data source (i.e. what type of data does the local!reportsPerDayOfLastSevenDays hold?) to understand where the issue exactly persists?
a!localVariables( local!days: a!forEach( items: enumerate(8), expression: today() + fv!item ), local!selectedDay: 1, local!reports: a!refreshVariable( value: a!queryRecordType( recordType: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule', fields: { 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport', 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{7422ffe6-d719-4a0d-8521-bb51449996db}LNUReportScheduleStatus.fields.{ebe49277-109e-4e20-89bf-e54e8b44bf0c}name', 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.relationships.{0d9e5c18-853e-43eb-8175-62e3745ab7fb}LNUReportFrequency.fields.{c9a403e8-4fc7-4448-a7a6-4838f041b5cc}description', 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.relationships.{d498dd3d-c1db-45b6-badc-5fd9bd848b33}LNUTaskOrder' }, filters: { a!queryFilter( field: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{d01f51fe-816b-4d32-ab68-a98a39fd9f2a}isActive', operator: "=", value: true() ), a!queryFilter( field: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{6904f830-f63d-417e-b544-8f192e8a544a}dueDate', operator: "between", value: { local!days[1], local!days[length(local!days)] } ) }, pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000) ).data, refreshAfter: "RECORD_ACTION" ), local!sortedReports: a!forEach( items: local!days, expression: index( local!reports, wherecontains( fv!item, index( local!reports, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{6904f830-f63d-417e-b544-8f192e8a544a}dueDate' ) ) ) ), a!gridField( label: "Reports Grid", labelPosition: "COLLAPSED", emptyGridMessage: "No reports for", data: index(local!sortedReports, local!selectedDay), columns: { a!gridColumn( label: cons!LNU_TEXT_LABEL_NAME, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{f24b28f6-8f50-4aed-8f67-0b8c68620d11}reportId', value: a!linkField( links: a!recordLink( label: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{5c4a840d-3d2c-4bc9-9fb5-fc8041123628}reportName' ), recordType: 'recordType!{d2b9cdf5-1822-45bd-9c65-dc7ad9d8092b}LNU Report', identifier: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{f24b28f6-8f50-4aed-8f67-0b8c68620d11}reportId' ), dashboard: "summary" ) ) ), a!gridColumn( label: cons!LNU_TEXT_LABEL_FREQUENCY, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.relationships.{0d9e5c18-853e-43eb-8175-62e3745ab7fb}LNUReportFrequency.fields.{9ce8bd70-5158-494a-9c4b-4ef6eba91046}frequencyId', value: fv!row['recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.relationships.{0d9e5c18-853e-43eb-8175-62e3745ab7fb}LNUReportFrequency.fields.{c9a403e8-4fc7-4448-a7a6-4838f041b5cc}description'] ), a!gridColumn( label: cons!LNU_TEXT_LABEL_TASK_ORDER, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{b59f74b2-1ceb-40e6-bc33-4204a58b6722}taskOrderId', value: fv!row['recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.relationships.{d498dd3d-c1db-45b6-badc-5fd9bd848b33}LNUTaskOrder.fields.{70225f06-cb2a-4495-bf36-992f8239e894}name'] ), a!gridColumn( label: cons!LNU_TEXT_LABEL_ATTACHMENT_REQUIRED, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{fadd5987-ad8d-49b0-9dc9-3082d20599ad}attachmentRequired', value: if( fv!row['recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{fadd5987-ad8d-49b0-9dc9-3082d20599ad}attachmentRequired'], "Yes", "No" ) ), a!gridColumn( label: cons!LNU_TEXT_LABEL_LNU, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{5831b3bb-57fa-4198-9648-60ef5fa4a43f}isLNU', value: if( fv!row['recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{5afa58bb-0a4b-4f63-94f0-58116be2d973}LNUReport.fields.{5831b3bb-57fa-4198-9648-60ef5fa4a43f}isLNU'], "Yes", "No"), width: "NARROW" ), a!gridColumn( label: cons!LNU_TEXT_LABEL_STATUS, sortField: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{c0a7290f-9ab8-4da7-bebc-102713417de5}scheduleStatusId', value: a!richTextDisplayField( value: { a!richTextIcon( icon: a!match( value: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{c0a7290f-9ab8-4da7-bebc-102713417de5}scheduleStatusId' ), equals: cons!LNU_REPORT_SCHEDULE_STATUSES[1], then: "arrow-circle-right", equals: cons!LNU_REPORT_SCHEDULE_STATUSES[2], then: "check-circle", equals: cons!LNU_REPORT_SCHEDULE_STATUSES[3], then: "envelope", default: null ), caption: fv!row['recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.relationships.{7422ffe6-d719-4a0d-8521-bb51449996db}LNUReportScheduleStatus.fields.{ebe49277-109e-4e20-89bf-e54e8b44bf0c}name'], color: a!match( value: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{c0a7290f-9ab8-4da7-bebc-102713417de5}scheduleStatusId' ), equals: cons!LNU_REPORT_SCHEDULE_STATUSES[1], then: "#4a4a4a", equals: cons!LNU_REPORT_SCHEDULE_STATUSES[2], then: "POSITIVE", equals: cons!LNU_REPORT_SCHEDULE_STATUSES[3], then: "ACCENT", default: null ) ), } ), align: "CENTER", width: "NARROW" ), a!gridColumn( label: "Submit", value: a!recordActionField( actions: { a!recordActionItem( action: 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.actions.{b89f44e7-b4f2-4c75-a14f-662ca7cf6dd1}submitReport', identifier: index( fv!row, 'recordType!{8360b17d-94c9-478d-af7a-8e685ada463b}LNU Report Schedule.fields.{2f8eefae-de16-400e-9656-ade7d90314ce}scheduleId' ) ) }, display: "ICON" ), align: "CENTER", width: "NARROW" ), }, refreshAfter: "RECORD_ACTION" ) } )