Berenice Domínguez
11/27/2023, 1:22 PMerictgrubaugh
11/27/2023, 2:35 PMconst lateEntriesSearch = s.create({
type: s.Type.TIME_BILL,
filters: [
[`formulanumeric: ${daysElapsedFormula}`, s.Operator.GREATERTHAN, 7]
],
columns: [
'employee',
'date',
'datecreated',
{
name: 'formulanumeric',
formula: daysElapsedFormula
}
]
})
You could retrieve the formula column like so:
result.getValue({ name: 'formulanumeric' })
erictgrubaugh
11/27/2023, 2:36 PMformulanumeric
columns, you have to be a bit more creativeBerenice Domínguez
11/27/2023, 2:44 PMsearch.createColumn({
name: "formulanumeric",
summary: "MAX",
formula: "{netamount} ",
label: "Net Amount"
})
Berenice Domínguez
11/27/2023, 2:52 PMvalues: {
"MAX(formulanumeric)": "1198.5"
}
erictgrubaugh
11/27/2023, 2:59 PMSummary
on your Column, so you need to retrieve it using getValue
with the Summary
specified as well. In general, you retrieve a Column value by calling getValue
with the same parameters as you called createColumn
. In this case,
result.getValue({ name: 'formulanumeric', summary: s.Summary.MAX })
Berenice Domínguez
11/27/2023, 3:14 PMBerenice Domínguez
11/27/2023, 3:15 PMerictgrubaugh
11/27/2023, 3:15 PMSearch
moduleBerenice Domínguez
11/27/2023, 3:15 PMerictgrubaugh
11/27/2023, 3:15 PMsummary
optionsBerenice Domínguez
11/27/2023, 3:15 PMerictgrubaugh
11/27/2023, 3:17 PMBerenice Domínguez
11/27/2023, 3:25 PMerictgrubaugh
11/27/2023, 3:28 PMtoJSON()
method like so:
const results = lateEntriesSearch.run().getRange({ start: 0, end: 1000 })
const lateEntries = results.map(resultToObject)
function resultToObject (result) {
const res = result.toJSON()
console.log(res)
return {
employeeName: result.getText({ name: 'employee' }),
daysElapsed: res.values.formulanumeric,
daysElapsedNoRound: res.values.formulanumeric_1
}
}
erictgrubaugh
11/27/2023, 3:28 PMconsole.log
with the log
module if this is server-sideerictgrubaugh
11/27/2023, 3:28 PMBerenice Domínguez
11/27/2023, 3:30 PMBerenice Domínguez
11/27/2023, 3:30 PMerictgrubaugh
11/27/2023, 3:34 PMsearch
module had a method similar to the query
module's asMappedResults()
Berenice Domínguez
11/27/2023, 3:35 PM