Trouble Adding Record to Table

I have a Reports table with several fields. The first field is a GUID called ReportsKey, and it is defined to generate automatically:

When I run my application and bring up the SetupReports form and click the + to add a record, the ReportsKey field on the form doesn’t yet have a value. When I type in other field values and hit save, I get the following:
image

This doesn’t seem to happen with other forms I add records to.
Also, if I open a query window and type in:
INSERT INTO Reports (ReportTitle) VALUES (‘Member List’), I get a similar error message.

In my experience with MySQL, if there is an auto-generated key field, it just generates itself. Why is this not working? Other similar forms work fine.

Thanks…

Hello,

Would you like to send through your application and I can take a look. There may be a slight difference between that form and other forms you have been which may be causing the issue,

Thanks,
Riley.

Thanks Riley,

Here is the FDF file for this application. For some reason the SetupReports form doesn’t let me add a new report because the ReportsKey is missing. Shouldn’t it automatically show up once I hit the + key to add a report?

BrandeisConejo-20240916-001806208580307.fdf (5.9 MB)

Hello,

Just to be sure, are you talking about the form that comes when you press ‘Setup’ then ‘Setup Reports’.

Within this form, when I press the ‘+’ button, enter the report title (leaving the Reports Key Field blank), and then press the save button, it adds the report fine without any errors.

Also in regard to the INSERT statement, when inserting a record into a table, you must also specify the primary key, this can be done using ‘five.uuid()’ in which returns randomly generate unique identifier.

Below is an example of how the uuid works:

INSERT INTO Reports (ReportsKey, ReportTitle) VALUES (five.uuid(), ‘Member List’)

Thanks,
Riley.

Hi Riley,

Thanks for the reply. In the Setup > Setup Reports menu choice, I click the + sign that is above the list on the left-hand side of the screen, right?

When I click this, a blank form appears on the right. As you mentioned, both fields are blank I type some title, for example Member List, and click the save button. Here is the result:

I just did this after reading your answer, and just before making this reply. Why do you think this causes an error on my browser, and not on yours? I am working in the beta testing / developer environment that Jo setup for me. It should work the same as yours, right?

Also, thanks for clarifying how to add a record in code. This is unexpected, since my experience with SQL indicates you should not include an auto-number field when doing a SQL INSERT statement, and it will just generate itself. I guess even though the table design specifies auto-generate for that field, it doesn’t work the way an auto-number field does. Thanks again…

When I use your suggestion to add a record from the query menu, I get the following error:

I choose Queries from the Data menu, then click +, then type the SQL code into the SQL window, then click the Run button.
Can you please advise what I’m doing wrong?

Hello,

five.uuid() is a JavaScript Function within Five so you are unable to use it within the SQL query, however, you can add a placeholder value, ‘?’, and then create a parameter within the query in which uses five.uuid() in order to input it into the query.

I hope this helps,
Please let me know if any more issues arise,

Thanks,
Riley.