Forum Discussion

TrishWehrle's avatar
TrishWehrle
Qrew Cadet
4 months ago

Total grandchild records in a grandparent with drill down

I have three tables, Audits>Questions>Nonconformities

Audits have multiple questions

Questions have multiple nonconformities

I'd like to display the # of nonconformities related to the audit on the audit table without creating a new relationship between audits and nonconformities. I've got this accomplished currently just doing a summary field from nonconformities to questions and then questions to audits but had to disable drill down since clicking it only took you to the 'parent' question table. 

Is there a rich text formula that could show # of nonconformities related to an audit with drill down that would go to the 'child' nonconformities table?

2 Replies

  • Yes there is!

    This code is not tested so let me know if there are any syntax errors.

    You probably have a field on questions called [Related Audit], so look that up down to Questions but don't call it [Related Audit] because it isn't directly related, so call it what it is,  which is [Record ID# of Audit]

    Then create an <ask the user> report on the nonconformities table, which will ask the user for the [Record ID# of the Audit].   so the filter is where 

    [Record ID# of Audit] is <ask the user>

    If you run the report manually and answer the question you will observe a suffix of

    &nv=1&v0=123. (assuming you input 123 as the [Record ID# of Audit].  so we just need a URL formula that will mimic that URL

    It will be a Rich Text field type

    var text Words = ToText([# of non-conformaties]); // insert correct field  for # of non-conformnaties

    var text URL = URLRoot() & "db/" & [_DBID_NON_CONFORMITIES] & "?a=q&qid=10&nv=1&v0=" & [Record ID#];

    // translated it into English that URL says to is go to my realm and then go to the table of nonconformities and the action I want to do is to run a query (which when Quickbase was invented just meant a report), and the report number to run is number 10 (you will adjust this to your report#) and the number of values that the ask the user questions will ask for is just one (nv=1) and the answer to the question 0 (Quickbase sometimes likes starting to count at zero instead of 1) is the Record ID# I'm sitting on (since that is the value that gets looked up down to questions and gets looked up again down to nonconformities).

    // insert the correct DBID from the Advanced Settings for the non-conformities table.

    // insert the correct report# where the 10 is.

    // finally, here is the syntax for the hyperlink

    "<a href=" & $URL & ">" & $Words & "</a>"