If you want to view the results of a Query to a MySQL Database/Resource, you should be able to do this in the Query view panel. Next to the 'Save' button there is a 'Preview' and the results of the query will appear at the bottom of the query panel.
You can add in a console.log to the transform results box below the query inside the query panel as well.
Thank you for sharing the screenshot with the mark up!
I believe the error might be coming from the @ symbol you used to define and save the TTax variable.
Let me experiment around and see if there is a work around for saving that value without the @ symbol or if that is a bug which Retool needs to fix
I had not seen anyone use @ or := in SQL so I just learned that those are both valid and being used properly. In the transformer result, I see there is a red underline. If you hover your mouse over that, is it giving you the same error?
I also see on line 18 you set the variable TOTAL to be equal to @TTax, maybe you can console log that variable?
I might need to see the whole query or a boiled down version of the query to replicate it and test out how we can get that summation of tax to appear in a console log!
It looks like we should be able to view the variable you are creating from the results tab of the MySQL query.
Are you able to run the query and see in the output, under 'data' the @TTax variable?
From the Success query event at the bottom of the query, we can run a separate Javascript Query that console logs the variable from TaxFillTableInv.data to get @TTax to show up in the console!
The JS Query will have access to the 'TaxFillTableInv' and you can key into the .data property with something like TaxFillTableInv.data['@TTax']
I was poking around the forums and found this post you will want to do pretty much the same thing but instead of the Action being 'set to local storage' you would select 'Run Script' and console.log(TaxFillTableInv.data['@TTax']).
Let me know if that works!
I just tested it out, and the editor has a yellow line under the query name, on hover it says 'that query is undefined' but this is a false bug and it should work fine. As the query result and its data are created when the query runs!
Thanks for sharing that screenshot, it looks like we got part of the name but are missing the rest of the name and then it will work as intended!
In the output, it has @TTAX:=... we need to expand the ... to reveal the full name.
If you can share that screenshot we can get the full name, and add it into the console log so it will read console.log(TaxFillTableInv.data['@TTax:=fullName'])
The other way we can view this is in the query's state tab after you run it. Inside of the query's data field we can see the full column names which will show us '@TTax:=fullName' so we can add in the correct name to the console log.
My colleague Paulo shared a link with me to another post where he shows how to view a query's state. Check out his post and the screen shot here if you are unable to expand the output to see the full TTax column name.
Hope this helps and let me know if you have any further questions!
You might be correct, I don't think the value in the red circle is the key to the value you want to access and console log.
Is that screen shot from the query output? I believe that if you run the query and look inside the state tab and expand data we should be able to see the key we want.
Also, I just read over your previous message saying that the error you were getting was related to 'TaxFillTableInv'.
I am not sure if that is a 'false negative' error as sometimes the editor will say that the value doesn't exist UNTIL the query runs and then the data exists and is available to console log.
The other option, since you are running code in the success handler, is to try console.log(data['@TTax']) or potentially console.log(data.data['@TTax']) since this will limit the possibility of the 'false negative' message as 'data' is only created by the query once it runs
Give those a shot and let me know if either works. If not, let's take a look at the state tab as shown below in this screen shot