Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I have two date fields PO_DATE and INVOICE_DATE.. Now i wants to write a expression for two fields. My logic is below. How can i implement my logic using "IF Else " statement.
If PO_DATE=INVOICE_DATE then "Online" elseif interval(PO_DATE-Invoice_DATE,'DD') >=2 then 'twodays' elseif interval(PO_DATE-Invoice_DATE,'DD') >=10 then 'Tendays' else interval(PO_DATE-Invoice_DATE,'DD') >=30 then "Thirtydaysmore"
Regards,
Masba
If( PO_DATE = INVOICE_DATE , " Online" , if ( interval(Invoice_DATE - PO_DATE,'DD') <=2, "2daysmore", if (interval(Invoice_DATE - PO_DATE,'DD') <=10, " 10daysmore", if (interval(Invoice_DATE - PO_DATE,'DD') <=30, "30daysmore", "30daysmore") ) ) )
If( PO_DATE = INVOICE_DATE , " Online" , if ( interval(Invoice_DATE - PO_DATE,'DD') <=2, "2daysmore", if (interval(Invoice_DATE - PO_DATE,'DD') <=10, " 10daysmore", if (interval(Invoice_DATE - PO_DATE,'DD') <=30, "30daysmore", "30daysmore") ) ) )
If(PO_DATE=INVOICE_DATE,"Online",
if(interval(PO_DATE-Invoice_DATE,'DD')>=30 ,"Thirtydaysmore",
if(interval(PO_DATE-Invoice_DATE,'DD') >=10, 'Tendays' ,
if(interval(PO_DATE-Invoice_DATE,'DD') >=2 , 'twodays' ))))
Hi
For that first of all The date format for both date fields must same, then need to use number format for both date fields using either Floor or Num function . Doing this way it becomes easily to match the date between two fields.
After doing this use your if else Statement like below
If(Floor(Date(PO_DATE))=Floor(Date(INVOICE_DATE)),'Online',
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE)) >=2 , 'Twodays' ,
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE)) >=10, 'Tendays',
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE))>=30 ,'Thirtydaysmore'
))))
Hope it helps
Regards
Mohit
in ur case.. 5, 11 , 30 also greater than 2 so loop will not go to >=10 and >=30 cases..it ll come out at >=2 and result would be 2days more....sorry if I am wrong.....
Hi
Mohit's statement is correct, except for the order of the Ifs:
If(Floor(Date(PO_DATE))=Floor(Date(INVOICE_DATE)), 'Online',
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE)) >= 30 ,'Thirtydaysmore',
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE)) >= 10, 'Tendays',
if(Floor(Date(PO_DATE))-Floor(Date(Invoice_DATE)) >= 2 , 'Twodays'
))))
HTH
Jonathan