Forms5.0: format mask on date column

From: Eilev <eilev_at_empiri.no>
Date: Mon, 24 Jan 2000 01:02:44 -0600
Message-ID: <iyMi4.11579$in5.193739_at_news1.online.no>



Hi folks,

I'am struggling with format mask hh24:mi on date columns. The problem is to make Forms interpret 4 digit input and display it as (0115 should be displayed as 01:15). Here is the case:
- field_1, input allowed, forms.datatype = date, format-mask hh24:mi,
database.datatype = date.
- field_2, display only, forms.datatype = datetime, format-mask hh24:mi,
database.datatype = date.
- field_3, display only, forms.datatype = char, not a database field.

The logic goes as this: The user inputs hh:mi into field_1, a trigger fetches a database value into field_2, and the difference is calculated and displayed in field_3 ("calculated" by some to_char and ABS etc...)

To make the value in field_2 appear in the format "hh24:mi", I had to change the default nls_date settings by using a post-logon trigger that executes: 1) set_application_property(plsql_date_format , 'dd.mm.yyyy hh24:mi:ss'); 2) set_application_property(builtin_date_format, 'dd.mm.yyyy hh24:mi:ss');

The problem remaining now is how to input only 4 digits into field_1 and have it displayed as "hh:mi". Before the post-logon trigger I had a "when-validate-item-trigger" on field_1 that went like this "if length(:field_1) = 4 then :field_1 := substr(:siste_form_fra_desk_1,1,2)||':'||substr(field_1,3,2); end if; After changing the date_format, length(field_1) = 19, and I cannot manipulate the hh24:mi anymore.

Now it works as intended only when inputting 5 digits, where digit number 3 can be any number or character (it is simply being stripped away). Examples of input and displayed output in field_1 are:

0100  becomes  01:00  (ok)
0105  becomes  01:05  (ok)
0115  becomes  01:05  (Yes, 01:05, which is wrong)
01115 becomes 01:15 (correct, but needs 5 digits as input) 01x15 becomes 01:15 (correct, but needs 5 digits as input)

I'am sure it is possible to input only four digits and get the correct result - but how? When I started out I expected this to be a piece of cake, but Oracle's date formats suddenly don't seem so simple anymore...

Thanks for any replies,

Kind regards,
Eilev Received on Mon Jan 24 2000 - 08:02:44 CET

Original text of this message