Filter local Table

Here am trying to create location guide tour, the locations will be shown on a map and the user only need to click on the marker and he will get the required information.

image

to do that I connected to Google Sheets , then i created function to store the values to a local table

The idea was to display the location information (lati, longi ,titles, desc), it is working fine,
but when I clicked on a map makers i need to to display the specific information about that locations. to do that i created the following:

image

To be honest i don’t know how to filter the local table which contains the whole information and get only the specific location info

1 Like

It looks like you’ve done most of the work here. The one problem I see right away is that you are getting the value from row id “id”. That needs to be an actual row id from your database. Try putting tbIndex in that row value and see if it works.

1 Like

yes… you are right… I stuck with that, I don’t know what is the next step

I don’t know how to handle local table…when it contains the data, i couldn’t find any way to filter it

Your onMarkerPress will not work because there is no row id and none of your variables has the row id for that specific row saved.

One way is to use the tbIndex but you will need in list [list of values and use the ID column for that table.

Another issue is the way you populate the local table. You are retrieving all rows for each column to create every matching record. It would work now but when you have 200 rows or more it will be very slow.

This is just an opinion.

Thank you muneer for your valuable comments …Sir what is your suggestions…is there any guide lines to follow… please am still new. I was thinking this is the best way

1 Like

Instead of querying the database with every record, Retrieve all the wanted columns all in lists and then loop through the list.

For example, If I want my local table to get the item name and item price from my sheet, I will have 2 lists
image

And in my code will get the required columns before going into the loop

My loop will be from 1 to number of records in my table and will create a row in my local table from the lists already created and will not need to use [list of values …] every time.

You might not notice a difference now but when you have hundreds of records this approach is much faster.

Thank you muneer, I will change it right now… but am still buzzled by how to filter the table once I filled it with records… how to search for a particular value…it seems very difficult mission. please if you have time could you help …

1 Like

see my Shopping List Project and if you need help or more explanation then I can explain the part not clear to you.

Excellent Example. Sir…a lot of tricks and workout coding. I really learned a lot…from your example… and i will re-write my application. Based on the codes in your example…

please one thing … regarding the table there is no way to query it directly, because the values already stored there.

1 Like

I didn’t understand your question.
Can you elaborate?

Sorry… for that… ok… what am trying to say is that, in my case I created a local table then I filled with data from my google sheets. once the data inside that table. my question… is there any way to query it directly.

Here I create a loop and I filled ListOfLoc, with the data, can i query those data later on…

1 Like

Yes, you can query the data while still in your sheet and you can as well query it after populating the local table. It is your choice.

If you see my Shopping Example, I was querying the main table and only insert in the local table the records I select from the query.

yes …

what puzzled me is the SelectedCategory…I was traying to compare it with my data, in my case It was latitudes…the user will click on the map markers then he will get the latitude for that location…then my problem started here…how to search the main table …from your example above you got a list of row ids, then we are going to select a row in the table and compare cat code with the one which was selected from the data viewer list (first step) … if we got the correct result the data will be transferred to another table “SelectedCat”, then we can display that data to the user…Is that correct…
Excuse me… muneer for all these details…

1 Like

Yes this is correct.

This is why I use a list of IDs because you can get any row from the table by ID


The get value block needs ID this is why I use a list of IDs in the table.

Yes… Your are right… am now working on your solution and re-write the codes in my application… thank you muneer it was a great help…and a way of think…

Thank you :clap: :clap: :clap: :clap:

Thank you Sir… it works…

image

1 Like

I’m glad it worked for you.

Thank…I learned a lot now am working on change the codes in my app…

:slight_smile:

1 Like

This is the final code…

If there is any suggestions… or changes needed please help me to clear it…

1 Like