0

I’m trying to learn to link files to get a running balance. It works fine until you have to delete or change a record. Any ideas on how to prevent this?

This is the button code to create a new record and pass the balance forward.  (Table is called Expense2)

let endBal := 'End Balance';
let i := (create Expense2);
i.('Bal Forward' := endBal);
popupRecord(record(Expense2,i.Id))

 

'This is the code for getting the end balance (I have a debit field and a deposit field:

if Debit != null then
'Bal Forward' - Debit
else
'Bal Forward' + Deposit
end

3 replies

null
    • Fred
    • 2 yrs ago
    • Reported - view

    Hi David -

     

    I'm not sure what you mean by "until you have to delete or change a record."

     

    You only have one table (Expense2). So:

     

    1) you have a field called 'End Balance' (You may want to think about not using spaces in names so you don't have to worry about single quote).

    2) you push a button and it creates a new record in the same table and sets the 'Bal Forward' field to be what 'End Balance' is equal to

     

    Now what do you mean by "delete or change a record"? Are you changing the new record? You are only passing along the 'End Balance' of the record you are pushing the button on.

    • daviddilworth
    • 2 yrs ago
    • Reported - view

    Everything works great when creating a new record. The balance is passed on. Let's say I have 10 records. If I have to go back and change or delete record 5, the balance doesn't change so the subsequent records no longer reflect the correct balance. The only way I can see to keep the correct balance is to hit the button to create a new record and make whatever adjustments at that point (therefore, never deleting or editing a record once it has been created). 

    i want to create a simple checkbook record because viewing various reports is better than using a spreadsheet. I'm new at this, so I learn by playing with already created templates. For the life of me, I can't find a Ninox template that is a simple check register. I've looked everywhere. I learned how to link a record from Nioxus tutorials. Any suggestions are appreciated. 

    • Fred
    • 2 yrs ago
    • Reported - view

    Hi David -

     

    From you description that is how your table is setup. Your End Balance is just a snapshot of the Bal Forward field.

     

    You can try something like this in a new formula field:

     

    sum((select Table1).NumberField)

     

    where NumberField is whatever number you want to summarize.

     

    What this will do is put the same value in every single record of your table.

     

    Good luck and let us know how it goes.

Content aside

  • 2 yrs agoLast active
  • 3Replies
  • 246Views