Validation rules in access - database

I recently started learning and using microsoft access. However, I am afraid that there is something really bothering me. It's connected with the validation rules. So here is my problem:
I had to validate a field so that only letters could be written. Of course I googled it and found the proper syntax. (Is Null or Not Like "*[!a-z]*")
At first I tried with (Is Null or Like "*[a-z]*"), which I think should be the same as the above one. It's checking every symbol from the string whether it is between 'a'and 'z' and that is why it is used with the obelisk * symbols from the both sides. Am I right?
My question is: Why is the second one not working, although it is a double negative equivalent to the first one. Will be happy for any explanation. Thanks in advance!
P.S Sorry if the question seems useless for you but I really do want to figure out where I am mistaking.

Consider the string 'a1b'.
Like "*[!a-z]*" will search the string for any character that is not in the range 'a'..'z'. It finds the '1' in the second position and returns True. Therefore, Not Like "*[!a-z]*" returns False.
On the other hand, Like "*[a-z]*" searches the string for any character that is in the range 'a'..'z'. It finds the 'a' in the first position and returns True.

Related

Remove all numbers from a string using LAMBDA recursive function

I've been following the guide on Exceljet for how to create a recursive LAMBDA function that removes all numbers from a string. For example, A1B2C3D4E5 becomes ABCDE.
The only thing I wanted differently was to have the string containing the character omissions stored inside the function rather than the cell. So, I took away the chars parameter from the opening line and used the LET function to store the string.
The problem is I keep getting a #VALUE! error and can't work out why.
=LAMBDA(str,sub,
LET(chars,"0123456789",
IF(chars="",str,
ReplaceChars(
SUBSTITUTE(str,LEFT(chars),sub),
MID(chars,2,LEN(chars)-1),
sub
)
)
))
A nested LET() in a recursive LAMBDA() is going to be troublesome since every time you'd use the variable in the recursion you'd start from scratch. Replacing characters will therefor never stop (if my interpretation of this is correct). But in your case you don't even need to make a recursive LAMBDA() to replace numbers, for example:
=LAMBDA(str,LET(X,MID(str,SEQUENCE(LEN(str)),1),CONCAT(IF(ISNUMBER(X*1),"",X))))
Core of this function is now:
=LET(X,MID(A1,SEQUENCE(LEN(A1)),1),CONCAT(IF(ISNUMBER(X*1),"",X)))
which can be used outside of LAMBDA() just fine. We can even replace this with
=LET(X,MID(A1,SEQUENCE(LEN(A1)),1),CONCAT(IF(ISNUMBER(FIND(X,"0123456789")),"",X)))
to do the same thing with any character you want to replace.
Now you can call =REPLACECHARS(A1). However, IMHO the beauty of the use of variables is now lost and the original approach (for example here would have my personal preference.

Is there a way to sort a no. of character arrays in alphabetical order without using the #include<string.h> or #include<stdlib.h>?

So, I have tried to do the same in a case of array of structures where 'char name[100]' is the only data member.
1st part of the code
2nd part of the code
The problem that I have encountered here is that once I provide a no. of names during program runtime, the output screen either does not print anything afterwards, or, prints the data without sorting it.
output screen
I did not get any compile time errors so I believe that there is a flaw in the logic.
There's this another method I tried hoping to get positive results. I type-casted characters to integers hoping that ASCII values could be used to compare. But, the results are exactly the same (undesired results).
updated logic of the 2nd part of the code
I hope somebody helps me find a way to correct this logic or provide another logic that is efficient.
the sorting logic you used is good , but from what is see the use of function's in C need's to be provided by pointers. other wise all the data inside the function will born and die inside the function , and the all the variables in the Main will stay the same as given, that explains why the output is the same as the input
try to print inside the sorting function's to see if this is the problem.

How can we handle truncated label or text

In order to test few features of the application I need to validate long alphanumeric string. And this string/label/text (whatever you can call here) supposed to truncate once given by user.
I googled and tried to find - 'how to validate truncated string ' and did not find useful info so thought question should be here.
Challenge - I can write up a xpath for long string to validate the tag/label/text/string itself but complex part is string shows few dotes (ex thisIsLongStrin.....) at the end when got truncated.
I would like to make sure that these 'dotes' are displaying when long string is given by user.
Remember I can not see these 'dotes' in page source.
any thoughts or suggestions on this ?
Thanks guys in Advance.........!!!!!
suppose string is : "thisIsLongString"
on page it shows after truncating : "thisIsLongStri..."
this is what working:
//*[#class='abc']//*[contains(text(),'thisIsLongString')]
this is what working:
//*[#class='abc']//*[contains(text(),'thisIsLongStri')]
this is Not working :
//*[#class='abc']//*[contains(text(),'thisIsLongStrin...')]
(since dotes are not part of page)
I am not sure what should be the approach to make sure that these dotes are there.
Truncated text is the result of applying CSS property text-overflow: ellipsis. To check whether text truncated or not, you can use Selenium built-in method:
Python example
element = driver.find_element_by_xpath("//*[#class='abc']//[text()='thisIsLongString']")
assert element.value_of_css_property("text-overflow") == "ellipsis"
P.S. Of course you should also check (if you don't know for sure) whether string is long enough to be truncated as even if text-overflow: ellipsis property is applied, short string will NOT be truncated, so it might looks like
assert element.value_of_css_property("text-overflow") == "ellipsis" and len(element.text) > 20
This should check whether property applied and length of string is greater than 20 characters...

How to select options based on character user input stored in an array in C?

I may have worded that strange, but if you need clarification I can provide it. I'm a complete noob to coding and am learning to use C language.
I have printed out a menu of options for the user to select. The user input is read and stored into a character array. I then printed out the string back to the user. So far everything works to this point.
My issue is selecting an option based on this character input.
I tried using strcmp inside if-else statements but never get the correct output.
Can someone point me into the right direction?

How to check if Fortran array contains value?

I've seen this asked for other languages, but having just found out how nicely Fortran can handle arrays, I thought there might be an easy way to do this without loops.
Currently I'm searching over a 3D array looking at 'nearest neighbours' to see if they contain the letter 'n', and whenever it finds this value, I want it to perform some clusterLabel assignment (which isn't relevant for this question)
I wanted to use if(lastNeighArray.eq."n") then...<rest of code>
but for obvious reasons it doesn't like checking an array against a value. Neither does it like me using lastNeighArray(:), even though I'd like it to check each of the elements one at a time. where(lastNeighArray.eq."n") doesn't work as I have a case statement inside the where loop and I get the error WHERE statements and constructs must not be nested.
So I'm a little stuck. What I really want is something like when(lastNeighArray.eq."n") but that doesn't exist.
I've also looked at any and forall but they don't seem like the right choice.
ANY should actually be the right choice
if ( ANY( lastNeighArray=="n" ) ) then
there is also ALL if you wanted the whole array to contain that value.

Resources