Hi Folks, I'd appreciate any help.
I am trying to insert the changed data from an interactive grid. The grid includes the species, animal, location, tissue, collection date, and processing date columns as shown below.
The data is being saved to two different tables. The first insert statement works fine. The second statement inserts ok but has an issue. When it inserts it appears to be going through all the changed rows and saving ok except for not updating the sub-queries.
My Question/problem is that the sub-queries (there are x4 of them. The first is shown below) only seem to be run one time so that all the inserted data for the last 4 values has the same value.
So how would i structure the statement or tell Apex to re-run the sub-query's after each insert into the table?
Thank you,
Matthew
P.S. if anyone wants to know the background if that helps.
The table stores data on tissue samples. Each tissue sample is kept in a tower (like a filing cabinet) inside of a box that has rows and columns. As the samples are used, there are open spots created. So the sub-query(s) check to find the first open tower that has a box that has an open spot for the vial. Each time a new sample is saved to the database, the sub-queries have to be run to find the next available empty spot.
As an example, the first run might be 670 (tower), 5 (box), H (row), 3 (column). Since that empty spot has now been assigned, the next row that is saved needs to run the sub-queries again and it might be for example now: 645 (tower), 3 (box), A (row), 5 (column). Instead what happens now is all the tissue samples get assigned the same spot.