I have a table in my app that is displaying all the shipping information from a table in my database. This morning I entered some new data through a form I had created and everything went fine until I got to the last record.
The last record I entered appeared twice in the app table. I went to the data to make sure it was not a double entry and it was not. It is only in the database once. The really strange thing is that whatever I do to one of the duplicated record happens to the other. I tried changing the shipping date in one and they both changed and then both showed up on that date.
It only seems to be happening for this one record. Does anyone have any idea what would be causing that?
Just a guess here: could it be that the joins you're making at a query level are returning two different rows for the same id??
You could see the state of your query for those two records and see if all the fields and nested values are equal or if there is one that is different and that could be producing this.
I think it is expected that changes made to one row change the other as they will both have the same primary id.
Actually it has happened again. As I have been going through the records in the shipping schedule table, I have noticed at least 3 records so far that show up twice. Again, they don't show up in the database twice, just the table view.
When I highlight one of the records, they both highlight. If I try to update a cell in one of the records, the cell in the other record also updates with the same value. It's like a ghost record because even though I can make changes to one of the records, it will not let me do anything with the other. If I delete one, they both delete. It's very strange and would definitely put this project in jeopardy.
Any help you could provide would be most appreciated.
I've seen the highlight behavior (two identical rows) happening whenever my data source has duplicates in the primary key and the highlighted rows have matching primary keys (which in itself shouldn't happen).
Any chance you're able to share the query that returns the data you are using as data source of your table? My uninformed guess is that you may be applying some joins that return two rows for the same id from the first table being fetched?
SELECT *
FROM shipping
LEFT JOIN pools_built ON shipping.serial_num = pools_built.sequence
WHERE ({{ !date79.value }} OR ship_date = {{ date79.value }})
ORDER BY ship_date, load_num, load_order, dealer
Ok, I don't know your data structure, but try making it an outer join, i.e.
SELECT *
FROM shipping
LEFT OUTER JOIN pools_built ON shipping.serial_num = pools_built.sequence
WHERE ({{ !date79.value }} OR ship_date = {{ date79.value }})
ORDER BY ship_date, load_num, load_order, dealer
@MiguelOrtiz, it worked! Some SQL programmer I am. I didn't even catch that. Thank you so much for your assistance. You've been a real life saver in this project.