I have pretty much nailed my project for work now after going round in circles and ending up where my foray into Google Maps and the Fusion table examples all began, with Derek Eder's Searchable Template examples. My challenge lies with the tickboxes and more importantly the data within the fusion table and the query. Derek's example (see link) relies solely on a column named 'Type' which contains a single numeric in any given row. Now I have the same column but where my challenge lies is that it can contain more than one single numeric. So '1,3' or '2,3' or '1,2,4,5'. In my case indicating that the store sells these types of products where 1 could be bags, 3 could be tennis rackets etc. Now I haven't been able to nail this query and code tonight and time is pressing so I've had to come to StackOverflow and ask you brilliant people for assistance. For now, it doesn't make any difference if I space separated these values or if I comma separate them or even if I change the column type within fusion tables to text from being numeric and issue a LIKE query of sorts.
From a data layout it's relatively straight forward to output it as individual columns with a 1 or a 0 but I was strictly following Derek's examples as he'd even added comments within the code.
Well anyway, here's hoping you guys have already nailed it. Let me know if you need a link but for the time being as I've hardly even moved away from Derek's example I though I wouldn't need to do that.
Thanks in advance, Richard.
thanks for the response. The database in this case is a standard spreadsheet imported to Fusion Tables. I appreciate what you say but this isn't an option as this is Excel we're talking about here and the file's being passed down from a marketing department.
The current format of the fusion table I have is along these lines
accountid | add1 | add2 | add3 | poastcode | prodtype1 | prodtype2 | prodtype3 | prodtype4
==========================================================================================
123456 blah blah blah SG18 1DF 1 1 0 0
234567 blah blah blah SG18 2DF 0 0 1 0
I was only seeing if the above could be translated to work with Derek Eder's search template example using his specific filtering instructions. So the below was an idea.
accountid | add1 | add2 | add3 | poastcode | type |
===================================================
123456 blah blah blah SG18 1DF 1,2,4
or if that didn't work,
accountid | add1 | add2 | add3 | poastcode | type |
===================================================
123456 blah blah blah SG18 1DF 1 2 4
I have big concerns over implementing your suggestion as it's beyond the scope of this project realistically and also wouldn't the joined table simply increase the overall record count thus falsely boosting number of records. I don't want to solve one challenge and then create another.
Hope you appreciate where I'm at. I just need to keep this within the spreadsheet world.
If you look at your problem from the database point of view, you should not use a single cell to contain multiple values, because it only gives you headaches and troubles. Sometimes it might be a good idea to boost the performance, but this is only the case if you know what you're doing :-)
Your problem could be easily solved with two tables. Your first table contains your current data, and the second one is used to map your data to one or more types.
Data
data_id | data | location
===========================
1 | xy | somethere
2 | az | moon
31 | bla | elm street
Mapping to types
data_id | type
================
1 | 1
1 | 3
1 | 4
31 | 2
Then you can JOIN the two tables to get the desired result:
data_id | data | location | type
===================================
1 | xy | somethere | 1
1 | xy | somethere | 3
1 | xy | somethere | 4
2 | az | moon |
31 | bla | elm street | 2
In Google Fusion Tables you can join two tables by merging them, this equals a LEFT OUTER JOIN
.
After that you have again the old setting with only one type per cell, but you're able to express that one row has multiple types.