9 Replies Latest reply on Sep 18, 2013 12:21 PM by KylePutzier

# Voiding an invoice

Hello everyone I am new to FMPro, I am used to doing thiings differently

Heres is an example of what I am trying to do in FM

GT = SubTotal + TaxAmt

If PaymentStatus = "VOID" then

@ans = GT * 0

Else @ans = GT

@ans = (The Answer returned back to the field)

Any help in how to make this same simple calc work in FM

Thank you.

• ###### 1. Re: Voiding an invoice

GT =

Case(PaymentStatus = "VOID",0,SubTotal + TaxAmt)

Kyle

• ###### 2. Re: Voiding an invoice

Try:

GT * If ( paymentStatus = "Void" ; 0 ; 1 )

In case you're wondering: there is no 'then' statement in FileMaker.

EDIT:

Kyle –

interesting question: does the OP want to keep the original result and have a 'voided" version, or simply void the whole thing? btw, what's with the comma delimiters?

• ###### 3. Re: Voiding an invoice

@Erolst

That statement means

GT is multiplied by 0 if status = void else it is multiplied by1?

@Kyle are the , , supposed to be ; ;?

• ###### 4. Re: Voiding an invoice

@Erolst

That statement means

GT is multiplied by 0 if status = void else it is multiplied by1?

Yes. But If/Case ( status = "Void" ; 0 ; GT ) really is shorter …

• ###### 5. Re: Voiding an invoice

Are you meaning for me to use the following?

GT =

Case(Payment Status = "VOID";0;Subtotal + Tax Amount)

• ###### 6. Re: Voiding an invoice

Let's not make this overly complicated. If you're about to define a calculation field "GT", the formula would look like so:

As you can see, the "fieldname =" part is implicit, you don't have to write it.

• ###### 7. Re: Voiding an invoice

AHHH ok I was still thinking that GT was my variable I was returning

the value back to the field "Grand Total".

But in this case I just need to drop in:

Case(Payment Status = "VOID";0;Subtotal + Tax Amount)

To get things up and running.

Again I thank you all for your help.

• ###### 8. Re: Voiding an invoice

The commas are left over from the olden days. I still cant get use to using a semi-colon. Either way, both behave the same as far as the calculation engine cares.

Kyle

BTW, My standard formatting of the Case function is:

Case(

Value = Test1, Result1,

Value = Test2, Result2,

...,

FallThoughValue

)

I find it easier to read than:

Case(Value=Test1,Result1,Value=Test2,Result2,...,FallThoughValue)

And I never use If() anymore.

• ###### 9. Re: Voiding an invoice

Many programs have the very same calculation that you are currently building.

Here is the actual calc from my invoicing program:

I kill the total at the line item level rather than at the grand total level but it is still basically the same.

Inv_ExtSubTotal =

Case(

Invoice Items | Invoices::Invoice_Status = "Cancelled";0;

PatternCount(Inv_UnitPrice_UM ;"LOT") ≠ 0;Round(Inv_UnitPrice;2);

Round((Inv_QtyBilled * Invoice Items | Conversions_QtyBilled UM::Conversion) * (Inv_UnitPrice /Invoice Items | Conversions_UnitPrice UM::Conversion);2)

)

Kyle