Solved

Format mask - oracle forms- Forms [32 Bit] Version 11.1.1.4.0 (Production)

Posted on 2016-09-13
6
54 Views
Last Modified: 2016-09-14
I have a multi item block and the dsp_values is 60 characters. (character field)

Now I am trying a put a new value that is number. I need to have a format mask. In oracle forms there is not set_item_instance_property for Format Mask.   I have 2 functions

select case when trim(TRANSLATE('99','0123456789', ' ')) is null
            then 'numeric'
            else 'alpha'
       end
from dual

SELECT CASE WHEN INSTR('-1.-2','-')>1 THEN 'alpha' --if minus is not the very first symbol then ‘alpha’
WHEN '-1.-2' LIKE '%.%.%' THEN 'alpha'--if more than 1 period then ‘alpha’
WHEN '-1.-2' LIKE '-%-%' THEN 'alpha'--if more than one minus then ‘alpha’
WHEN REGEXP_LIKE('-1.-2','^[-0-9.,]*$') THEN 'numeric' --if all symbols are digits, a period, or a minus then ‘numeric’
ELSE 'alpha'
END is_numeric
FROM dual

Open in new window


How can I use this for the new value . No decimals allowed. Other values in that field are character. Enclosing the screen print. When I put the value 80.0 the other values change to #####
two.jpg
one.jpg
0
Comment
Question by:anumoses
  • 4
6 Comments
 
LVL 32

Accepted Solution

by:
awking00 earned 500 total points
ID: 41796682
I think the safest way to handle that is to create a function something like -
CREATE FUNCTION is_number (p_string IN VARCHAR2)
   RETURN INT
IS
   v_num NUMBER;
BEGIN
   v_num := TO_NUMBER(p_string);
   RETURN 1;
EXCEPTION
WHEN VALUE_ERROR THEN
   RETURN 0;
END is_number;

Then you can use -
case when is_number(yourfield) = 1 then 'numeric' else 'alpha' end as datatype
0
 
LVL 6

Author Comment

by:anumoses
ID: 41796904
OK. After I get the value how to I use the set item property or use that format mast only on the field required but not changing the other values to ######
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 41797296
In forms there cannot be two format masks on the same item. As I see added pictures you can remove format mask from item "Value" and use awking00's function for validation of input e.g. in a When-Validate-Item trigger.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Author Comment

by:anumoses
ID: 41797654
Error when I use the function in the form
error.jpg
0
 
LVL 6

Author Comment

by:anumoses
ID: 41797679
Fixed it. Thanks
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 41797682
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle - How to analyze data using DATE COLUMN? 7 73
sql for Oracle views 8 46
query in Oracle forms Builder 2 41
Oracle -- identify blocking session 24 41
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now