Accessing objects in data

Hi

I added a query and now i'm trying to get data from that query using another query
specifically, I'm trying to avoid calling my data each time I want to run the queries, and instead reach the data once

Once I do that, I get a parce error so I assume that I did something terribly wrong in the process.
Can I override that? is that good practice anyway or should I keep on running queries directly from my DB?

I assume you are using Query JSON with SQL - I prefer it since it saves a trip back to the db...
Try wrapping PaymentsDump.data in
formatDataAsArray()
like
{{formatDataAsArray(PaymentsDump.data)}} or use formatDataAsObject() in the same way - because it will depend on the PaymentsDump.data structure

You can also save your data from a query using temporaryState or query caching to avoid making requests to your DB multiple times!

If you're NOT using 'Query JSON with SQL' here as Scott mentioned, then you may be running into a situation with prepared statements. By default, all of our SQL queries are converted to prepared statements to prevent SQL injection, meaning that table/database names and SQL functions aren't able to be defined using a string created dynamically. The main reason we currently convert all statements into prepared statements, is so that users can't enter malicious syntax (like DROP TABLE) into the variable fields.

You can disable this setting in the resource setup, but keep in mind the potential of submitting dangerous SQL through any of the variables referenced in a query. Disabling prepared statements can also break other existing queries. If that's something you'd like to explore, I often recommend setting up another copy of a resource with that setting enabled to help limit the surface area that you have to keep in mind SQL injection for.

Hope this helps!