Forum Discussion

AaronB's avatar
AaronB
Qrew Trainee
2 months ago

Can I use API_DoQuery to obtain the number of records in a different QB Table/App

Using a Formula-Numeric type, I'd like to grab the number of records that exist in another table that resides in another QB application.  Can this be done?

I thought I could run a query, then use the "Size()" function on what was returned but that is not working out so well.

Any suggestions?

------------------

var text QueryURL = URLRoot() & "<dbid>?a=API_DoQuery&query={3.GT.0}&apptoken=<apptoken>";

Size($QueryURL)

  • AaronB's avatar
    AaronB
    Qrew Trainee

    Update....I also tried the following code within the 'Formula-Numeric' field.  It did not give me an error like the previous attempt but it also just came up with the number '0' which is not correct.
    -----code below----

    var text QueryURL = URLRoot() & "<dbid>?a=API_DoQuery&query={3.GT.0}   &apptoken=<apptoken>";
    var recordlist RecList = GetRecords($QueryURL);

    Size($RecList)

    ---end code---

    Result (as seen in the form)