Error when using Labkey.Query.insertRows with a null value for server managed key. | Anthony Corbett | 2013-01-24 08:55 | |||||||||||||||||||||||||||
Status: Closed | |||||||||||||||||||||||||||||
As part of upgrading our Labkey server from 12.2 to 12.3, I was doing some testing on my javascript code that used LABKEY.Query.insertRow() and I'm seeing behavior differences for a single use case. In some of our clinical studies there are datasets which have multiple rows per ParticipantVisit and therefore need a third composite key. In the instances where we don't have a pre-defined number of rows (as in using a list for a lookup to restrict the value of the composite keys) or care about using a date along with the ParticipantId and SeqNum we tend to use a Labkey managed auto-incrementing int column called 'id'. When I execute the following insert command, where the managed key is sent with a null value, I receive an error response from the server: LABKEY.Query.insertRows({ schemaName: 'study', queryName: 'Current Medications', rows: [ { id: null, frequency: '2xdaily', ParticipantId: 'AP002', SequenceNum: 99, dose: '85mg', medication: 'asprin' } ] }); Error: Could not convert '2xdaily' for field SequenceNum, should be of type BigDecimal I'm not sure why it is trying to use a completely different field value for SequenceNum? This exact code worked on 12.2. I did further testing on 12.3 and if I leave out the managed key and null value from the row's JSON it inserts fine. Also, I tried going to the grid view then to insert new to try the Labkey generated form to insert new data. And this works fine. I think the Labkey managed key should be ignored during an insertRows() operation (maybe ignored if null and an error if it is populated?); certainly it should NOT be mixing up the SequenceNum value... |
|||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||