Is there a way to set an input mask in MS Access 2007 so that certain elements are optional? UK postcodes can be in a number of formats: LL00 0LL or L00 0LL or even LL00 L00LL. For this particular assignment, I need only worry about the first two formats.
So, is there a way for me to set the input mask so that the first letter is optional?
Found an answer here and can just use the following:
LA0# oLL
A defines a letter or digit and # defines a digit or a space and removes the space when inserted into database.
Don't bother. Just use a text field and let the users insert the blanks. Put some code in checking for approriate alphabetic vs numeric characters.
The advntage is this approach will work for any country.
Related
I have column in tableau with following values:
1234
3456
6789
camp-1
camp-2
camp-3
I only want to show filter with values
camp-1
camp-2
camp-3
How can I only select the alphabetic values in filter in tableau?
Your example is not clear about what you want to include and what you want to exclude. To explain better, I took an elaborated example
Case-1 If you want to search/filter for digits at start, use this calculated field
REGEXP_MATCH([Field1], '^[0-9]')
Case-2 If you want to search for numbers anywhere, use this
REGEXP_MATCH([Field1], '(.*)[0-9]')
Case-3 If digits only are required
REGEXP_MATCH([Field1], '^[0-9]+$')
case-4 for alphabet at start use this
REGEXP_MATCH([Field1], '^[:alpha:]')
Results of all matches are shown below
Note Combining numbers anywhere AND alphabet at start you can filter out case1, case2 and case3 only.
Good Luck
If the Tableau column contains a mixture of numbers and text, the column will be a text column and all content will be considered as text. This reduces the problem to that of identifying specific rows that contain non-numeric values.
This requires some string manipulation and comparison. If you know that the structure of the content in those rows is predictable (eg the first character is always a letter when there are non numeric characters in the row) then a simple equation will filter on those rows:
if ascii(left([Text And Numbers],1) )>57 then 'text' else 'number' END
This exploits the observation that the ASCII decimal code for the digit 9 is 57 and most of the ASCII characters with higher codes are letters or punctuation (which is a fair assumption if nothing other than numbers, letters or punctuation are present in your data).
Obviously, if letters and numbers could appear anywhere in the string you need a more complex function but Tableau provides the option to use regular expressions which can code much more complex text analysis like is any alphabetic character present in a string (see this for some ideas of the appropriate regex expressions).
I have a table of regular expressions that are in an MySQL table that I match text against.
Is there a way, using MySQL or any other language (preferably Perl) that I can take this list of expressions and determine which of them MAY overlap. This should be independent of whatever text may be supplied to the expressions.
All of the expression have anchors.
Here is an example of what I am trying to get:
Expressions:
^a$
^b$
^ab
^b.*c
^batch
^catch
Result:
'^b.*c' and '^batch' MAY overlap
Thoughts?
Thanks,
Scott
Further explanation:
I have a list of user-created regexes and an imported list of strings that are to be matched against the regexes. In this case the strings are "clean" data (ie they are not user-created but imported from another source - they must not change).
When a user adds to the list of regexes I do not want any collisions on either the existing list of strings nor any future strings (which can not be guessed ahead of time - the only constraints being they are ASCII printable characters no longer than 255 characters).
A brute-force method would be to create a "rainbow" table of all of the permutations of strings and each time a regex is added run all of the regexes against the rainbow table. However I'd like to avoid this (I'm not even sure of the cost) and so was wondering aloud as to the possibility of an algorithm that would AT LEAST show which regexes in a list MAY collide.
I will punt on full REs. Even limiting to BREs and/or MySQL-pre-8.0 will be challenging. Here are some thoughts.
If end-anchored and no + or *, the calculate the length. The fixed-length can be used as a discriminator. Also, it could be used for toning back the "brute force" by perhaps an order of magnitude.
Anything followed by + or * gets turned into .* for simplicity. (Re the "may collide" rule.)
Any RE with explicit characters (including those followed by +) becomes a discriminator in some situations. Eg, ^a.*b$ vs ^a.*c$.
For those anchored at the end, reverse the pattern and test it that way. (I don't know how difficult reversing is.)
If you can say that a particular character must be at any position, then use it as a discriminator: ^a.b.*c$ -- a in pos 1; b in pos 3; c at end. Perhaps this can be extended to character classes: ^\w may match, but ^\d and ^a.*\d$ can't.
I am designing a membership form and want only alphabets is textbox as username.
ng-pattern="/^\d{1,10}$/"
I tried it but it not works.
The pattern you're using will only get digits
/^\d{1,10}$/"
\d{1,10} matches a digit (equal to [0-9])
{1,10} Quantifier — Matches
between 1 and 10 times, as many times as possible, giving back as
needed
$ asserts position at the end of a line
If you want only alphanumeric characters try this:
/^[a-zA-Z]*$
It will accept any character a through z -- capital or lower case.
I'm trying to set input mask that allows user to enter MAC-address, which consists of hex characters: 0-9, A-F.
What I get so far is:
>AA\-AA\-AA\-AA\-AA\-AA
but this format allows to enter all alphabet characters.
The question is:
How to limit input mask range with hex characters?
You can't do this with an Input Mask, but you can with the Validation Rule property shown below. It will let them enter whatever they want, but it won't let them save the data until it meets your rule.
Not Like "*[!((a-f) or (0-9))]*"
Failing to find an adequate solution, I read the instructions, and came up with the following;
To limit entry to any Hexadecimal sequence preceded by "#". i.e #FF01A2 (pink/purple?)
Caveat - Be aware that Mask and Validation rules can create ambiguity between the data viewed and the data stored. The following rules store 6 characters not 7, excluding the "#" sign from the underlying data.
Input Mask - Automatically displays the pound sign and limits all subsequent entry to any combination of 6 numbers or letters. (The ">" operator changes any letter that follows it to capital. Preceding the pound sign with a backslash or enclosing it in quotes, makes it a literal.)
Either "#">AAAAAA or \#>AAAAAA will work.
Validation Rule - Limits entry to 0-9 and a-f only. (Case is modified by the input mask above. Since the input mask above limits entry to 6 characters, use of the asterisks outside the brackets here avoids redundancy in this rule.)
Not Like "*[!0-9A-F]*"
Validation Text - Optional but recommended, to give the user some context.
Must be in hex format: 0-9, A-F only! (Will display in a standard message box.)
Access Table Field Properties - shown below.
Note: I saw a lot of examples online that included the use of "Is Null", "OR", as well as individual rules for each character - I found all of these to be a bit redundant, if they worked at all.
I achieved this in in two parts:
An input mask of >"#"AAAAAA;0;_, This ensures the user can only enter # (which is prefilled in) and then six uppercase characters.
A validation rule of Like "[#][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F]" which ensures the field is # then six characters which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
This works very well for me and requires no VBA code.
I have a SSRS report with full of number fields. I would like to have that to be displayed as in one decimal. i tried to use F1. it gives me only one decimal points in html rendering, but in excel exported version it shows 2 decimal points.
How can i have just one decimal point both ecxel and html rendering.
Please comment.
Thanks in advance
San
Use N1 as your Format Property setting. N denotes Numeric formatting, the 1 denotes the number of decimal places, so N2 would give you 102.02, for example. This should carry to excel as it is rendered in html.
Alternatively, you could use the format code #,##0.00, which will give you the thousands separator and two decimal places. '#' indicates optional characters, whilst '0' indicates mandatory characters (nulls will be replaced by '0.00').
in 2012 version: FormatNumber(Fields!col.Value,2)
Right click on the text box that contains the value you would like manipulate, select TEXT BOX PROPERTIES. Navigate to the Number tab, select Number and the # of Decimal places you want the box to allow for.