- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 05, 2022 02:36 AM
Hey here,
I’m tring to find the second to the max value of a array, but i can’t find any functions like Large in Excel.
Is there any way to implement this function?
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 05, 2022 06:43 AM
I’m not sure how you could do it with a formula field but in an automation you could use
function secondLast(array) {
return array.at(array.length - 2)
}
secondLast(yourArray)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 05, 2022 07:39 AM
Thanks! And i have tried to deal with it by using some js scripts :grinning_face_with_smiling_eyes:
`let mainTable = base.getTable(“list”);
let mainTableRecords = await mainTable.selectRecordsAsync({fields:[“volume”,“cal”]});
let mainTableSum =await mainTable.selectRecordsAsync({fields:[“cal”]});
for (let record of mainTableRecords.records) {
let recordget= record.getCellValue(“volume”);
if(recordget===null){}
else{
var sumval= recordget[0]+recordget[1];
await mainTable.updateRecordAsync(record, {
"cal": sumval
})
};
}
`