Forum Discussion

JeffPatrick1's avatar
JeffPatrick1
Qrew Member
3 years ago

Formula Query

Constructing a Formula Query to auto-number payments that are part of the same Stripe Subscription. All of the payment records are in the Trans.Donations table. 

[Stripe Subscription ID] is the identifier for the subscription. So, we first want all of the Trans.Donations records that are part of the same subscription. [Stripe Subscription ID] is field 96.

Nextt, we want to find the records that are AFTER the current Trans.Donations record. This uses the field which is field 24.

This is the definition in the Formula Numeric Field on the Trans.Donations table:

var text QUERY = "{96.EX.'"&[Stripe Subscription ID]&"'}AND{24.AF.'"&&"'}";

Size(GetRecords($QUERY))+1)

I'm getting an error on the first statement (the var definition). The error is indicated at the end of the statement, and the error is "Expecting number"

Where is my syntax incorrect?

------------------------------
Jeff
------------------------------

2 Replies

  • When I save the formula I get the error --

    Formula syntax error

    A formula cannot end with an assignment to a variable declaration.


    var text QUERY = "{96.EX.'"&[Stripe Subscription ID]&"'}AND{24.AF.'"&&"'}";


    ------------------------------
    Jeff Patrick
    ------------------------------
  • can you try

    Size(GetRecords($QUERY))+1

    OR simply

    Size(
    GetRecords
    ("{96.EX.'"&[Stripe Subscription ID]&"'}AND{24.AF.'"&&"'}
    ")
    )+1


    ------------------------------
    Prashant Maheshwari
    ------------------------------