App 'addRow' running then throwing an error

Hello! Firstly, I'm a materials engineer, not a programmer, but I'm learning my way through Retool so that I can build some apps for data collection in the lab. One such app is so techs can fill out a form and copy mass spectroscopy data into a cell, then submit this data to a database; right now I'm just trying to submit data to a table that acts as the database, until I transfer it to our intranet.

I've created this transformer to import the MS data:

And I've set up the form this way:

The two queries I've created to add and update the row look like this:


but have been getting this set of error codes:
error codes

and while it will add a row, it won't import the MS data, but I'm not getting an error regarding the transformer, primarily the 'addRow' query, having to do with assignment, but there is assignment!!

Any advice would be appreciate.

Thanks

Devin

@Tess could you assist on this?

Hello, in your key value pairs you are referring to the query itself with addRow.value?
image
image

When adding a new row that should be empty, do I need to refer to anything? My original thinking was that it should be prepared to receive a numerical value.

if you want to add a row that will be empty, configure your DB columns to accept null values and just call the query inserting a new record

or insert record with empty strings and 0 if null values is not an option (or default values)

Hello @dmcmillen ,

Are you still having trouble with this issue?

As @Skizhu mentioned, inserting an empty string or configuring the DB to accept Null/0 values would make sense.

-Brett

Hello Brett,

Yes* but I've made the suggested adjustments and am now encountering an issue when adding a row. I'm getting an error that says, "invalid input syntax for type double precision: ""," which a quick search suggests I'm trying to push more data than there are columns for? I've doublechecked at least that isn't the issue.

Any suggestions?

Devin

@brettp I've had a much better time with SQL than using the GUI...

The addRow query is now working without errors:

BUT I am having an issue with the updateRow query. I get a "syntax error at or near "="" thrown; is there a way to identify which, assuming the first? Is that the incorrect syntax for identifying the column value from a form?

Thanks for your input and best!

Devin

Hello @dmcmillen ,

Looking at the latest screenshots, I'd suggest more specific JS objects, for example in the {{form_textArea}} I would typically use a {{text.value}} to add into my key:value pairs.

This looks a bit off with all of these key:value pairs, and again when referencing select1 and select2, those objects are typically too general for this purpose and won't be SQL compatible.

Possibly try drilling down into more specific js objects to ensure you are exposing compatible strings for your UPDATE?

  • Brett

Hello @brettp ,

I wanted to make sure, even if I'm using a form in the screenshot below, I need to use more specific JS?

Best,

Devin

Hi @dmcmillen ,

From the screenshot, I would say yes - but it's a little bit difficult to tell exactly what your SQL Mode query looks like.....I would say you should specify the value - it seems as tho you are referencing the component text area which is assigned a Key, but what we really want are the value(s) in the new Row - at least that's what seems logical since it is a form.

For example, in your - in your new Row you want to add the values of the text input to "Initial Time", "Procedure", "Comments", etc. If I were to set this up, I would assign each text field or value input.value to the appropriate KEY:VALUE pair.

key = procedure : value = {{formText3.value}}
key = comments: value = {{formText4.value}}

and so on.....

  • Brett