I'm trying to do a classic left join of a table which I created via CSV upload against:
- another table created via csv upload (mapping table) and 2) a query that I created, Query JSON w SQL, to put the results of an API into a table on the canvas. API is current prices from coingecko using the markets endpoint.
- message:"syntax error at or near "$1""
Problem is I cannot figure out the syntax for the life of me. It's something with the 2nd LEFT JOIN on the CurrentPrices query (or API)... I am currently trying to join on the query which formats the API, but not sure if I should instead be .
1.) I've tried changing the Resource type from default "Retool Database" to "Query JSON w SQL", wondering if changing that was required to join on the query which puts the API into a table. I am not sure if I am supposed to join on the query that puts the API into a table or the API query itself. If the latter, I assumed I would need to formatdataasarray, which I've tried and couldn't get to work either.
2.) For some reason the editor wants Portfolio in parenthesis. After importing csv to create table, I added a column and set the default value. I am joining on this field. Maybe it's not the correct way, but I got it work in Access and haven't messed with it.
3.) Tried to use return.data in the Transformer. I'm not really sure how or when to use this...
4.) I am new to javascript. I know my around with jet sql, m, and vba.
Table 1 - Transactions
Table 2 - Trx Type mapping (used to map trx_type on table 1)
Table 3 - Current Prices from CoinGecko (Query JSON w/ SQL query in table on canvas)
What is wrong with this? Any help would be appreciated.
SELECT
t_trxtypemapping.trx_type,t_transactions.timestamp,t_transactions.description,t_transactions.asset as token,t_transactions.quantity,t_transactions.quantityt_transactions.spot_price as histvalue,'USD' as FeeCurr,t_transactions.fees,(t_transactions.quantityt_transactions.spot_price) + t_transactions.fees as cost, t_transactions."Portfolio"
FROM
(t_transactions
LEFT JOIN t_trxtypemapping ON (t_transactions."Portfolio" = t_trxTypeMapping.portfolio) AND (t_transactions.trx_type = t_trxTypeMapping.trx_type_source))
LEFT JOIN {{qCurrPrices.data)}} as qCurrPrices ON qCurrPrices.Symbol =t_transactions.asset
WHERE ({{!trxtypeFilter.value}} OR t_trxtypemapping.trx_type iLIKE {{'%' + trxtypeFilter.value + '%'}})
ORDER BY token, timestamp DESC