I have a table that tracks costs incurred at different dates and I’m trying to make a report with the script block that lets the user select a week number witch will then show only show the costs incurred in that week.
I have formular field on my view that converts the date to a week number.
I tried to filter a RecordQueryResult
let weekSelector=[]
for (let record of costQuery.records){
let week = record.getCellValueAsString(costWeekField)
let personId = record.getCellValue(costStaffField)[0].id
if(!weekSelector.some(obj => {obj.getCellValueAsString(costWeekField) === week})){
weekSelector.push(record)
}
}
let weekSelect = await input.recordAsync('Choose a week', weekSelector)
However that does not work, as the primary field does not show my costWeekField.
I tried to make just an array of week numbers, and put into.recordAsync, but as it’s not a record it does not work either.
Is there a way to make a list based off a field in my table. Fx all unique week names from a certain field and let the user select from one those?