I have heard there is a syntax for copying variables onto the screen to assist with debugging.
I have looked up "Copy Console" and found nothing.
If anyone is familiar with this syntax, I would be pleased to hear from you.
Mike
I have heard there is a syntax for copying variables onto the screen to assist with debugging.
I have looked up "Copy Console" and found nothing.
If anyone is familiar with this syntax, I would be pleased to hear from you.
Mike
Hi @mdsmith1 are you referring to showing something onto the screen like notification? Like this below using utils.showNotification()
Milan:
I don't think this is it.
Suppose you run a count on something and you would like to display the value in development mode so you can see if your code is working.
That's what I am looking for.
Mike
Hi @mdsmith1, the most common way to do this is using console.log(variableName.value)
within JS queries. If you expand on what we're debugging, we can help with what may be best route to take.
Paulo:
I have tried the code below in Javascript.
localStorage.setValue ('mCCNT1', table1.selectedRow.data.NEXTRA2);
console.log(mCCNT1.value);
I know the value of mCCNT1 = 3 but I do not see any display of this value.
Mike
You need to log the value in the MCCNT1 key of localStorage: console.log(localStorage.values.mCCNT1);
John:
I am writing to you by email because I can’t seem to get to the Retool web site.
I have tried your suggestion but I don’t see the variable. What exactly am I supposed to see?
Mike
localStorage
is a global object The localStorage object | Retool Docs
You can see the value(s) of the localStorage variable in the console:
I don't believe there is anywhere in the UI where you can "see" it (unlike other variables) aside from in the "State" tab of the debug panel.
Go to the debug panel in the lower right corner:
Find Local Storage under the "State" tab in Globals:
John:
Yes, I am familiar with the debug button and accessing local storage. I can do that without coding in about console.log.
I have now learned how to go to the Console Tab after clicking on the Debug button. This seems to tell me the value generated by the code but it seems the same as localStorage.
So I can't see the value of including the console.log code.
Mike
Your original question asked about showing variable values and you mentioned the console; that's what console.log()
does. These console.log()
statements are used in debugging to send outputs from key steps in a process to the console which you can look at once the code has executed. You can have many console.log()
statements in a single script to output any many key values as you like while the process runs.
Perhaps you could explain a bit more about what you mean by "copying variables onto the screen"
John:
Its OK, I think I have it figured out.
Its not necessary to copy the variables onto the screen.
As I understand it, if I develop something like a count, I can use the Console Log code to copy the count variable to the console file. I can then use the Debug Button and go to the Console Tab to see what the code developed.
This is fine for me.
I did not understand these steps and now I do, so thank you very much. I will mark your last entry as a solution.
Thanks again.
Mike