Extract Data from API_DoQueryCount for use in Exact Form

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Hello! I have a question about using API_DoQueryCount within an Exact Form.

I have an Exact Form set up that contains a line like this:

~=qdb.GetURL("xxxxxxxxx","API_DoQueryCount^query={'180'.EX.'"+ field["Record ID#"]+"'}");~

This drops the full XML output of the API_DoQueryCount into the form, which ends up looking like this:

<qdbapi>

<action>API_DoQueryCount</action>

<errcode>0</errcode>

<errtext>No error</errtext>

<nummatches>86</nummatches>

</qdbapi>


Now that's pretty good, but I really just want that 86 there in that <nummatches> tag. How do I go about extracting it? I suspect this may be a javascript question more than anything else, but since I know so little JS and wouldn't know where to start, I'm hoping someone here could point me in the right direction.
Thank you!
Photo of Shaun Grey

Shaun Grey

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Keith

Keith, Champion

  • 1,146 Points 1k badge 2x thumb
if field 180 is the reference field of a relationship then why not just edit the relationship and add a summary field to count the # of related records?  Then you just reference that field in the Exact Form instead of using that query above.  Seems like a simple answer unless field 180 if not part of a relationship.

help for creating summary fields....http://www.quickbase.com/user-assistance/Default.html#create_summary_field.html
Photo of Shaun Grey

Shaun Grey

  • 0 Points
The query I posted is a simplified version of what I'm actually doing. What's REALLY going on is I've got a few dozen queries, each of which looks more like this:

~=qdb.GetURL("bkcdf9d9s","API_DoQueryCount^query={'180'.EX.'"+ field["Record ID#"]+"'}AND{'194'.XEX.''}AND{'243'.EX.'1'}");~

I realize I could probably make summary fields for all those queries as well, but it just seems nicer to me to be able to use API_DoQueryCount, if possible, so I don't have to worry about accidentally linking up the wrong Summary Field with the wrong Exact Form.
Photo of Keith

Keith, Champion

  • 1,146 Points 1k badge 2x thumb
OK but the benefit of using the summary fields is if you need to display those counts on a form or in some other reports you can.  Also, if you ever change the filtering criteria you only need to change it in the summary field and NOT in the Exact Form. Lets say you have multiple Exact Forms using that same query, if you embed that in the Exact Forms themselves you'd have to change them all if the filtering changes.  In a summary field you change it once and all Exact Forms are good to go as well as any reports form etc.