0

Help needed with a formula for a button

Hello :),
I'm new to Ninox and I'm struggling to find the right formula for my button.
Some of my clients want to have a certain address on their quote and have a different address mentioned on their final invoice. To do so I have created a parent table called Client and two child tables called Quote Address and Invoice Address.
I would like to create a button that will copy the quote address to the invoice address when they are the same to save time.

Here is the formula I worked out so far, however when I click on the button nothing happens…:
let a := cnt('Invoice Address'.Address);
let b := cnt('Invoice Address'.Town);
let c := cnt('Invoice Address'.Postcode);
let d := cnt('Quote address'.Address);
let e := cnt('Quote address'.Town);
let f := cnt('Quote address'.Postcode);
if a or b or c = null then
a := d;
b := e;
c := f
end

Thank you for any help 😊

2 replies

null
    • Mconneen
    • 4 yrs ago
    • Reported - view

    At a specific point in time.. will a Client have multiple Quote addresses?   At a specific point in time.. will a Client have multiple Invoice Addresses?   If YES.. then child / composite table is the way to go..  and you will need a process to let them pick which address they want the Quote and Invoice to go to.   If NO.. then two fields is the way to go.. one for Quote and one for Invoice... making at least ONE of them required..  then when generating the Quote.. use a formula field to pull the address..    Something like (but not exact) 

    if this.QuoteAddress then 
        -- code to use QuoteAddress
    else
        -- code to use InvoiceAddress
    end

     

    Is there a need to filter based on address component ?? Show me all Invoices for Town FOO...   If YES.. then multiple fields is the way to go..   If NO.. then a single address field that you type in will work.. and make your quote  / invoice print easier..   Manging address changes over time can be handeld by copying the appropriate address on to your Quote table or your Invoice Table at time of generation.. 

    • maroon_banana
    • 4 yrs ago
    • Reported - view

    Thank you very much for your help :)!

    Your recommendations really helped and my button is now working :)!

Content aside

  • 4 yrs agoLast active
  • 2Replies
  • 872Views