Solved

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

Posted on 2016-09-13
6
60 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

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.

Question has a verified solution.

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

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
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…

773 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