Jump to content
Server Maintenance This Week. ×

MAC Address Validation


This topic is 6646 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Q1: How to validate the MAC Address in the format:

##???##:##:##:##:##

Q2: How to convert the wrong format to the right format.

For example, convert from ##-##-##-##-##-## to ##:##:##:##:##:##

I have search the web, and there is function look like : (^([0-9a-fA-F][0-9a-fA-F]){5}([0-9a-fA-F][0-9a-fA-F])).

Can FM Pro7 do such function?

Link to comment
Share on other sites

What you are displaying is a Regular Expression (Grep Pattern) and Filemaker doesn't use them very will. Most of the time it is better to either use the Grep find and replace before the data is imported, OR to use the substitute, left, right and middle functions to parse it out.

If this data is in a field all by itself, you can use the function to replace the "-" with ".". IF that is the case, try using the Menu, Replace Content function

with this calculation,

Substitute ( YourField; "-"; ".")

HTH

Lee

Edited by Guest
Link to comment
Share on other sites

I tried the following for a Validation calc and it appears to work.

//Validate Hex characters

not IsEmpty(Filter (Middle(MAC_Add;1;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;2;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;4;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;5;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;7;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;8;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;10;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;11;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;13;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;14;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;16;1) ;"ABCDEF0123456789")) and

not IsEmpty(Filter (Middle(MAC_Add;17;1) ;"ABCDEF0123456789")) and

//Validate semicolon as seperators

not IsEmpty(Filter(Middle(MAC_Add;3;1);";")) and

not IsEmpty(Filter(Middle(MAC_Add;6;1);";")) and

not IsEmpty(Filter(Middle(MAC_Add;9;1);";")) and

not IsEmpty(Filter(Middle(MAC_Add;12;1);";")) and

not IsEmpty(Filter(Middle(MAC_Add;15;1);";"))

There might be a better formula, not sure. *note I added the following auto-enter calc (set to replace existing value) for the Mac_Add field --- Upper(Mac_Add). This way lowercase hex characters are accepted.

Link to comment
Share on other sites

This topic is 6646 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.