Question

Custom Field - Calculated Date

  • 16 March 2023
  • 4 replies
  • 83 views

Userlevel 4
Badge +11

I need to create a Custom Field that contains a formula to calculate a date based off some conditions.

Is this possible and how do I achieve it? 

Thanks,


4 replies

Userlevel 3
Badge +8

Hi lisa.

Yes, it is possible. For Apps10 you should follow this steps:

https://docs.ifs.com/techdocs/foundation1/040_administration/220_user_interface/020_custom_objects/040_custom_fields/020_create_custom_fields/default.htm

Step by step for Read-Only fields:
https://docs.ifs.com/techdocs/foundation1/040_administration/220_user_interface/020_custom_objects/040_custom_fields/020_create_custom_fields/steps_itd/set_TypeOfField_ReadOnly.htm?nobanner=true
 

Implementation type should be: “Select”. That way you can use SQL to describe the business logic for that Date field you need.

Thank you much.
Best regards.
Gonzalo.
 

Userlevel 4
Badge +11

Thanks for the reply but I am still struggling with the SQL and Argument methods.

I need an ‘If And’ statement with using 2 CF Fields already created and the Create Date from the Case

Example:

if cf$_criticality = ‘Critical’ and cf$_Type ‘Breakdown’ then create_date + 12 h else

if cf$_criticalty = ‘non-crit’ and cf$_Type ‘Breakdown’ then create_date +48 else

if cf$_criticality = ‘Critical’ and cf$_Type ‘damage’ then create_date + 48 h else

if cf$_criticalty = ‘non-crit’ and cf$_Type ‘damage’ then create_date +120h

 

how would I present that as a Custom Field?

 

 

Userlevel 5
Badge +11

Use the CASE statement in your SELECT statement for your read-only custom field, it behaves like an IF statement.

 

For example.

SELECT

   CASE

      WHEN :cf$_criticality = ‘Critical’ AND :cf$_type = ‘Breakdown’ THEN :create_date + (12/24)

      WHEN :cf$_criticalty = ‘non-crit’ AND :cf$_type = ‘Breakdown’ THEN :create_date + (48/24)

   END

FROM DUAL

 

The arguments would be something like.

t.cf$_criticality, t.cf$_type, v.create_date

Userlevel 4
Badge +11

@Technical Outlaws  thank you so much, I will give this a try and let you know how I get on :-)

Reply