[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2016-09-13
6
Medium Priority
?
99 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 32

Accepted Solution

by:
awking00 earned 2000 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
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…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

649 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