Transformer Not Working

I am a database person so my SQL knowledge is fairly strong but my Java...not so much. I am trying to take data from a SQL script and use it as the value for a text field...I have not found a direct way to do this, and if there is an easier way, it would be much appreciated, but I think I found a work-around...based on the documentation, this should work, but it keeps giving me an error.

Basically, I put my SQL data into a table (only one row), and then I created a transformer to pull the specific value I wanted. My transformer is called CurrentAccess, and the code is:

return {{ table1.selectedRow.description }}

The preview is giving me the information I want, so I saved it. Then I created a Text component and set the value to:

{{ CurrentAccess.value }}

All the documentation I can find tells me that this should work but I keep getting this error:

ReferenceError: CurrentAccess is not defined

Does anyone have any idea what I am doing wrong?

Unless there are some additional, unmentioned needs in your project for the transformer, Its not needed. Just put {{ table1.selectedRow.description }} for your text components value.

Otherwise if you do need the transformer,

var description = {{ table1.selectedRow.description }}
return description

Hi @dndgeek2005 - welcome to the community!

Looks like there is no need to create table1 component. You can just create the text field component and use the data from your database query to fill the default value.

This way the ininial value for your text field would be like this:

{{ formatDataAsArray([0].column_name}}
Click to see example screenshot

Hope this helps!

Thank you! That did fix this issue!

Thank you! That was exactly what I was looking for but just couldn't figure out. I was adding several more layers of work for the app to go through than was necessary.

Great @dndgeek2005 I’m happy you fixed that!

Can you mark one of the posts as a Solution? This way other people looking for similar problems could find the solution more easily