match the query with the first letter of name - nativescript-angular

I have a search UI that is already working using Nativescript Angular but it only returns searched name after only typing that specific name in the search bar. So, I am trying to figure out how to return for example all the names that start with a letter (A). If I typed letter (A) in the searchbar.
I already tried to use \uf8ff but it returns all the names stored in the database when I just type any letter so I removed it.
const query: firestore.Query = firebase.firestore().collection("user")
.where("nameToSearch", ">=",searchValue)
.where("nameToSearch", "<=",searchValue)
}
-no expected
It shows the searched name only after fully typing the name not just by typing first letter.

Related

Excel - Auto increment value based on string search

I've got a set of data that needs updating to use the same "reference" value (auto-incrementing by .1 with each record found) where a name matches against the first two words.
Please see below for an example table with the desired format required below - is there a way to do this via an automated function in Excel?
Alternatively, I can use SQL Server to do this if easier.
Many thanks in advance
Name
Current Reference
DESIRED Reference
First Name
1001.1
1001.1
First Name Also
2123.1
1001.2
First Name Also With More Text
3456.1
1001.3
Second Name
4567.1
4567.1
Second Name Also
1232.1
4567.2
Second Name Also With More Text & Symbols
5890.1
4567.3

Excel, Split name with more than one words of first name or last name or middle name

How can I separate the last name middle initial and first name
I have a name with two or more given name or last name or middle name for example
Mendoza, John Lloyd Dela Cruz
Torres, Michael Pineda
How can i split that if I have different count of words per column? and get only the first letter for middle name? Is this possible? If not can you suggest me a solution. I have many data
Any help would be appreciated.
Your question is almost identical to this question:extract names in excel except you only want to return the initial for the middle name.
As a result, my following answer is pretty much the same as the one I gave to the above question except adding a little twist of finding the initial for the middle name.
Note: Method 1 will work in the case that first name contains only one word; Method 2 will work only if both first name and last name is one word.
Method 1 Using LEFT+RIGHT+MID+FIND functions
First Name: =MID(A2,FIND(",",A2)+2,FIND(" ",A2,FIND(" ",A2)+1)-FIND(",",A2)-2)
Middle Name: =LEFT(RIGHT(A2,LEN(A2)-FIND(" ",A2,FIND(" ",A2)+1)),1)
Last Name: =LEFT(A2,FIND(",",A2)-1)
The logic to find First Name is to find the position of ,(space) and the second (space) and return the characters in between. The logic for Middle Name is to find the second (space) and return whatever is on the right.
Method 2 Using FILTERXML+SUBSTITUTE functions
First Name: =FILTERXML("<data><a>"&SUBSTITUTE(SUBSTITUTE(A7,",","")," ","</a><a>")&"</a></data>","/data/a[2]")
Middle Name: =LEFT(FILTERXML("<data><a>"&SUBSTITUTE(SUBSTITUTE(A7,",","")," ","</a><a>")&"</a></data>","/data/a[3]"),1)
Last Name: =FILTERXML("<data><a>"&SUBSTITUTE(SUBSTITUTE(A7,",","")," ","</a><a>")&"</a></data>","/data/a[1]")
The logic is to use SUBSTITUTE to convert the full name into something like the following:
<data><a>Last Name</a><a>First Name</a><a>Middle Name</a></data>
Then use FILTERXML to return the desired name based on its order 1, 2 or 3 within the XML script.
For the logic behind this formula you may give a read to this article: Extract Words with FILTERXML.

Excel- Turn MARIA ANDERS to M.ANDERS as well as 99 other names, only if the first name is > 3 letters

I am trying to output a customer name using vlookup. The names are UPPERCASE but I need to limit them if the first name is longer than 3 characters, I need to just use the first letter of the first name. Here is the problem:
If the First name is longer than three characters you should just use the first character
of the first name and put a dot after that. For example if the customer name is “Steve
Johnson” the system should show “S. JOHNSON” or for “Ana Johnson” the system
should show “ANA JOHNSON”.
I should be able to do this without VB. Maybe an IF statement? Like if the first name is > 3 letters, take the first letter in the string?
Use Find to locate the space, and If test the position. Then either return the string as is, or manipulate the string to suit your needs. Wrap the whole thing in Upper to get upper case
=UPPER(IF(FIND(" ",A1)<=4,A1,LEFT(A1,1)&"."&MID(A1,FIND(" ",A1),999)))

Search function to send all variations of the text uppercase an lowercase

I have a function that uses an api to pull information based on the text given in the request.
The problem is that the text has to match the item exactly. Such as the item is named "Peach and Apple" and if you type "peach and apple" it will not return. You have to type "Peach and Apple" in order to properly request the item.
Is there a way I can send every variation of "Peach and Apple" (just incase is was something weird like "Peach and Le'Apple") with every variation of an uppercase letter?
I could make it uppercase every letter at the start of the string which is easy and would work with a lot of requests. Then I could uppercase every letter after a space which with the previous change would handle ALMOST every search.
The problem is I cannot make it uppercase every letter after a ' for this example(reason):
"Peach and Le'Apple" would work but "Peach and Apple's Leaf" would not work since the s is not uppercase. Thus is there a way to properly search for this?
Thanks for your time!!!
So I figured a way around it. The problem was that the items I was searching for had to be in the exact form. I was the one that saved those items from the api. So when I save them now I have 2 separate columns. One that saves the name with uppercase that will be what is shown on screen and another that saves the same name only purely converted to lowercase with toLowerCase(). This lets me search for the items and still keep the nice uppercase name without having to do some nasty logic I dont want to do.

Formula for text before and after space in a string

I'm attempting to create usernames based off of a given persons first and last name. Generally, we use the first initial and last name for a username. However, now many of our users have 2 last names and sometimes include a hyphen. I am trying to create a code that gives me the first initial, the first letter of the FIRST last name and then the last name.
For example --
Amy Smith-Jones ==
asjones
This is what I am currently using, but, of course, it would yield "asmithjones".
=LOWER(LEFT(A1,1)&SUBSTITUTE(SUBSTITUTE(A2,"-","")," ",""))
I've tried some variations of this, but with no luck.
=LOWER(LEFT(A1,1)&LEFT(A2,1)&SUBSTITUTE(SUBSTITUTE(A2,"-","")," ",""))
Is there a way to generate both the first letter of the first string and the full text of the 2nd string?
EDIT
I came up with something, but now I face another challenge
=IFERROR(LOWER(LEFT(D2,1)&SUBSTITUTE(SUBSTITUTE(RIGHT(F2,LEN(F2)-FIND(" ",F2&" ")),"-","")," ","")),LOWER(LEFT(D2,1)&SUBSTITUTE(SUBSTITUTE(F2,"-","")," ","")))
Some users have 1 last name so this applies if the formula comes across those. But I have some who have a hyphen instead of a space. The SUSTITUTE function accounts for both, but how can I make the FIND function do the same?
Try:
=LEFT(A1,1)&MID(A1,(SEARCH(" ",A1)+1),1)&RIGHT(A1,(LEN(A1)-(SEARCH(" ",(SUBSTITUTE(A1,"-"," ")),(SEARCH(" ",A1)+1)))))
Based on your edit, I'll assume first names are in column D and last names are in column F:
=LOWER(LEFT(D2) & IFERROR(LEFT(F2)&MID(F2,FIND("-",SUBSTITUTE(F2," ","-"))+1,99), F2))
SUBSTITUTE changes spaces to hyphens in the last name, so FIND can look for hyphens only.
IFERROR fails if a hyphen is not found (after substitution), in which case the entire last name is returned.
Example:

Resources