Problem with a sail report

Hello,
I have a problem with a sail report. This is my sail code
=load(
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 20,
sort: a!sortInfo(
field: "buttonDelete",
ascending: true
)
),
a!dashboardLayout(
firstColumnContents: {
a!sectionLayout(
label: "Close Request",
firstColumnContents: {
with(
local!datasubset: queryrecord(
cons!ApacRequestMobileReport,
a!query(
selection: a!querySelection(columns: {
a!queryColumn(field: "ApacRequestMobile.ID", alias: "ID"),
a!queryColumn(field: "ApacRequestMobile.Name", alias: "Requestor"),
a!queryColumn(field: "ApacRequestMobile.LeaveCode", alias: "LeaveType"),
a!queryColumn(field: "ApacRequestMobile.ApplyDate", alias: "ApplyDate"),
a!queryColumn(field: "ApacRequestMobile.FromDate", alias: "FromDate"),
a!queryColumn(field: "ApacRequestMobile.FromTime", alias: "...

OriginalPostID-134572

OriginalPostID-134572

  Discussion posts and replies are publicly visible

  • ...FromTime"),
    a!queryColumn(field: "ApacRequestMobile.ToDate", alias: "ToDate"),
    a!queryColumn(field: "ApacRequestMobile.Totime", alias: "ToTime"),
    a!queryColumn(field: "ApacRequestMobile.Reason", alias: "Reason"),
    a!queryColumn(field: "ApacRequestMobile.Status", alias: "Status"),
    a!queryColumn(field: "ApacRequestMobile.ApprovedDate", alias: "ApprovalDate"),
    a!queryColumn(field: "ApacRequestMobile.ApprovedBy", alias: "ApprovedBy"),
    a!queryColumn(field: "ligtRequest", alias: "lightRequest"),
    a!queryColumn(field: "lightManager", alias: "lightManager")
    }),
    filter: a!queryFilter(
    field: "lightManager",
    operator: "<",
    value: 2
    ),
    pagingInfo: local!pagingInfo
    )
    ),
    a!gridField(
    totalCount: local!datasubset.totalCount,
    columns: {
    a!gridTextColumn(
    label: "Request",
    field: "ID",
    ...
  • ... data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ID", null))
    ),
    a!gridTextColumn(
    label: "Requestor",
    field: "Requestor",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "Requestor", null))
    ),
    a!gridTextColumn(
    label: "Leave Type",
    field: "LeaveType",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "LeaveType", null))
    ),
    a!gridTextColumn(
    label: "Apply Date",
    field: "ApplyDate",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ApplyDate", null))
    ),
    a!gridTextColumn(
    label: "From Date",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "FromDate", null))
    ),
    a!gridTextColumn(
    label: "From Time",
    field: "FromTime",
    data: ...
  • ... if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "FromTime", null))
    ),
    a!gridTextColumn(
    label: "To Date",
    field: "ToDate",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ToDate", null))
    ),
    a!gridTextColumn(
    label: "To Time",
    field: "ToTime",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ToTime", null))
    ),
    a!gridTextColumn(
    label: "Reason",
    field: "Reason",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "Reason", null))
    ),
    a!gridTextColumn(
    label: "Status",
    field: "Status",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "Status", null))
    ),
    a!gridTextColumn(
    label: "Approval Date",
    field: "ApprovalDate",
    data: if(loca...
  • ... l!datasubset.totalCount=0,{""},index(local!datasubset.data, "ApprovalDate", null))
    ),
    a!gridTextColumn(
    label: "Approved By",
    field: "ApprovedBy",
    data: if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ApprovedBy", null))
    ),
    a!gridImageColumn(
    label: "Request",
    field: "lightRequest",
    size: "ICON",
    data: if(local!datasubset.totalCount=0,null(),apply(a!documentImage, apply(rule!testColor2,if(local!datasubset.totalCount=0,{0},index(local!datasubset.data, "lightRequest", null))),null,null,null))
    ),
    a!gridImageColumn(
    label: "Manager Approval",
    field: "lightManager",
    size: "ICON",
    data: if(local!datasubset.totalCount=0,null(),apply(a!documentImage, apply(rule!testColor2,if(local!datasubset.totalCount=0,{0},index(local!datasubset.data, "lightManager", null))),null,null,null))
    )
    },
    ...
  • ... value: local!pagingInfo,
    saveInto: local!pagingInfo
    )
    )
    }
    )
    }
    )
    )

    if the begging i change the filter filter: a!queryFilter(field: "lightManager", operator: "<", value: 2) with the filter filter: a!queryFilter(field: "lightManager", operator: ">=", value: 2) the report doesn't work and this is the error message "Interface Definition: Expression evaluation error at function a!dashboardLayout [line 10]: A grid component [label=“”] has an invalid value for “totalCount”. “totalCount” must not be null or less than the number of items in any of the “data” arrays, but “totalCount” was 0 and the largest column data array had 1 items."

    someone can help me please
  • It would be good if you share with the community the solution you found to this issue, this will definitely help others.
  • Yes, the problem is that i forget to add the following condition in the totalCount field of the a!gridField:
    totalCount: if(local!datasubset.totalCount=0,1,local!datasubset.totalCount),
    If you don't add this condition sail generate an error when there is no record of the filter. It's very important to add a similar condition, if(local!datasubset.totalCount=0,{""},index(local!datasubset.data, "ID", null)), in every data field of your a!gridTextColumn. Obviosuly "ID" is a variabile of my process and you have to substitute it with the name of your variable