Troubleshooting Advanced Query Filter
Hello, This is my first time reaching out for some help on hear so apologies if this is a bit long. I have a pipeline set up in quickbase to stamp an unqiue PO Number to a purchase order after final approval occurs. The PO numbers are set up as [Location Code]-[Order Department]-Date Approved in YYYYMMDD format-[Occurrence]
For each order approved in the same day with the same Location Code and Department the occurrence will increment by 1. Right now the pipeline stamps the first PO of a given location/department/day correctly with an occurrence of 1. My trouble is getting the search step (d) to find the previous matching POs from that day, lookup the latest ones occurence #, and add 1 to it. I have copied below the filter I put on my search step (d). This references the info from step c which is a lookup of the current PO that needs stamped.
[Location Code] (Field 25) is type Formula - Text
[Order Department] (Field 21) is type text but is a lookup field
[Ap Date Approved] (Field 16) is type Date/Time
Field 39 is type Date
[Occurrence] is type Numeric
{
"from": "bvur62pw9",
"where": "{'25'.CT.'{{c.location_code}}'} AND {'21'.CT.'{{c.order_department}}'} AND {'39'.EX.'{{time.now|date_ymd}}'} AND {'16'.BF.'{{c.ap_date_approved}}'}",
"sortBy": [
{
"fieldId": 40,
"order": "DESC"
}
],
"options": {
"top": 1
}
}