For this example, I will show you how to work with colon separated lists created from using checkboxes in Oracle APEX. This is a solution for when your checkbox can have multiple values and the checkbox field is a lookup table.
The first table holds information on a hospital stay by storing an ID, patient name, and a list of labs they needed during the stay.
Table two has the information on the labs and stores an ID, lab name, and cost of the lab.
Let’s load in some data so we can verify the solution later
In the situation, we want to calculate the total cost of a hospital stay by adding up the costs of all the labs the patient needed. Let’s create a function to get the lab_cost when the labinfo_id is given
This function calls on the other function we created, calcMedLabCost, to get the cost of each item in the list and add them together
Time to test it out with a select statement
Learn More Tips About Oracle APEX with Traust Consulting
Are you looking to learn more helpful tips about Oracle APEX? Our blog regularly features topics such as the one above. You can learn about User Self Registration, Oracle Forms, and more by visiting our blog.
- There is some unsung hero out there that provided the original code that I based mine off of, but unfortunately, I cannot find the site online anymore to give them credit. If you let me know, I will gladly link them in this section
- Please let me know if I did not properly give credit to someone for any of the code used
- APEX 18.1 or higher
- Oracle DB 184.108.40.206 or higher
We do not take responsibility for any unintended or unwanted consequences in your instance of Oracle, Oracle APEX, or related products as a result of reading our blogs or following our guides. Though the information is fully tested and generally safe to use, our lawyers really have a thing against admitting potential wrongdoing. If it makes you feel any better, one time they dropped a dollar in change after buying coffee. Instead of returning the money, I put it in the tip jar. The barista earned it anyways, our lawyers complained when they didn’t have paprika for their coffee! Are you kidding me? Paprika!