Skip to main content
New Participant
Oct 2, 2025 2:09 PM UTC

I need to lookup Inspections by the data contained in the answer to 2 questions. I cannot get the syntax correct.

There can be multiple inspections that contain the same answer to QuestionID 524 but only 1 should match both 524 and 525. I'm trying to do this with a Respond Query to learn how to do it with the API. I need to get the InspectionID from the results to programmatically update the inspection with some new data.

Something Like below but that works:

Inspection(InspTemplateId = 10 , Questions(QuestionId = 524 AND Answer = Contains("1506"), AND Questions(QuestionId = 525 AND Answer = Contains("1230")))

    9 replies

    Known Participant
    Oct 2, 2025 4:13 PM UTC

    @steve pickens? Run the query in Respond with your browser developer tools, and you'll see the underlying General/Query/Query API call and response to know the proper syntax to use.

    Translate
    New Participant
    Oct 2, 2025 4:13 PM UTC

    @steve pickens? Run the query in Respond with your browser developer tools, and you'll see the underlying General/Query/Query API call and response to know the proper syntax to use.

    The query I sent will not run. It gets invalid or too advanced when I try to add the 2nd question. I do not know how to add the 2nd question and answer to require both fields to match. Get Outlook for iOS
    Translate
    Known Participant
    Oct 2, 2025 4:13 PM UTC
    The query I sent will not run. It gets invalid or too advanced when I try to add the 2nd question. I do not know how to add the 2nd question and answer to require both fields to match. Get Outlook for iOS

    @steve pickens? My bad. I just realized you are primarily trying to figure out the query syntax in the advanced query editor vs. the underlying API syntax. Once you have the correct query syntax, getting the API syntax will be easy. I haven't played around with the query editor much, as my queries were straightforward and I could do everything I needed with the UI options and let it automatically generate the query syntax I needed.

    Translate
    New Participant
    Oct 2, 2025 4:13 PM UTC

    I figured it out. Just needed to add a closing ) before the comma separating the 2 Questions.

    Inspection(InspTemplateId = 10 AND Status = Contains("Complete"), Questions(QuestionId = 524 AND Answer = Contains("510")), Questions(QuestionId = 525 AND Answer = Contains("1768")))

    Translate
    Known Participant
    Oct 2, 2025 4:13 PM UTC

    I figured it out. Just needed to add a closing ) before the comma separating the 2 Questions.

    Inspection(InspTemplateId = 10 AND Status = Contains("Complete"), Questions(QuestionId = 524 AND Answer = Contains("510")), Questions(QuestionId = 525 AND Answer = Contains("1768")))

    Nice! Now you can check the browser developer tools for the API syntax

    Translate
    New Participant
    Oct 2, 2025 4:13 PM UTC

    One more.

    I'm using CW 15.8.9 with EDGE but cannot find the Payload tab. Can you help?

    Translate
    New Participant
    Oct 2, 2025 4:13 PM UTC

    Nice! Now you can check the browser developer tools for the API syntax

    I got the query working but I’m still having to write Visual Studio code using 15.8.9 and I cannot find the download for the latest Cityworks.Core or the Sandbox. We are getting ready to upgrade to Cityworks 23 but we are not there yet. Where can I get the download I need? Steve
    Translate
    Known Participant
    Oct 2, 2025 4:13 PM UTC

    Nice! Now you can check the browser developer tools for the API syntax

    Here are the latest 23.12 Core and OC download pages

     

    • https://cityworks.my.site.com/s/article/Cityworks23-12Download
    • https://cityworks.my.site.com/s/article/CityworksOfficeCompanion23-12Download
    Translate
    Known Participant
    Oct 2, 2025 4:13 PM UTC

    One more.

    I'm using CW 15.8.9 with EDGE but cannot find the Payload tab. Can you help?

    I normally don't use Edge, but the Payload tab is in the same relative place for me as it is in Chrome under Network next to Headers and Response, as shown below. I'm using Respond 5.9 in a Cityworks 23.11 site.

     

    "EdgeDeveloperTools"

    Translate