interface filter based on process start date time - error: Interface Definition: Expression evaluation error at function 'index' parameter 3 [line 55]: Invalid index: Cannot index property 'MilestoneSchedule' of type Text into type List of

I have a process backed record with grid list and added start time related user filter in the record and it works fine. But when i build the interface with the date filter - Anytime, Last 24 Hours, Last 7 days, Last 30 days, last 365 days, it gives me the below error for all values except for Any Time option.

Interface Definition: Expression evaluation error at function 'index' parameter 3 [line 55]: Invalid index: Cannot index property 'MilestoneSchedule' of type Text into type List of Variant.

Interface Code is below:

=============================================

load(
local!daysFilterLabels: { "Any Time", "Last 24 Hours", "Last 7 Days", "Last 30 Days","Last 365 Days" },
local!daysFilterValues: {-1,0,1,2,3},
local!selectedDaysFilter: -1,
local!showprocesstime: -1,
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 20,
sort: a!sortInfo(
field: "pp.startTime",
descending: true
)
),
with(
local!datasubset: queryrecord(
cons!MP_MY_ACTIVE_MILESTONE_SCHEDULES_RECORD,
a!query(
selection: a!querySelection(columns: {
a!queryColumn(field: "MilestoneSchedule.ReqNumber"),
a!queryColumn(field: "MilestoneSchedule.RFPNumber"),
a!queryColumn(field: "MilestoneSchedule.AwardType"),
a!queryColumn(field: "MilestoneSchedule.ProgramOffice"),
a!queryColumn(field: "MilestoneSchedule.ContractingOfficer"),
a!queryColumn(field: "MilestoneSchedule.ProjMSStartDate"),
a!queryColumn(field: "MilestoneSchedule.ProjMSEndDate"),
a!queryColumn(field: "MilestoneSchedule.ActMSStartDate"),
a!queryColumn(field: "MilestoneSchedule.Title"),
a!queryColumn(field: "pp.startTime"),
}),
filter: /*if(local!selectedDaysFilter=-1,null,null),*/
if(local!selectedDaysFilter=-1,null,
if(local!selectedDaysFilter=0,a!queryFilter(field: "pp.startTime", operator: ">=", value: fn!todatetime(fn!today()-1)),
if(local!selectedDaysFilter=1,a!queryFilter(field: "pp.startTime", operator: ">=", value: fn!todatetime(fn!today()-7)),
if(local!selectedDaysFilter=2,a!queryFilter(field: "pp.startTime", operator: ">=", value: fn!todatetime(fn!today()-30)),
if(local!selectedDaysFilter=3,a!queryFilter(field: "pp.startTime", operator: ">=", value: fn!todatetime(fn!today()-365)),null))))
),
pagingInfo: local!pagingInfo
)
),
a!sectionLayout(
contents:{
a!dropdownField(
label:"Started",
choiceLabels: local!daysFilterLabels,
choiceValues: local!daysFilterValues,
value: local!selectedDaysFilter,
saveInto: local!selectedDaysFilter
),
a!gridField(
totalCount: local!datasubset.totalCount,
columns: {
a!gridTextColumn(
label: "PR Number",
field: "MilestoneSchedule.ReqNumber",
data: index(local!datasubset.data.MilestoneSchedule, "ReqNumber", null),
links: a!forEach(
items: local!datasubset,
expression: rule!MP_GenerateProcessDashboardLInk(fv!identifier)
)
),
a!gridTextColumn(
label: "Process Start Time",
field: "pp.startTime",
data: index(local!datasubset.data.pp, "startTime", null),
showWhen: local!showprocesstime <> -1
),
a!gridTextColumn(
label: "Solicitation/Other",
field: "MilestoneSchedule.RFPNumber",
data: index(local!datasubset.data.MilestoneSchedule, "RFPNumber", null)
),
a!gridTextColumn(
label: "Type",
field: "MilestoneSchedule.AwardType",
data: index(local!datasubset.data.MilestoneSchedule, "AwardType", null)
),
a!gridTextColumn(
label: "Division/Office",
field: "MilestoneSchedule.ProgramOffice",
data: index(local!datasubset.data.MilestoneSchedule, "ProgramOffice", null)
),
a!gridTextColumn(
label: "Contracting Officer",
field: "MilestoneSchedule.ContractingOfficer",
data: index(local!datasubset.data.MilestoneSchedule, "ContractingOfficer", null)
),
a!gridTextColumn(
label: "Projected Start Date",
field: "MilestoneSchedule.ProjMSStartDate",
data: index(local!datasubset.data.MilestoneSchedule, "ProjMSStartDate", null)
),
a!gridTextColumn(
label: "Projected End Date",
field: "MilestoneSchedule.ProjMSEndDate",
data: index(local!datasubset.data.MilestoneSchedule, "ProjMSEndDate", null)
),
a!gridTextColumn(
label: "Actual Start Date",
field: "MilestoneSchedule.ActMSStartDate",
data: index(local!datasubset.data.MilestoneSchedule, "ActMSStartDate", null)
),
a!gridTextColumn(
label: "Title",
field: "MilestoneSchedule.Title",
data: index(local!datasubset.data.MilestoneSchedule, "Title", null)
)
},
value: local!pagingInfo,
saveInto: local!pagingInfo
)
}
)
)
)

========================================================

Any help is appreciated. Thanks!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    The error message you're getting implies to me, simply, that no ".MilestoneSchedule" is being returned when doing the selected query.

    In case you're still stuck on this (or anyone else with similar issues in the future): my standard advice while troubleshooting paging grids like this, is to disable the grid temporarily (i.e. comment it out or other methods), and in its place put an a!paragraphField() with its Value set to local!dataSubset -- then no matter which query you do, you'll see the result (or lack of one) there.  When doing this, keep in mind that your grid configuration requires there to *always* be a value for local!dataSubset.data.MilestoneSchedule, lest it throw an error message.

    Also, you should use {} instead of "null" in your column definitions, and I strongly encourage you to use property() instead of index() when fetching a CDT property (rather than an array index).   IE your final column for "Title" would have a data parameter that looks more like this:

    data: property(local!datasubset.data.MilestoneSchedule, "Title", {})

Reply
  • 0
    Certified Lead Developer

    The error message you're getting implies to me, simply, that no ".MilestoneSchedule" is being returned when doing the selected query.

    In case you're still stuck on this (or anyone else with similar issues in the future): my standard advice while troubleshooting paging grids like this, is to disable the grid temporarily (i.e. comment it out or other methods), and in its place put an a!paragraphField() with its Value set to local!dataSubset -- then no matter which query you do, you'll see the result (or lack of one) there.  When doing this, keep in mind that your grid configuration requires there to *always* be a value for local!dataSubset.data.MilestoneSchedule, lest it throw an error message.

    Also, you should use {} instead of "null" in your column definitions, and I strongly encourage you to use property() instead of index() when fetching a CDT property (rather than an array index).   IE your final column for "Title" would have a data parameter that looks more like this:

    data: property(local!datasubset.data.MilestoneSchedule, "Title", {})

Children
No Data