Help with Query Builder Syntax – Filtering Work Orders by Expired BUD Ticket
Use Case:
I’m trying to create a Cityworks Respond Query Builder query that filters work orders where:
- The Status is not "Cancel", "Closed", or "Complete".
- The BUD (Before You Dig) ticket is expired, which is stored in a custom field (not a UCF) called "BUD Expired Date". The query should compare "BUD Expired Date" with the current date (DaysFromNow(0, "ceil")).
I suspect the issue is with my syntax when trying to filter by the CustFieldValue in the custom field.
Non-Working Query:
WorkOrder( StatusDescription NOTIN ("Cancel", "Closed", "Complete") AND CustomFields( CustFieldName CONTAINS "BUD Expired Date" AND CustFieldValue <= DaysFromNow(0, "ceil") ) )
Additional Context:
- The "BUD Expired Date" field is a custom field (not a UCF).
- The field is formatted as a date.
- The issue only occurs when attempting to compare CustFieldValue to DaysFromNow(). This same structure works when comparing against fields in the WorkOrder table.
Questions:
- How can I properly compare CustFieldValue (BUD Expired Date) with the current date?
- Does Cityworks Query Builder require a different syntax for date comparisons within custom fields?
- Are there any known limitations when using DaysFromNow() with custom fields?
- Is there an alternative way to check if the "BUD Expired Date" has passed?
