Home » Developer & Programmer » Forms » Format Mask for IP (Oracle Forms, 6i, Windows)
icon7.gif  Format Mask for IP [message #653784] Mon, 18 July 2016 23:38 Go to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
I want users to enter IPs (IPv4) in proper format e.g. 250.250.0.1. For this purpose I tried to use format mask property as 999.999.999.999 but it requires each part to be of 3 digits. Pl guide.
Re: Format Mask for IP [message #653796 is a reply to message #653784] Tue, 19 July 2016 03:30 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can't do it with format mask. And IP shouldn't be number datatype. It should be varchar2. Generally speaking, if the number is some form of code that it would never make sense to do math on it should probably be a varchar. Use WVI to check the format.
Re: Format Mask for IP [message #653829 is a reply to message #653796] Tue, 19 July 2016 16:01 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Smells like a regular expressions solution (at least, to me). However, as Forms 6i most probably don't speak regexp, I'd create a stored function, pass item value to it and return BOOLEAN to the caller.
Re: Format Mask for IP [message #653831 is a reply to message #653829] Tue, 19 July 2016 22:47 Go to previous messageGo to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
Yes I can do that with the help of a function. Just wanted to check if there is a simple solution.
Re: Format Mask for IP [message #653839 is a reply to message #653831] Wed, 20 July 2016 02:22 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
I disagree with CM (which I don't think has happened before). A v4 IP address is a 32 bit number, and it is usually best to store it as such. By all means have your users enter it as four octal numbers, but you may want to store it as what it really is. Why? Because you may need to do arithmetic on it. For example, comparing addresses to subnet masks is impossible in the four octet version. Sure you can compare class A/B/C subnets, but how would apply, say, a 20 bit mask?

Think data types! An IP address is a number.
Re: Format Mask for IP [message #653841 is a reply to message #653839] Wed, 20 July 2016 03:09 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Didn't occur to me you can do math on it. However with the way forms works making it a number is still problematical if you want them to enter it in the standard format. You would need to create a non-database varchar2 item to appear on the form and map it to the real, numeric database item using triggers.
Previous Topic: comparing comma separated values
Next Topic: Row convert into column
Goto Forum:
  


Current Time: Thu Mar 28 05:12:39 CDT 2024