Using NODE.js with a MS SQL Server db, I had a server action that found a recordset. then copied that recordset over to another table. The found recordset has multiple rows, so I setup a repeat to loop through the records. It worked great up until this morning when I upgraded to 3.7.5, opened up my project and of course it updated all the files. Now, my repeat fails. My error is cannot insert NULL value which looks to be like the insert step is no longer being populated by the query.
I have not made any changes at all, this is the result of the updated files.
Also, are you sure your query returns data and are you sure you properly setup the repeat data in the insert step?
You can disable insert and add a set value step in the repeat, bind some data to it and check if it outputs any data.
My apologies, it is 3.7.6. 3.7.5 worked correctly.
Doing all that was my next step on troubleshooting. However, nothing on this site has changed in the past 2 months. over 600 records have been entered without fail until this morning, 2 min after I updated to 3.7.6. I opened up the site to add some html and found this issue, So, opened up the site, worked fine. Updated to latest version because I have not read of any major issues, logged back in and error.
Yes Teodor, that is correct. However what I’m trying to show you is if I disable the insert statement, it returns all the data that needs to be inserted. It is two identical tables, I’m just basically copying one table to another with a repeat statement. The insert fails after 3.7.6.
Please carefully check if this is correct, as it appears at least one of your records you are trying to insert is returning null for the value used in the AppointmentPurcahseOrderID in the insert step. And i cannot see this on your screenshot as i don't know what value is used there.
It returns every column of data with the insert turned off, there are NO nulls, see bellow…
The error is it cannot insert NULL into the column ‘AppointmentPurchaseOrderID’ but that is my PK, and the default value id newguid() so the database is inserting that value. I checked my insert statement it now reads this:
Although I never entered a value for AppointmentPurchaseOrderID because I knew it was pre-populated, but now it is populated.
I took that value out, and it now works properly. I DID NOT add that value, it was added with this update somehow. The last time I touched this server action is when I built it, and it was back when I had to enter the database in as a step:
I am not sure i understand you … you insert a value from one table into another, but you don’t want to insert it? Is it working now or not, as i really don’t think i understand what the issue is?
It is working now.
I will try to explain a little differently. I created this server action back in January and have not made any changes to it or the database.
I have a table of records that are copied from one table to the next for the user. I have the server action finding the records, then executing a repeat to insert those records into the other table. This has been working fine. Up until this morning.
I opened up the site to make some changes and went through everything and it all worked. I found what I needed to update. Then I went to Wappler, downloaded the update and looked around. I did not change anything. I forgot what I needed to change on the customers site so I went back into it and got the error. That is why I say the update caused the issue.
When I looked at the server action, it was failing because it said it couldn’t insert a null value into the table. I didn’t know if the results were being found so that’s when I disabled the insert statement and output the query statement. All records were found. No Nulls. I made the insert step active again and got the error. The error was the Primary Key column of the table I was inserting cannot be null. My database is setup so the primary key is a GUID that the server generates. I checked my insert statement and the Primary key was listed. I know I did not do that… I never add the primary key to an update or insert statement. I took the Primary Key out of the insert statement in Wappler and it worked fine.
What I’m trying to say is this update somehow added my primary key into the insert statement and had no value to insert, thus getting the error. I was also able to verify this by pulling up a backup and looking at it. I did not have the primary key in the insert statement. This version added it. I know it sounds crazy though.
Are you sure you have not just clicked the Refresh icon in the insert step and forgot about it? The update itself can’t cause this unless you open the insert UI and make some changes there.
I can tell you with 100% certainty I have never clicked that refresh button. On any insert action, on any project. I don’t even know what it does.
I do find it odd that this has happened, but I did not change it.
It’s ok, everything it working correctly now that I changed it back but I should not have had to do that.