Assign payment to a service but with one row at a time approach

Goal: Attach a payment that is entered to a specific service under a booking. One by one, it should read the first row, once the balance becomes 0 in that then move on the next.

App description: It is a service booking app for a pet boarding facility. The tables available in the system are:

(1) Customer Database - Contains the customer details.  
(2) Pet Details - Contains pet related details
(3) Service Bookings - Contains bookings that are created with a reference to a pet.
(4) Service Availed - Contains variety of services availed under a single booking.
(5) Service Details - This acts like a master for all the services provided by the facility along with the price of each service.
(6) Payment Details - Payment made by the customer is entered here.

Currently, the relationship is as follows:

One customer can have multiple pets --> One pet can have multiple bookings --> One booking can have multiple services & payments.

So, as soon as I enter a service under a booking, it showcases the price of the service & total amount to be paid.

Once the customer pays for the services availed, I enter it in the payment table.

I want to know how can I assign a payment to one or multiple services under one booking so that the total amount due becomes 0.

I was able to achieve the above situation to a certain extent by creating an action using the select function & then tagging it with an automation.

But is it still incomplete. Because in case there are multiple services, I want it to first read the first row selected enter the amount in that, till it becomes 0 and then move on to the next row selected.

Please help me out

The select formula: ANY(Select(Payment Details[Payment ID],IN([_THISROW].[Record ID],[Service ID])))

0 3 128
3 REPLIES 3

@Suvrutt_Gurjar @AleksiAlkio anyone can help me with this please?

Can someone help with this? Is the explanation not correct?

I hope to provide you with a streamlined approach to assign payments to services one at a time for your pet boarding facility's app. The goal, as I understand it, is to attach a payment to services within a booking incrementally, checking off each service as paid until the paid amount is exhausted.

The strategy is to refactor the way payments are associated with services. Instead of relying heavily on a brute-force `SELECT()` formula and complex automations, let's establish more direct connections within your data structure, making the app more efficient.

Here's a step-by-step guide on how to set this up:

1. EnumList of Services on Payment Record:
Add an EnumList column (base type REF to the "Service Availed" table) to the 'Payment Details' table. The 'Valid If' constraint for this column will dereference the list of services linked to a particular booking (i.e. [Payment_Booking_Link].[Related Service Availeds]), allowing selection of specific services for payment application on the payment record form.

2. Calculating Total Service Cost:
Create a physical column in the 'Payment Details' table to store the subtotal of the selected services. Employ a list-dereference with a SUM() function to calculate this total, similar to the method demonstrated in the 'Shop Cart 7.1 - Totals' and 'Shop Cart 7.2 - Totals Redo' Evolution Apps under the 'Resources & Tools' section Evolution App: Shopping Cart - SubTotal & Discount. This subtotal field will help track the sum of the service costs selected for payment.

3. Ref Set Action to Mark Services as Paid:
Create a 'Ref Set' action that's linked to the 'Save' event of the payment form. This action will execute another action on the set of rows defined by the EnumList of service IDs from the payment record, updating the service records as paid. For a visual guide on similar actions, the video for the 'Shop Cart 7.2 - Totals Redo' might provide insights Shopping Cart Totals Redo Video.

With these steps, your app will have a structured system to track and record service payments with efficiency. Assigning payments to services is as straightforward as selecting the services from a dropdown and saving the payment record, which will set off a chain of actions marking each service paid one by one.

Remember, implementing such changes likely means that other parts of your app will need to be updated as well, namely where service costs and payments are utilized or displayed. Keep an eye out for cascading effects in your app's workflow.

Should you require further clarification or personalized support, don't hesitate to submit your question directly to me through the Answer Portal - or try out the free version of Appster (if you've got a ChatGPT plus account).

To begin the implementation, update your 'Payment Details' table with the new EnumList column and set up your actions and triggers before testing the process flow.

Happy apping!

Top Labels in this Space