Solved

Date format in Event Actions

  • 16 October 2020
  • 9 replies
  • 1026 views

Userlevel 1
Badge +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

 

 

icon

Best answer by Tomas Ruderfelt 19 October 2020, 10:58

View original

9 replies

Userlevel 7

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? 

Userlevel 1
Badge +5

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

Userlevel 7

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; 

 

 

Userlevel 3
Badge +7

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.

Userlevel 7
Badge +19

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.

 

 

Userlevel 1
Badge +5

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

 

Userlevel 7
Badge +19

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;

 

Userlevel 6
Badge +15

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

 

Userlevel 1
Badge +5

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