Sandii
07/09/2021, 4:31 PMsearch.run()
and search.runPaged()
return different results? I have a pretty simple searchDefinition on a custom record, and the runPaged()
is returning no results and .run()
is returning 1 (as expected).Sandii
07/09/2021, 4:37 PMlet searchDef = {
type: "customrecord_rp_forecast_detail",
filters: [
[
"custrecord_rp_fd_forecast",
"anyof",
"1"
],
"AND",
[
"custrecord_rp_fd_item",
"anyof",
[
"2827"
]
],
"AND",
[
"custrecord_rp_fd_location",
"anyof",
[
"3"
]
],
"AND",
[
"custrecord_rp_fd_week_beginning",
"within",
"7/10/2021",
"10/7/2021"
]
],
columns: [
{
name: "custrecord_rp_fd_item",
join: null,
summary: "GROUP",
label: null,
type: null,
function: null,
formula: null,
sortdir: "NONE",
whenorderedby: null,
whenorderedbyjoin: null,
whenorderedbyalias: null
},
{
name: "custrecord_rp_fd_location",
join: null,
summary: "GROUP",
label: null,
type: null,
function: null,
formula: null,
sortdir: "NONE",
whenorderedby: null,
whenorderedbyjoin: null,
whenorderedbyalias: null
},
{
name: "formulanumeric",
join: null,
summary: "SUM",
label: null,
type: null,
function: null,
formula: "{custrecord_rp_fd_demand}/90",
sortdir: "NONE",
whenorderedby: null,
whenorderedbyjoin: null,
whenorderedbyalias: null
}
],
title: "Forecasted Demand"
}
If I run with run()
it gives me a single result as expected
search.create(searchDef).run().getRange(0,1000)[0].getAllValues();
{GROUP(custrecord_rp_fd_item): Array(1), GROUP(custrecord_rp_fd_location): Array(1), SUM(formulanumeric): ".777777777777777777777777777777777777778"}
If I run with runPaged()
it gives me nothing
search.create(searchDef).runPaged({pageSize: 1000}).fetch({index: 0}).data
[]
Sandii
07/09/2021, 4:39 PMrun()
and runPaged()
give me the same expected result. I assume I have stumbled onto some weird NS bug with dates in criteria.David B
07/11/2021, 10:03 PMrun()
and runPaged()
are interpreting the dates as either DD/MM/YYYY
or MM/DD/YYYY
Check out this: https://stackoverflow.com/a/66892420. That answer is using format.format(…)
Sandii
07/12/2021, 2:02 PMN/format
so I completely avoid using it.David B
07/12/2021, 9:07 PM