Hi Team,
I'm working on deleting the records from multiple tables which are associated with foreign key relations ships. I can delete the records from respected entities but when refresh aggregates I'm getting following error --23503: insert or update on table "team__js7412a420bqch2oss1v9_g7" violates foreign key constraint "osfrk_jtpetzfdmmc_team__js7412h2oss1v9_g7_pbi_js7412asp4m3d3ys7" and also getting the other error -- OS-CLRT-00000 [Application] Index out of bounds. Index 2 for bounds [0, 1]. I have tried to debug multiple time I couldn't find the solution. Can you please help me out on this.
Thanks,
Shanmuka Reddy
Hi Vipin,
When you try to do insert or update into your entity, please cross check any of the foreign key fields values that youre trying to insert into the collection is available in your foreign table or not. This is the cause for your error. Please cross check the referrence variables in your entity from other entities and check the data is present there or not for the values which youre passing.
For the second error, I think youre trying to access values in the actions by using hardcoded indexes. Please cross check the particular place where you get the error.
Reply for other issues.
Thanks
Hi Jithu Cheriath Thomas,
Thanks for replying Jithu, The first issue was resolved myself and thanks for the second issue solution. Yes it's working fine after your solution.
Thanks for Informing that the solution is working.
Hi @Shanmuka Reddy,
There seems to be an issue, such as when creating a record or if a mandatory value, like an ID (foreign key), is not being sent.
If possible, please share the OML file so I can check and provide feedback.
Vipin Yadav
Even though I'm passing Id to the respective Entity identifier once deletion part is completing then when I refresh the aggregates then the problem comes into the picture. why I'm refreshing the aggregates means I need to show the updated data in the table.
Hi,
So from problem statement seems there is no issue in deleting the records. YOu are facing issue when refreshing the aggregate (trying to show the data on screen.)
So most probably issue with the aggregate filters. Could you please share the screenshot of aggregate which you are refreshing after deleting the records. Error states that you are trying to access the record at index 2 but that don't exist.
regards
Sorry for responding late, Yes exactly when Edit the record and save it. If I'm immediately delete the record with out page reload I'm getting the Index out of bound exception because I'm refreshing the aggregates. If I'm not edit the record and then delete the record and it is getting deleted without throwing the error. for your reference I'm attaching the oml here.
*Vikas
Hi @shanmuka reddy
as the image show it contain two error .
first error occurs when you try to delete a record that is still being referenced by other records in another table (through a foreign key relationship). The foreign key constraint ensures referential integrity, meaning that you cannot delete a record in one table if there are related records in other tables unless you explicitly handle the deletion of those related records.
for this create ER Diagram in Outsystem module and find out relation between the reference entity.
And second one is error is often caused by trying to access an element of an array or list that does not exist. In this case, it seems like you're attempting to access an index (2) in an array or list, but the array only contains one element ([0, 1]), so index 2 is out of bounds.
For this Debug the Aggregates ensuring the data is being accessed correctly and handle empty results appropriately.
Regards ,
Rajat
Hi Rajat,
Sorry for respoding late, The first error which is having with foreign key violation I have solved it out the second one which is Index out of bound exception was I'm unable to getting resolve. I have a screen which contains scrollable area and having table and web blocks. when ever I edit the row and immediately if I delete it I'm getting index out of bound exception. If I'm not edit the row when I delete it I'm not getting the error. For your reference I'm adding the oml here.
link: https://personal-qu12junb.outsystemscloud.com/SampleReactAppNew/Home?_ts=638717978696502267
Hi shanmuka reddy ,
I saw your OML, I am not able to create any data as of now debug the code and find the exact point which generate the error.add break point on Delete on click.
Regards ,Rajat