passing date variables into if statements and operations between them
Hi,
I am trying to write some lines in column expression to check an specific date with another column and then do some mathematical operations which can be easily done in excel. My code is:
if ((column(“Start date”)>“2024-01-31”)
column(“Invoice date”)>“2024-01-31”
column(“End date”)<“2024-01-01”)
{0}
else if ((column(“Invoice date”)>=“2024-01-01”) && (column(“Invoice date”)<=“2024-01-31”))
{column(“Post-discount contract value”)*min((“2024-01-31”-column(“Start date”)+1),(column(“End date”)-column(“Start date”)+1))/(column(“End date”)-column(“Start date”)+1)}
else if ((column(“End date”)>=“2024-01-01”)&&(column(“End date”)<=“2024-01-31”))
{(column(“End date”)-“2024-01-01”+1)*column(“Post-discount contract value”)/(column(“End date”)-column(“Start date”)+1)}
else
{“”}
the output data type is double. “Start date”, “Invoice date” and “End date” are local dates and I don’t know how I can use some functions like Min() on dates and I guess knime can’t understand that “2024-01-31” is a date and not an string.