6 Replies Latest reply on Dec 2, 2016 1:11 PM by arnojansen1

# GetAsNumber with a negative number?

Hi,

I have build a invoices solution where i calculate a due date based on terms.

Payment_terms are:

Due On Receipt

Due on Specific date

Net -7 days prior check in day

Net 7 days after check in day

Net 14 days from invoice date

The first two easy that becomes manual input.

The "net -7 days prior check in day" is my problem Where we receive an invoice lets say today and is due when 7 days before clients check in to a hotel room that can be any day, lets say 8Feb17. But invoice due date is always 7 days before check in day so in this example 1Feb17 (ideally it would take into account you cannot pay on saturday and sunday at least not in New Zealand).

I have used below: case calculation but it ignores if "getasnumber" is -7  (minus7)

adding 7 days to check in sorted and so is 14 days.

Case (

GetAsNumber ( Suppliers::Payment_terms ) > 0 ;

Invoice_date + Suppliers::Payment_terms ;

Self < Invoice_date ; Invoice_date ;

Self  )

how to change this case so it takes "minus" days into account

Thanks for your help as always

Arno

• ###### 1. Re: GetAsNumber with a negative number?

Make into a Let() - function instead and it becomes easier and faster to calculate.

Let (

[

term = Suppliers::Payment_terms;

invoice_date = Invoice_date;

ddate = DueDate

]

;

Case(

terms > 0; invoice_date + terms;

ddate < invoice_date; invoice_date;

ddate

)

)

• ###### 2. Re: GetAsNumber with a negative number?

Thanks Johan,

so for terms can I only use numbers and no combination text and numbers?

also will it then work with a negative number as pay date can be before check in date

• ###### 3. Re: GetAsNumber with a negative number?

Hi,

it looks like you have many, but not too many, scenarios you need to handle with your calculation.  If it were me, I'd start writing down different scenarios with real dates (so you handle weekends).  You can write the math next to the scenario and build your FM calculation from there.

• ###### 4. Re: GetAsNumber with a negative number?

When it comes to calculations you can only do +/- on numeric values, but you can check more values if they are text in the Case function.

1 of 1 people found this helpful
• ###### 5. Re: GetAsNumber with a negative number?

just in case we are all missing this ...

2 of 2 people found this helpful
• ###### 6. Re: GetAsNumber with a negative number?

Hi Johan and David, you are correct that I have a couple scenarios and might have to rewrite.

Your suggestion to build it in the case and the little table is however what I am looking for, works for me thanks guys for your help