Android Question Suggestion Needed for SearchView

epiCode

Active Member
Licensed User
I have a csv like this with around 200 rows

Name, Description, Header, Age

I wish to have a SearchView where a list is displayed with matching results however, I would like to show only name but allow user to match on any of the fields above. for example putting 30 shows all names with 30 in any of the columns.

1. Is it possible with any of current SearchView Options like SearchView, SQLSearchView, FTS etc?
2. Since the number of rows is not going to be very large is it better to use an in memory index or sql ?

Please Suggest.
Thanks !
 
Solution
200 rows is definitely an in-memory job.

This might do the job: (the yellow highlighting was added manually)




Click the copy icon at the top-right of the code box below, then go to B4J, click in code window, Ctrl+A to select all, Ctrl+V to paste, F5 to compile and run. What could possibly go wrong?

Copy-and-paste this over top of fresh B4J UI project::
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
 
    Private SearchTextField As TextField
    Private SearchListView As ListView

    Dim Showable() As String         'appears in displayed list
    Dim Searchable() As...

emexes

Expert
Licensed User
How many entries are to be searched?

100?

or 10,000?

or 1,000,000?

If 100, then just do in memory. In fact, just three days ago I set up in Excel this exact thing for a friend, and it works great. Better than great, even.

If 1,000,000 then probably best to use a database manager with either full text search, or with a table of all words and which lines they're on.

10,000 is a six-of-one-half-dozen-of-the-other decision. ?
 
Upvote 0

epiCode

Active Member
Licensed User
200 rows as mentioned
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Please Suggest.
One option is B4XTable that has a built in search feature. You load the text file from assets directly into the B4XTable using StringUtils or CSVparser. Then you can search and display only the items you want. If you decide to use B4XTable and get stuck we, at the forum can help you. Many members know the ins and outs of this tool. B4XTable uses an in memory table for the data you import.
 
Upvote 0

epiCode

Active Member
Licensed User
I am fairly conversant with b4xtable since I have used it in a project, however it is not what I need here.

I liked your example of FTS4 which you have shared in forum but like other search views they are all 1 dimensional and work with only a single list of data.
 
Upvote 0

epiCode

Active Member
Licensed User
Can you explain what you mean by the above sentense. Can you give an example of what your text file looks like
Shared in Original Post:
What I mean by this is that all these SearchViews/FTS methods require a single list as input.

In my case:
Input has multiple columns. Search Match can happen across the row, but only 1st column of matched row should be displayed.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I am fairly conversant with b4xtable since I have used it in a project, however it is not what I need here.
Are you aware thet you can assign a column width of 1dip to each of the B4XTable columns you do not want to display when you are doing the search. The search will still include those columns in addition to the first column, but their data is hidden. In essence, you are doing a search across each row, but display only the 'Name' column in your case. If this is still not acceptable, keep asking and show a sample of your text file.
 
Upvote 0

epiCode

Active Member
Licensed User
yes i am aware of it but it restricts results to page views, which is fine when working with data. Here the objective is search only.

John, Software Developer, Manager, 32
Jane, Marketing Coordinator, Assistant Manager, 27
Robert, Customer Support Representative, Team Lead, 35
Jessica, Human Resources Manager, Director, 40
Michael, Sales Representative, Associate, 28
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Here the objective is search only.
Ok. I got you. Have you thought of xClv with items composed of 4 labels. You can use a B4XFloatEditText for the search. The data from the text file can be imported from the text file to a SQLite database table where you can perform searches using the query syntax and the B4XFloatTextFIeld text input. Sub B4XFloatTextField_TextChanged (Old As String, New As String). You can hide the 3 labels you do not want to see, vertically scrollable. If you have and tried, but not happy with the results, perhaps someone can still help you achieve your goal.
 
Upvote 0

emexes

Expert
Licensed User
200 rows is definitely an in-memory job.

This might do the job: (the yellow highlighting was added manually)




Click the copy icon at the top-right of the code box below, then go to B4J, click in code window, Ctrl+A to select all, Ctrl+V to paste, F5 to compile and run. What could possibly go wrong?

Copy-and-paste this over top of fresh B4J UI project::
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
 
    Private SearchTextField As TextField
    Private SearchListView As ListView

    Dim Showable() As String         'appears in displayed list
    Dim Searchable() As String       'actually searched
    
    Dim Show As List                 'list of Showables to show in SearchListView
    
    Dim DiagnosticToggleButton As ToggleButton
    
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    '''MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
 
    SearchTextField.Initialize("SearchTextField")
    MainForm.RootPane.addnode(SearchTextField, 10, 10, 200, 20)
 
    SearchListView.Initialize("SearchListView")
    MainForm.RootPane.addnode(SearchListView, 10, 40, 200, 520)

    DiagnosticToggleButton.Initialize("DiagnosticToggleButton")
    DiagnosticToggleButton.Text = "Diagnostic Mode"
    MainForm.RootPane.addnode(DiagnosticToggleButton, 10, 570, 150, 20)

    LoadData
 
    FillShowAll
    UpdateSearchListView
    
End Sub

Private Sub SearchTextField_TextChanged (Old As String, New As String)
 
    '''Log("TextChanged" & TAB & Old & TAB & New)
 
    If New.EndsWith("  ") Then    'shortcut to clear string
        SearchTextField.Text = ""
        Return
    End If
 
    Dim LookFor() As String = StringToWords(New)
    For I = 0 To LookFor.Length - 1
        LookFor(I) = " " & LookFor(I)    'add space to start of each word (to prevent mid-word matches)
    Next

    Show.Initialize
    For I = 0 To Searchable.Length - 1
        If CountMatchingWords(Searchable(I), LookFor) = LookFor.Length Then
            Show.Add(I)
        End If
    Next
 
    UpdateSearchListView

End Sub

Sub CountMatchingWords(LookIn As String, LookFor() As String) As Int

    'both LookIn and LookFor are all lowercase, and start with a space
    
    Dim N As Int = 0
    For I = 0 To LookFor.Length - 1
        If LookIn.Contains(LookFor(I)) Then
            N = N + 1
        End If
    Next
 
    Return N
 
End Sub

Sub FillShowAll
 
    Show.Initialize
    For I = 0 To Showable.Length - 1
        Show.Add(I)
    Next

End Sub

Sub UpdateSearchListView

    If DiagnosticToggleButton.Selected Then
        SearchListView.PrefWidth = 580
    Else
        SearchListView.PrefWidth = 200
    End If

    SearchListView.Items.Clear
    For I = 0 To Show.Size - 1
        If DiagnosticToggleButton.Selected Then
            SearchListView.Items.Add(Showable(Show.Get(I)) & TAB & TAB & Searchable(Show.Get(I)))
        Else
            SearchListView.Items.Add(Showable(Show.Get(I)))
        End If
    Next
 
End Sub

Private Sub DiagnosticToggleButton_SelectedChange(Selected As Boolean)
    
    UpdateSearchListView
    
End Sub

Sub TidyUpSearchString(S As String) As String

    Dim ReplaceWithSpaces As String = "-=;:()[]{}<>,./\|'?!#$*&%"    'hmm pretty much every non-alphanumeric

    For I = 0 To ReplaceWithSpaces.Length - 1
        Dim F As String = ReplaceWithSpaces.CharAt(I)
        S = S.Replace(F, " ")
    Next
 
    Do While S.Contains("  ")
        S = S.Replace("  ", " ")
    Loop
 
    Return S.Trim.ToLowerCase

End Sub

Sub StringToWords(S As String) As String()
 
    If S.Trim.Length = 0 Then
        Return Array As String()
    Else
        Return Regex.Split(" ", TidyUpSearchString(S))
    End If
 
End Sub

Sub LoadData

    Dim ShowableList As List
    Dim SearchableList As List
    
    ShowableList.Initialize
    SearchableList.Initialize
 
    Dim Lin() As String = Regex.Split("\n", SampleData)    'split sample data into lines
    For L = 0 To Lin.Length - 1
        If Lin(L).Trim.Length <> 0 Then
            Dim Col() As String = Regex.Split(",", Lin(L))    'split line into fields / columns
        
            If Col.Length >= 2 Then
                Dim FirstLastName As String = Col(0).Trim & " " & Col(1).Trim
                ShowableList.Add(FirstLastName.Trim)

                SearchableList.Add(" " & TidyUpSearchString(Lin(L)))    'search all words on line
            Else
                Log("WTF" & TAB & L & TAB & Lin(L))
            End If
        End If
    Next
 
    'now we know how many, can Dim arrays
 
    Dim Showable(ShowableList.Size) As String
    Dim Searchable(ShowableList.Size) As String
 
    'copy lists to arrays
 
    For I = 0 To ShowableList.Size - 1
        Showable(I) = ShowableList.Get(I)
        Searchable(I) = SearchableList.Get(I)
    Next
 
    If True Then    'sort if you like
        Dim Gap As Int = Showable.Length
    
        Do While True
            Gap = Floor(Gap / 1.3)
            If Gap < 1 Then
                Gap = 1
            End If
        
            Dim DoneFlag As Boolean = (Gap = 1)
    
            For I = 0 To Showable.Length - 1 - Gap
                If Showable(I).CompareTo(Showable(I + Gap)) > 0 Then
                    Dim Swapper As String = Showable(I)
                    Showable(I) = Showable(I + Gap)
                    Showable(I + Gap) = Swapper
                
                    Dim Swapper As String = Searchable(I)
                    Searchable(I) = Searchable(I + Gap)
                    Searchable(I + Gap) = Swapper
                
                    DoneFlag = False
                End If
            Next

            If DoneFlag Then
                Exit
            End If
        Loop
    End If
    
End Sub

Sub SampleData As String
 
    Return $"Alexander, Jones, Sales, Analyst, Associate, 24, Turkey, Ankara
Maria, Cox, Marketing, Representative, Assistant Manager, 55, Chad, N'Djamena
Tyler, Ross, Sales, Representative, Team Lead, 25, Kazakhstan, Nur-Sultan
Julie, Bennett, Production, Representative, Director, 56, Indonesia, Jakarta
Olivia, Roberts, Quality Control, Developer, Manager, 51, Jordan, Amman
Joyce, Martin, Sales, Developer, Assistant Manager, 53, Australia, Perth
Jennifer, Phillips, Customer Support, Dogsbody, Director, 35, Laos, Vientiane
Brian, Lopez, Customer Support, Analyst, Director, 23, UK, London
Paul, Robinson, Customer Support, Manager, Director, 48, Thailand, Bangkok
Austin, Jackson, Customer Support, Representative, Associate, 25, Niger, Niamey
Brittany, Bell, Sales, Analyst, Associate, 21, Latvia, Riga
Christina, White, Documentation, Manager, Associate, 40, Monaco, Monaco
Jack, Brooks, Software, Analyst, Assistant Manager, 43, Egypt, Cairo
Christopher, Rivera, Software, Manager, Director, 56, Morocco, Rabat
Mary, Bennett, Customer Support, Representative, Team Lead, 53, Micronesia, Palikir
Linda, Morales, Human Resources, Representative, Director, 23, Syria, Damascus
Noah, Miller, Software, Developer, Assistant Manager, 35, Tuvalu, Funafuti
Rachel, Roberts, Quality Control, Coordinator, Director, 27, Saint Vincent and the Grenadines, Kingstown
Ronald, Wilson, Software, Representative, Team Lead, 19, Cuba, Havana
Teresa, Flores, Marketing, Coordinator, Team Lead, 37, Kenya, Nairobi
Edward, Robinson, Production, Dogsbody, Assistant Manager, 20, Slovenia, Ljubljana
Timothy, Hernandez, Human Resources, Manager, Manager, 43, Cambodia, Phnom Penh
Sharon, Reed, Human Resources, Dogsbody, Team Lead, 31, Guinea, Conakry
Melissa, Scott, Marketing, Developer, Director, 56, Vanuatu, Port Vila
Ralph, Evans, Documentation, Analyst, Associate, 39, Libya, Tripoli
Carolyn, Nguyen, Production, Coordinator, Assistant Manager, 33, Tonga, Nuku'alofa
Janice, Richardson, Marketing, Coordinator, Assistant Manager, 36, Cape Verde, Praia
Harold, Perez, Customer Support, Coordinator, Assistant Manager, 21, Ivory Coast, Yamoussoukro
Willie, Fisher, Customer Support, Manager, Team Lead, 46, Montenegro, Podgorica
Susan, Gutierrez, Production, Analyst, Team Lead, 52, Seychelles, Victoria
Kathryn, Clark, Sales, Developer, Manager, 46, Trinidad and Tobago, Port of Spain
Megan, Russell, Documentation, Manager, Director, 34, Germany, Berlin
Donna, Gray, Customer Support, Representative, Team Lead, 42, Burundi, Gitega
Louis, Bell, Marketing, Analyst, Associate, 21, Togo, Lome
John, Gonzalez, Human Resources, Developer, Assistant Manager, 36, Brunei, Bandar Seri Begawan
Peter, Thomas, Human Resources, Analyst, Team Lead, 38, Afghanistan, Kabul
Doris, Hernandez, Software, Analyst, Assistant Manager, 20, Singapore, Singapore
Kelly, Davis, Customer Support, Coordinator, Manager, 49, Rwanda, Kigali
Benjamin, Anderson, Quality Control, Manager, Associate, 29, Antigua, Saint John's
Jerry, Smith, Documentation, Representative, Manager, 30, San Marino, San Marino
Christian, Ward, Sales, Coordinator, Assistant Manager, 36, Venezuela, Caracas
Terry, Jackson, Quality Control, Analyst, Team Lead, 22, Zimbabwe, Harare
Virginia, Foster, Software, Manager, Assistant Manager, 49, Philippines, Manila
Victoria, Flores, Sales, Analyst, Manager, 41, Yemen, Sana'a
James, Rivera, Marketing, Dogsbody, Director, 27, Panama, Panama City
Arthur, Wilson, Production, Analyst, Associate, 27, Japan, Tokyo
Anthony, Johnson, Customer Support, Developer, Team Lead, 26, Fiji, Suva
Danielle, Cooper, Quality Control, Analyst, Director, 37, Maldives, Male
Jean, Clark, Marketing, Analyst, Team Lead, 45, Kuwait, Kuwait City
Bruce, Young, Sales, Representative, Manager, 45, Serbia, Belgrade
Jordan, Myers, Customer Support, Coordinator, Team Lead, 41, Belize, Belmopan
Jeremy, Baker, Human Resources, Developer, Manager, 26, Uruguay, Montevideo
Diana, Martinez, Sales, Coordinator, Assistant Manager, 37, Jamaica, Kingston
Madison, Lewis, Customer Support, Analyst, Associate, 54, Ghana, Accra
Wayne, Campbell, Sales, Analyst, Team Lead, 26, Australia, Brisbane
Sophia, Jones, Human Resources, Manager, Manager, 50, Tunisia, Tunis
Stephen, Watson, Customer Support, Manager, Associate, 34, South Africa, Pretoria
Jane, Rogers, Documentation, Dogsbody, Associate, 41, Czech Republic, Prague
Lori, Wood, Documentation, Coordinator, Team Lead, 37, Bosnia, Sarajevo
Sandra, Butler, Marketing, Analyst, Assistant Manager, 18, Israel, Jerusalem
Natalie, Murphy, Human Resources, Developer, Manager, 35, Australia, Melbourne
Ethan, Phillips, Production, Representative, Manager, 33, El Salvador, San Salvador
Amber, Nelson, Human Resources, Coordinator, Team Lead, 18, Spain, Madrid
Hannah, Cruz, Documentation, Analyst, Associate, 56, Canada, Ottawa
Evelyn, Collins, Sales, Developer, Team Lead, 25, Palestine, Jerusalem
John, Turner, Sales, Analyst, Assistant Manager, 55, USA, Melbourne
Vincent, Carter, Quality Control, Representative, Team Lead, 45, Ecuador, Quito
Samantha, Hill, Software, Representative, Team Lead, 35, Sweden, Stockholm
Lisa, Peterson, Production, Representative, Manager, 54, Wales, Cardiff
Alexis, Harris, Customer Support, Manager, Director, 32, Guatemala, Guatemala City
Frances, Edwards, Quality Control, Manager, Team Lead, 21, Mauritius, Port Louis
Kayla, Thomas, Software, Coordinator, Assistant Manager, 31, India, New Delhi
Barbara, Myers, Production, Manager, Manager, 23, Somalia, Mogadishu
Patrick, Sanders, Software, Representative, Director, 38, Ireland, Dublin
Judy, Evans, Software, Manager, Manager, 37, South Korea, Seoul
Gregory, Murphy, Production, Developer, Assistant Manager, 49, Dominican Republic, Santo Domingo
Laura, Powell, Sales, Analyst, Director, 35, Brazil, Brasilia
Brandon, Young, Production, Representative, Manager, 56, Saint Lucia, Castries
Andrew, Walker, Software, Representative, Associate, 48, Tajikistan, Dushanbe
Debra, Davis, Production, Developer, Team Lead, 25, Mali, Bamako
Alice, Walker, Quality Control, Representative, Assistant Manager, 52, Nicaragua, Managua
Ruth, Taylor, Software, Analyst, Director, 28, Luxembourg, Luxembourg
Helen, Diaz, Sales, Developer, Director, 18, Saudi Arabia, Riyadh
Jacqueline, Thompson, Marketing, Manager, Director, 27, South Sudan, Juba
Dorothy, Hall, Documentation, Coordinator, Director, 39, Congo, Brazzaville
Patricia, Scott, Software, Developer, Manager, 48, Turkmenistan, Ashgabat
Marie, Brooks, Software, Manager, Team Lead, 51, Malaysia, Kuala Lumpur
Jesse, Kelly, Quality Control, Developer, Manager, 45, Colombia, Bogota
Jessica, James, Production, Coordinator, Assistant Manager, 24, Chile, Santiago
Bryan, Ramirez, Documentation, Coordinator, Director, 30, Belgium, Brussels
Gloria, Mitchell, Sales, Analyst, Associate, 51, Australia, Sydney
Alan, Turner, Documentation, Analyst, Director, 34, Guinea-Bissau, Bissau
Cynthia, Lee, Quality Control, Representative, Director, 24, Vatican City, Vatican City
Richard, Cook, Human Resources, Dogsbody, Team Lead, 51, Hungary, Budapest
Joan, Green, Human Resources, Analyst, Associate, 49, Mozambique, Maputo
Ryan, Martin, Human Resources, Coordinator, Associate, 43, Swaziland, Mbabana
Kimberly, Bailey, Documentation, Developer, Assistant Manager, 20, Kosovo, Pristina
Jessica, Anderson, Customer Support, Coordinator, Director, 28, New Zealand, Wellington
Jeffrey, Brown, Documentation, Manager, Assistant Manager, 45, Eritrea, Asmara
Steven, Perry, Documentation, Manager, Director, 44, Samoa, Apia
Matthew, Howard, Sales, Dogsbody, Manager, 56, Namibia, Windhoek
Anna, King, Production, Manager, Associate, 18, United Arab Emirates, Abu Dhabi
Judith, Johnson, Software, Developer, Director, 32, Nigeria, Abuja
Gary, Nelson, Human Resources, Coordinator, Associate, 54, Kyrgyzstan, Bishkek
Thomas, Butler, Quality Control, Developer, Director, 36, Iran, Tehran
Amanda, Mitchell, Documentation, Coordinator, Manager, 44, Guyana, Georgetown
Lawrence, Cruz, Documentation, Manager, Assistant Manager, 34, Iraq, Baghdad
William, Collins, Quality Control, Developer, Team Lead, 28, Burma, Nay Pyi Taw
Carol, Trump, Software, Developer, Associate, 56, Qatar, Doha
Deborah, Long, Human Resources, Coordinator, Manager, 18, Paraguay, Asuncion
Jose, Adams, Sales, Coordinator, Manager, 44, Peru, Lima
Douglas, Williams, Human Resources, Manager, Team Lead, 38, Scotland, Edinburgh
Emma, Morris, Sales, Coordinator, Team Lead, 56, Northern Ireland, Belfast
Andrea, Hill, Documentation, Manager, Team Lead, 49, Sierra Leone, Freetown
Mason, Morales, Marketing, Coordinator, Team Lead, 36, Netherlands, Amsterdam
Raymond, Ramirez, Marketing, Developer, Manager, 33, Azerbaijan, Baku
Keith, Cook, Marketing, Manager, Assistant Manager, 48, Bahrain, Manama
Adam, Watson, Human Resources, Representative, Associate, 27, Sao Tome and Principe, Sao Tome
Gabriel, Thompson, Marketing, Analyst, Assistant Manager, 39, East Timor, Dili
Pamela, Moore, Production, Developer, Assistant Manager, 36, Slovakia, Bratislava
Denise, Edwards, Customer Support, Coordinator, Associate, 33, Barbados, Bridgetown
Elizabeth, Perry, Production, Analyst, Director, 44, Nepal, Kathmandu
Charlotte, Williams, Production, Analyst, Manager, 50, Lithuania, Vilnius
Brenda, Torres, Marketing, Developer, Team Lead, 22, Honduras, Tegucigalpa
Elijah, Russell, Software, Representative, Team Lead, 22, Finland, Helsinki
Juan, Allen, Documentation, Coordinator, Director, 46, Malta, Valletta
Dylan, Gutierrez, Customer Support, Developer, Director, 27, Taiwan, Taipei
Kyle, Jenkins, Software, Dogsbody, Team Lead, 37, Algeria, Algiers
Philip, Sanders, Production, Developer, Manager, 57, Angola, Luanda
Roy, Gonzalez, Customer Support, Manager, Assistant Manager, 32, Georgia, Tbilisi
Kenneth, Sullivan, Human Resources, Dogsbody, Team Lead, 48, Poland, Warsaw
Christine, Williams, Human Resources, Coordinator, Team Lead, 40, Gambia, Banjul
Theresa, Ward, Human Resources, Developer, Manager, 45, Liechtenstein, Vaduz
Samuel, Reed, Customer Support, Analyst, Assistant Manager, 33, Bolivia, Sucre
Frank, Reyes, Customer Support, Manager, Director, 25, Papua New Guinea, Port Moresby
Nicole, Rogers, Marketing, Dogsbody, Director, 54, Dominica, Roseau
Eugene, Sullivan, Documentation, Representative, Manager, 21, Lebanon, Beirut
Carl, Sanchez, Marketing, Representative, Associate, 55, Bhutan, Thimphu
Daniel, Adams, Quality Control, Representative, Director, 53, Equatorial Guinea, Malabo
Aaron, Perez, Customer Support, Coordinator, Team Lead, 22, Mexico, Mexico City
Scott, Barnes, Quality Control, Manager, Associate, 25, North Macedonia, Skopje
Amy, Diaz, Marketing, Coordinator, Director, 49, Oman, Muscat
Shirley, Lopez, Software, Developer, Associate, 31, Moldova, Chisinau
Robert, Parker, Customer Support, Coordinator, Manager, 24, Greece, Athens
Ashley, Hughes, Documentation, Developer, Assistant Manager, 20, Armenia, Yerevan
Mark, Long, Software, Developer, Assistant Manager, 55, Russia, Moscow
Sean, Garcia, Sales, Dogsbody, Manager, 37, Switzerland, Bern
Robert, Parker, Software, Representative, Assistant Manager, 41, China, Beijing
Jason, Fisher, Marketing, Coordinator, Assistant Manager, 41, Djibouti, Djibouti
Michael, Garcia, Customer Support, Analyst, Assistant Manager, 21, Austria, Vienna
Russell, Rodriguez, Software, Analyst, Assistant Manager, 57, Liberia, Monrovia
Donald, Johnson, Customer Support, Manager, Associate, 26, Bangladesh, Dhaka
Zachary, King, Sales, Analyst, Manager, 51, Iceland, Reykjavik
Michelle, Morgan, Human Resources, Representative, Associate, 30, Lesotho, Maseru
Angela, Richardson, Production, Analyst, Director, 18, Ethiopia, Addis Ababa
Kevin, Lee, Customer Support, Coordinator, Manager, 52, USA, Washington
Abigail, Jenkins, Human Resources, Developer, Team Lead, 50, Norway, Oslo
Emily, Ortiz, Human Resources, Manager, Associate, 57, Gabon, Libreville
Randy, Barnes, Production, Representative, Director, 26, Mongolia, Ulaanbaatar
Lauren, Cox, Production, Representative, Assistant Manager, 25, Malawi, Lilongwe
Nathan, Price, Documentation, Dogsbody, Team Lead, 24, Italy, Rome
Joshua, Ross, Quality Control, Manager, Associate, 32, Uganda, Kampala
Janet, Smith, Human Resources, Developer, Associate, 40, USA, Seattle
George, Baker, Customer Support, Representative, Associate, 39, France, Paris
Michael, Allen, Marketing, Coordinator, Team Lead, 43, Solomon Islands, Honiara
Heather, Stewart, Quality Control, Coordinator, Manager, 39, Mauritania, Nouakchott
Karen, White, Documentation, Dogsbody, Associate, 24, Congo, Kinshasa
Marilyn, Ortiz, Sales, Manager, Manager, 41, Pakistan, Islamabad
Diane, Kelly, Production, Manager, Assistant Manager, 44, Comoros, Moroni
Kathleen, Howard, Quality Control, Coordinator, Team Lead, 52, Grenada, Saint George's
Billy, Stewart, Sales, Representative, Assistant Manager, 43, Saint Kitts and Nevis, Basseterre
Sara, Wright, Documentation, Representative, Manager, 55, Marshall Islands, Majuro
Cheryl, Smith, Marketing, Manager, Manager, 47, Cameroon, Yaounde
Bobby, Rodriguez, Human Resources, Manager, Associate, 38, Romania, Bucharest
Betty, Martinez, Production, Manager, Director, 23, Ukraine, Kyiv or Kiev
Justin, Sanchez, Software, Representative, Associate, 56, England, London
Joseph, Morris, Software, Developer, Associate, 18, Andorra, Andorra la Vella
Margaret, Hughes, Production, Developer, Assistant Manager, 19, Portugal, Lisbon
Grace, Gomez, Sales, Manager, Director, 34, Sudan, Khartoum
Catherine, Wright, Production, Representative, Assistant Manager, 19, Kiribati, Tarawa Atoll
Joe, Peterson, Documentation, Dogsbody, Associate, 55, Botswana, Gaborone
Logan, Price, Marketing, Manager, Manager, 38, Sri Lanka, Sri Jayawardenapura Kotte
Jacob, James, Software, Coordinator, Associate, 40, Cyprus, Nicosia
Ann, Miller, Documentation, Analyst, Manager, 27, Senegal, Dakar
Roger, Foster, Human Resources, Analyst, Team Lead, 27, Madagascar, Antananarivo
Gerald, Nguyen, Marketing, Analyst, Associate, 41, Bulgaria, Sofia
Donald, Trump, Marketing, Developer, Team Lead, 51, Haiti, Port au Prince
Katherine, Morgan, Quality Control, Coordinator, Associate, 34, Croatia, Zagreb
David, Cooper, Software, Analyst, Assistant Manager, 50, Vietnam, Hanoi
Nancy, Taylor, Quality Control, Developer, Assistant Manager, 39, Tanzania, Dodoma
Albert, Hall, Documentation, Analyst, Associate, 28, Palau, Melekeok
Jonathan, Lewis, Production, Representative, Manager, 20, Central African Republic, Bangui
Martha, Gray, Marketing, Coordinator, Manager, 18, Albania, Tirana
Julia, Green, Human Resources, Representative, Team Lead, 39, Zambia, Lusaka
Henry, Carter, Quality Control, Dogsbody, Director, 57, Uzbekistan, Tashkent
Walter, Harris, Sales, Coordinator, Director, 20, Costa Rica, San Jose
Eric, Brown, Quality Control, Representative, Assistant Manager, 29, Denmark, Copenhagen
Beverly, Bailey, Marketing, Manager, Associate, 18, North Korea, Pyongyang
Rebecca, Torres, Quality Control, Developer, Manager, 47, Suriname, Paramaribo
Nicholas, Reyes, Sales, Analyst, Director, 28, Estonia, Tallinn
Dennis, Powell, Marketing, Developer, Associate, 48, Belarus, Minsk
Sarah, Moore, Quality Control, Representative, Manager, 40, Australia, Canberra
Larry, Wood, Quality Control, Representative, Manager, 28, Argentina, Buenos Aires
Isabella, Gomez, Quality Control, Developer, Director, 53, Benin, Porto Novo
Stephanie, Campbell, Sales, Manager, Director, 47, Bahamas, Nassau
"$

End Sub
 
Last edited:
Upvote 1
Solution

Mahares

Expert
Licensed User
Longtime User
Thanks @emexes. This is Perfect !!!
You may want to search for 'au'. The text file should show you 19 lines where a term contains 'au', but the b4J code supplied by Emexes shows only 8 lines. Something may still not be kosher with the code. I hope you prove me wrong since @emexes spent some valuable time coding it for you.

Actually, another option that will work is to modify the B4XSearchTemplate class module slightly and creae a project that will use the class instead of the one in the XUI Views lib, which will have to be renamed to say: MyB4XSearchTemplate and referred to it instead of the module in the XUI Views lib. You still need a reference to XUI Views lib.will work You would enter for instance 'au' and it will display the leading item of each line that contains 'au' across its content.
 
Upvote 0

emexes

Expert
Licensed User
You may want to search for 'au'. The text file should show you 19 lines where a term contains 'au', but the b4J code supplied by Emexes shows only 8 lines. Something may still not be kosher with the code.

Lol I'm going to have to start addressing you as Ol' Eagle Eye @Mahares ?

My search matches words beginning with "au" whereas I expect @epiCode has opted for the more-usual matching "au" anywhere, including inside words.

I've found that in real-life searching, most people always search for word starts, and the extraneous hits of inside-word searching cause more confusion than clarification.
 
Upvote 0

emexes

Expert
Licensed User
You may want to search for 'au'. The text file should show you 19 lines where a term contains 'au', but the b4J code supplied by Emexes shows only 8 lines.

I wasn't going to worry about what might be being missed, but... obviously this morning's coffee is doing its job. ?

Paul - I am pretty sure that the searcher would have first tried "pa"
Mauritius - I am pretty sure that the searcher would have first tried "ma" and then "mau"
Laura - I am pretty sure that the searcher would have first tried "la" and then "lau"
Saudi Arabia - I am pretty sure that the searcher would have first tried "sau" or maybe "arab"
Guinea-Bissau - I am pretty sure that the searcher would have first tried "gu" or maybe "bis" or quite possibly both
Roseau - I am pretty sure that the searcher would have first tried "ros"
Chisinau - I am pretty sure that the searcher would have first tried "chi"
Lauren - I am pretty sure that the searcher would have first tried "la" and then "lau"
Mauritania - I am pretty sure that the searcher would have first tried "ma" and then "mau"
Palau - I am pretty sure that the searcher would have first tried "pa" which would also match a variation of its name Palaos
Nassau - I am pretty sure that the searcher would have first tried "nas"

So matching by start-of-word rather than anywhere-in-word has culled the results clutter by more than half, without apparently losing anything useful.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…