Hello, AppSheet Community!
I am working on a loan management app in AppSheet that involves automating the generation of cobros (payment schedules) when a new loan (prestamo) is created. Despite extensive efforts and advice, I have been unable to fully implement this functionality, and I need your guidance to solve this problem.
My Goal
When I create a new loan, I want the system to automatically generate multiple cobros (one for each payment period) in the Cobros table. Each cobro should include:
- Indice_cuota: A sequence starting from 1 up to the Number of Cuotas for the loan.
- Fecha_cobro: Calculated based on the loanâs start date, frequency of payment, and the cuota index.
- Monto_cuota: The loanâs total amount divided by the number of cuotas.
- Estado_cobro: Initially set to âPending.â
Tables and Their Columns
Prestamos (Loans)
Column Name Type
| _RowNumber | Number |
|---|---|
| ID_prestamo | Text |
| ID_cliente | Ref |
| Monto prestado | Number |
| Frecuencia de Pago | Enum |
| Deuda total | Number |
| NĂșmero de Cuotas | Number |
| Fecha de Inicio | Date |
Cobros (Payment Schedules)
Column Name Type
| _RowNumber | Number |
|---|---|
| ID_cobro | Text |
| ID_prestamo | Ref |
| Indice_cuota | Number |
| Fecha_cobro | Date |
| Monto_cuota | Number |
| Estado_cobro | Enum |
What I Have Tried
Here are the steps I have taken:
- Created a bot triggered when a new loan is created.
- Set up a table called Helper_Indices containing sequential indices (1, 2, 3, âŠ) up to a predefined number (e.g., 50).
- Attempted to reference the loanâs ID_prestamo in the action that generates cobros, but encountered errors like âUnable to find column â_THISROWââ and âUnable to find column âID_prestamoâ.â
- Tried using actions to populate Helper_Indices with loan data, but the connection between the tables does not seem to work as intended.
Current Challenges
- Cannot reference ID_prestamo from the Helper_Indices table.
- Actions that rely on
_THISROWor similar expressions fail to connect tables properly. - The app crashes when certain actions are triggered.
What I Need
Could you provide a step-by-step solution or example implementation for automatically generating cobros when a loan is created? Specifically:
- How to correctly reference ID_prestamo in actions or bots?
- How to use Helper_Indices effectively, if at all?
- Any alternative approach for generating cobros automatically?
Thank You!
Thank you for taking the time to read this. I appreciate any guidance or solutions you can offer.