Skip to main content
Solved

Date format in Event Actions

  • October 16, 2020
  • 9 replies
  • 1167 views

Forum|alt.badge.img+5
  • Do Gooder (Customer)
  • 17 replies

Hello,

Working with events, I’m trying to get the value of a date type attribute and the result is a number, instead of a date.

I’ve tried for different date type attributes and with different logical units and tables, and the result is always the same.

For example:

Logical Unit: ExpenseHeader

Table: Expense_Header_tab

Attribute: CONFIRM_DATE

When the event is executed, I get “1994” as a result, but it should be “16/10/2020”.

 

Does anyone know how to resolve?.

Thanks in advance,

Amaia

 

 

Best answer by Tomas Ruderfelt

Can you try the code below instead and you should see the value of &NEW:CONFIRM_DATE more clearly, separated from the other value you trace out.

Since all attributes are strings you can’t just use them directly. In my example below I have put ' around it for PLSQL to know that it is a string. You should always handle it as a string.

BEGIN
   Error_SYS.Record_General('Test', 'TEST_DATE_FORMAT: Attribute: :P1 Today (Default Oracle format) :P2', '&NEW:CONFIRM_DATE', SYSDATE);
END;

 

View original
Did this topic help you find an answer to your question?

9 replies

  • Superhero (Employee)
  • 1433 replies
  • October 16, 2020
Amaia wrote:

Hello,

Working with events, I’m trying to get the value of a date type attribute and the result is a number, instead of a date.

I’ve tried for different date type attributes and with different logical units and tables, and the result is always the same.

For example:

Logical Unit: ExpenseHeader

Table: Expense_Header_tab

Attribute: CONFIRM_DATE

When the event is executed, I get “1994” as a result, but it should be “16/10/2020”.

 

Does anyone know how to resolve?.

Thanks in advance,

Amaia

 

 

What are you using the value for? Are you updating something or printing it in a pop-up? 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • October 16, 2020

I wanted to compare dates, but I realized that the comparison was wrong, and I checked it printing in a pop-up.


  • Superhero (Employee)
  • 1433 replies
  • October 16, 2020
Amaia wrote:

I wanted to compare dates, but I realized that the comparison was wrong, and I checked it printing in a pop-up.

What version is this in? 
 

I just did a quick test in Apps10 and I get the following when using:

 

BEGIN

Error_SYS.Appl_General('PurchaseReqLinePart','ERROR: Confirm Date: &OLD:CONFIRM_DATE');

END; 

 

 


Forum|alt.badge.img+7
  • Hero (Customer)
  • 27 replies
  • October 16, 2020

Are you assigning date type column values to any variables before use in the condition? If so please check you use date type variables. If they are string type use the correct converting like = to_char(date_column, ‘YYYY-MM-DD’).

And also check the event side column data type as well.


Forum|alt.badge.img+20
  • Superhero (Employee)
  • 492 replies
  • October 19, 2020

Event attributes are always strings when you use them.

When you select an attribute to be used in the event you can define what the attribute shall contain:

DATE Date without timestamp

TIME Timestamp without date

DATETIME Date and timestamp

 

The format of the string for the three different DATE formats are defined in the picture below and you can change it to your preferred format. Observe! This format is for all events.

 

 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • October 19, 2020

Good morning,

Thank you for your replies.

We are working with IFS-9 UPD14.

I have the attribute defined as date type in the event.

If I write the following statement in the event:

I get this answer:

You can observe that SYSDATE is right, but “CONFIRM_DATE” is a number, not a date. 

I have tried with more date type attributes and with different logical units and tables, and I get always a number as a result.

Best regards,

Amaia

 


Forum|alt.badge.img+20
  • Superhero (Employee)
  • 492 replies
  • Answer
  • October 19, 2020

Can you try the code below instead and you should see the value of &NEW:CONFIRM_DATE more clearly, separated from the other value you trace out.

Since all attributes are strings you can’t just use them directly. In my example below I have put ' around it for PLSQL to know that it is a string. You should always handle it as a string.

BEGIN
   Error_SYS.Record_General('Test', 'TEST_DATE_FORMAT: Attribute: :P1 Today (Default Oracle format) :P2', '&NEW:CONFIRM_DATE', SYSDATE);
END;

 


CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • October 19, 2020

The issue you are having with it always converting the first value is because the first parameter expected is the LU Name.

This doesn’t technically have to be a LU name, you could name it like so: ‘ExpenseHeaderEvent’

The DATE: is to prevent the error message from displaying a . before the date - For example without DATE: it would read: .19/10/2020

 


Forum|alt.badge.img+5
  • Author
  • Do Gooder (Customer)
  • 17 replies
  • October 19, 2020

For one hand, I replaced &NEW:CONFIRM_DATE by ‘&NEW:CONFIRM_DATE’ int the Error_sys  as Tomas indicated, and it worked.  

 

By the other hand, I wanted to compare CONFIRM_DATE and TRUNC(SYSDATE,’MM’), but date formats are different and the comparision was wrong (Confirm_date = ‘2020-10-13’, Trunc(sysdate,’mm’)=’01-OCT-20’). I had to define date variables to work with similar date formats and be able to compare correctly.

Now the event works.

 

Thank you very much for your replies.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings