Home » Developer & Programmer » Forms » To change the datatype using format mask -- (forms6i)
To change the datatype using format mask -- [message #318309] Tue, 06 May 2008 08:13 Go to next message
Messages: 48
Registered: November 2006

I want to change the value based on the datatype.

A part of the coding:

I have written one cursor to fetch v_format and then

IF v_format = 'NUM' THEN
         m_format := '9999999.99' ;
 ELSIF v_format ='DATE' THEN  
         m_format := 'DD-MON-YYYY' ;
         m_format := null ;
      END IF ;	

SET_ITEM_PROPERTY('blockname.column_name',FORMAT_MASK, M_FORMAT);

Column name is varchar2.

This piece of coding is not working. I kindly request someone in this group to throw light on what is wrong?

Re: To change the datatype using format mask -- [message #318375 is a reply to message #318309] Tue, 06 May 2008 11:50 Go to previous message
Messages: 21148
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This piece of coding is not working.

It is, of course, useless. How is anyone supposed to know what happened when you executed this piece of code unless you tell us? Is there any error? If so, which one? If not, what do you mean by "is not working"?

Topic title says that you'd like to change item's DATATYPE. As far as I can tell, you can't do that. Item datatype is defined during development process and can not be changed dynamically. What you are trying to do (using the SET_ITEM_PROPERTY built-in) is modifying FORMAT (not datatype).

Now, if you (for example) set item datatype to NUMBER, you can't expect it to contain DATE format (because DATE can not fit into NUMBER (unless it is Julian date)). Therefore, perhaps you should choose CHARACTER datatype for this item. Doing so, you might format it using the TO_CHAR function, using the appropriate format mask.

For example, you'd format numbers as TO_CHAR(value, '999G990D00'), dates as TO_CHAR(value, 'dd.mm.yyyy') etc.
Previous Topic: bevel property on image
Next Topic: Time
Goto Forum:

Current Time: Sun Aug 20 16:17:31 CDT 2017

Total time taken to generate the page: 0.03004 seconds