Hello,
I have an app where my installers will need to enter the MAC address for a device they are installing. I am looking for assistance in validating that the data entered is a valid MAC address.
The MAC field they are using is setup as a text type.
MAC address must contain exactly 12 characters, where each character is equal to 0-9 or a-f.
Additional characters may be entered as separators, eg aa.00.bbโฆ or 00:de:9aโฆ.
What I would like to have happen is this:
TIA for any assistance you may be able to provide.
PS - Secondary question: is there any way to get a UPC or QR code reader data to be entered directly into the app in order to optimize data collection?
Solved! Go to Solution.
Iโve got it all inside a sample app:
https://www.appsheet.com/samples/An-app-to-autoformat-and-verify-MAC-address-entries?appGuidString=a...
AppSheet cannot do this.
@Steve do you mean that AS canโt parse text, or that it canโt manipulate entered data? Or something else?
Itโs parsing capabilities are extremely limited. For instance: no regular expressions.
Parsing generally (though I think @Aleksi has shown not always) requires a minimum of 2 columns. One to act as input and another to do all the parsing. For example, the easiest way to do it, would be to have the user enter just the 12 characters without any special characters. Then in the parsing column you would use LOWER() as well as insert the colons, and then you would only display this column in the future. You could take some other routes as well to accomplish the same thing.
Thanks. What other ideas do you have, can you explain in more detail?
I am specifically looking to validate the data entered. Reformatting the final data is easy enough with the included parsing functions. So I need to be able to evaluate each part of the MAC and make sure it represents a valid 2-byte hex value.
Iโm not entire sure how to pull it off, or if you can even craft it to do want you want it to. But Iโve seen examples of using [_THIS] in the Valid If to attempt to validate as you enter. I just donโt have any good ideas on how to use it in a way that could be useful. @Aleksi is surely the man for that kind of job.
The best Iโve been able to come up with is to do the validation at your data source. For instance, add a column to your spreadsheet with a formula that does the validation and outputs either the valid formatted address, or an error Indicator (#INVALID
, e.g.). The downside of this approach is it occurs as part of a sync, so wouldnโt be available as data is entered into the form, and wouldnโt be available at all off-line.
If Iโm understanding this correctly, you basically want to eliminate the need for someone to put in all the colons and such when entering the MAC address?
You would need to use a secondary column, one that uses a formula to derive itโs value:
This is just a matter of a bunnch of left() and Right() formulas nested inside each otherโฆ let me chew on it.
-----------------Edit-----------------
Okay, and the validationsโฆ the alphabet restrictions areโฆ
Iโve got it all inside a sample app:
https://www.appsheet.com/samples/An-app-to-autoformat-and-verify-MAC-address-entries?appGuidString=a...
Thanks @MultiTech_Visions. I will peruse that application and see if I can make it work for me.
Thanks for that, I wasnโt asking anyone to do the work for me. Your time and effort is appreciated!
I enjoy tough problems like this, itโs like a brain teaser for me.
A little of thisโฆ
Some of thatโฆ
itโs an easy way to get into a flow-state. One thing after anotherโฆ
Youโre welcome!
@MultiTech_Visions Iโd like to know how you made that a Sample App and got a link to share it in the forum post. I tried and failed to do it that way.
That said, I sent you an email invite for my reworked version. If you feel at all like looking at/trying to break my app, have at it.
Differences are that rather than restrict the users input, I have sheared away any invalid characters and tried to make a full mac from the parsed data. I can see my users copying/pasting in MAC addresses from other apps (and in various formats) to fill in this data so wanted to cover those angles also. I used one additional column (MAC F2) for working on the data, then put the final value into MAC Work. I changed the valid_if on the data entry field to reference MAC Work to make sure we have valid data so the user can save.
Formats that might be pasted in include:
00.55.da.40.37.8b dotted separators
00 55 da 40 37 9c space separators
00:55:DA:40:37:AD colon separators
005567123456 no separators
Nicely done.
To make something a sample app, thereโs a setting inside the app:
To configure what the sample app page says, thereโs a place inside the app editor to specify this stuff:
PS: If you wish for someone to take a look at the back end of your app, youโll need to add them as a colaborator.
I tried changing your permissions to โCan View Definitionโ. Does that work for you to see my expressions?
Sure did. Nice!
User | Count |
---|---|
18 | |
9 | |
8 | |
5 | |
5 |