Question

Custom Field Help: Comparing Dates

  • 4 March 2024
  • 3 replies
  • 35 views

Userlevel 4
Badge +11

I am trying to create a custom field but I have having an issue getting it to work.

 

I have 2 Dates:

  1. On Demand Date
  2. Rental Start Date (Custom Field)

I want to create a Custom Field that does the following and I am not sure if it is possible:

If

    rental_start_date = on_demand_date then ‘Pass’ 

else

if

  rental_start_date-1/24 = on_demand_date then ‘pass’

else ‘fail’

Both fields exist in the same LU but I keep getting a bind error and I cannot work out what the correct syntax should be.

I think I need a Select Case When () but I cannot seem to get it correct.

 

Thanks in advancec

 


3 replies

Userlevel 2
Badge +9

Hello.

I don’t fully understand your message. You mention a “custom field”, is that on an IFS data table or on a custom page? 

From what I understand, if you want to make that kind of custom field, you would need to create a read*only type, and you would need to define parameters, but I can’t know which ones you need in your case… And your custom field needs to return a text.

It would be better to use a SELECT CASE in your case, so it would be like this :

SELECT CASE WHEN CF$_rental_start_date = CF$_on_demand_date THEN ‘pass’

when CF$_rental_start_date-1/24 = CF$_on_demand_date THEN ‘pass’

ELSE ‘fail’

END

FROM XXXXXXX

WHERE XXXXX

 

Userlevel 4
Badge +11

Hi @romsar ,

 

Thanks for taking the time to reply, and sorry my message was confusing.

Rental Start Date is a Custom Field within the LU I am wanting to create this field so I wasn’t sure if that changes what I need.

Would I create my Read Only as a Select or an Expression? 

If a select, what are my arguments?

 

 

 

 

Userlevel 2
Badge +9

Hello @lisa.gilesAB 

I don’t use expressions in my case but only SELECT.

“Rental Start Date is a Custom Field within the LU”, I understand you are talking about a custom LU, therefore, a custom page. Every custom field in a custom LU / page starts with “CF$_” in their name, if you can use SQL Developer, you can easily notice that.

In the arguments field, you can type t.cf$_ALLOCATED_SERIAL 

In your SQL Query, you need to replace

WHERE ALLOCATED_SERIAL = :ALLOCATED_SERIAL

by

WHERE CF$_ALLOCATED_SERIAL = :cf$_ALLOCATED_SERIAL

Reply