Hi everyone,
I have seen 2 posts with same error but didn't find any solution that works for my case.
I have created a view, and a record type with data source is an expression rule that query data from the view. The rule will return me below data subset. When I check the record list, I can see data being presented without any error.
However, when I create a gridField based on my record type's data, I got this error. I checked and can verify that my data don't contain any duplicated row. Is there any other reason that I should look at?
Thank you,
Discussion posts and replies are publicly visible
hi mollyn126 could you please share the code snippet of your grid, I would help for better understanding. Is your primary key is Unique? Is your Primary Key accepts null Values?
Hello mollyn126
Please share the code snippet from the interface.
Here is the code for my interface grid:
a!gridField(label: "", labelPosition: "ABOVE", pageSize: local!selectedPageSize, data: 'recordType!Record', columns: { a!gridColumn( label: "Case Number", sortField: 'recordType!caseNumber', value: fv!row[recordType!caseNumber], align: "CENTER" ), a!gridColumn( label: "Case Number", sortField: 'recordType!caseNumber', value: fv!row[recordType!caseNumber], align: "CENTER" ), a!gridColumn( label: "Customer", sortField: 'recordType!Customer', value: fv!row[recordType!Customer], align: "CENTER" ), a!gridColumn( label: "Created Date", sortField: 'recordType!createdDate', value: fv!row[recordType!createdDate], align: "CENTER" ), a!gridColumn( label: "Completed Date", sortField: 'recordType!completedDate', value: fv!row[recordType!completedDate], align: "CENTER" )} )
And is the code for the query to view. I just fixed the error by changing totalCount to length(local!dataSubset.data) then the grid displayed all data without any error but I couldn't understand why...
a!localVariables( local!dataSubset: a!refreshVariable( refreshAlways: rule!GBL_replaceNull(nullableValue: ri!refreshAlways, replacementValue: false), refreshInterval: ri!refreshInterval, value:rule!AAA_CMN_General_queryEntityHelper( refreshAlways: rule!GBL_replaceNull(nullableValue: ri!refreshAlways, replacementValue: false), refreshInterval: ri!refreshInterval, fetchTotalCount: ri!fetchTotalCount, entity: cons!myView, columns: ri!columns, logicalExpression: a!queryLogicalExpression( ignoreFiltersWithEmptyValues: true, operator: if( rule!AAA_CMN_IsBlank( ri!filterOperation ), "AND", ri!filterOperation ), filters: append( { a!queryFilter( field: "caseId", operator: "in", value: ri!caseId ) }, ri!filters ), logicalExpressions: ri!logicalExpression ), pagingInfo: if( isnull( ri!pagingInfo ), a!pagingInfo( startIndex: 1, batchSize: -1, sort: { a!sortInfo( field: "caseId", ascending: true ) } ), ri!pagingInfo ) ) ), a!dataSubset( startIndex: local!datasubset.startIndex, batchSize: local!datasubset.batchSize, sort: ri!pagingInfo.sort, totalCount: length(local!datasubset.data), identifiers: local!datasubset.identifiers, data: fn!cast( fn!typeof( ri!cdt ), fn!property( local!dataSubset, "data", null ) ) ) )
is your primary key in your view is unique?
Yes I can confirm that
May I Know what was the previous code used for this one totalCount: length(local!datasubset.data),
you can check the column causing the issue ,and add null conditions for that .It could be that some of the filters are causing the result to be different from what you expect.
mollyn126 Now your grid working as expected?
Sorry for the delay in response! My grid worked right after changing totalCount to length(...). Originally it was totalCount: local!datasubset.totalCount,