How Can I Debug Formulas?

How Can I Debug Formulas?


You can use debug mode to understand how formulas are applied to a sample transaction or sample payee. You will see how each formula statement was evaluated against your sample transaction or user (payee).

Debugging Formulas - Sample Transaction
To enable transaction debugging:
  1. Select "Transactions > All Transactions"
  2. Find your transaction
  3. Click on the transaction
  4. Type ALT-Q or copy everything after the last slash from the URL 


Other ways to find transaction IDs: 
  • Open your transaction and click on the "Metadata" tab > System ID
  • Export credits from a calculation > System ID

Next, edit your plan to enable debugging:
  1. Edit your plan
  2. Go to the "Calculations" tab (if needed)
  3. Paste your transaction ID to the "Debug Record ID" field 
  4. Save your plan

Next, re-run your calculation. When you open your calculation, you should see a "Debug" tab with evaluation details. If you do not see a Debug tab, this means that your transaction wasn't processed by the calculation (ex: its date is outside your calculation's range, or does not match your plan's filter).



Debugging Formulas - Sample Payee
To enable user debugging:
  1. Select "Users > All Users"
  2. Find your user
  3. Click on the user
  4. Copy everything after the last slash from the URL





Next, edit your plan to enable debugging:
  1. Edit your plan
  2. Go to the "Calculations" tab (if needed)
  3. Paste your user ID to the "Debug Record ID" field 
  4. Save your plan

Next, re-run your calculation. When you open your calculation, you should see a "Debug" tab with evaluation details. If you do not see a Debug tab, this means that no reward formula was activated with this user as a payee (ex: this payee was not eligible for a payout).



Debugging Formulas - Log Statement
Finally, you can log specific statements using the Log() function.

In the example below, logging only occurs if revenue is over 1000. Due to parallel processing, log statements may be intermixed, and therefore should provide sufficient context.