Filters
GoMaps.Filters History
Show minor edits - Show changes to markup
Can I change those filters to checkboxes?
Sure. Checkboxes let you select more than one item in the same filter: like properties that are "active" and those that are "waiting". This is an easy change to make and you'll find instructions here.
sc_allString = "All"
sc_allString = "All"
)\\
)
--> //The field to search in
--> sc_field = Properties::Active ;
-->
--> //The value we are searching on
--> sc_value = MapSettings::SelectActiveGlob ;
-->
--> //The value we are using to represent "All"
--> sc_allString = "All"
//The field to search in
sc_field = Properties::Active ;
//The value we are searching on
sc_value = MapSettings::SelectActiveGlob ;
//The value we are using to represent "All"
sc_allString = "All"
- $sc_propertyType ;
--> $sc_propertyStatus ;
--> $sc_propertyActive
--> )\\
$sc_propertyType ;
$sc_propertyStatus ;
$sc_propertyActive
)\\
1. Create a new global field in MapSettings to be used as the filter field--the field users enter their filter criteria into. This will be like the existing SelectStatusGlob field: in our example we'll call it "SelectActiveGlob".
2. If the field you're filtering on has a value list, make a duplicate version of the value list that has "All" as the first option: you'll see value lists like this for status: "PropertyStatusFilter". In our example the new value list is called "PropertyActive_Filter".
3. On the PropertiesMap layout, duplicate the existing SelectStatusGlob field and change the label to "Select Status". Change the field to your newly created SelectActiveGlob field and assign the value list "PropertyActive_Filter" created above.
4. These global filter fields have script triggers on them so be sure your "SelectActiveGlob" field the same triggers as "SelectStatusGlob".
5. Edit the script "Filters And Headers" and follow the comments to add a new variable for your new filter field; again, you can copy what's done for "status" as your pattern. The beginning of the set variable for our new $sc_propertyActive variable looks like this:
Let ([
//The field to search in
sc_field = Properties::Active ;
//The value we are searching on
sc_value = MapSettings::SelectActiveGlob ;
//The value we are using to represent "All"
sc_allString = "All"
-->
--> //The field to search in
--> sc_field = Properties::Active ;
-->
--> //The value we are searching on
--> sc_value = MapSettings::SelectActiveGlob ;
-->
--> //The value we are using to represent "All"
--> sc_allString = "All"
--> $sc_propertyType ;
--> $sc_propertyStatus ;
--> $sc_propertyActive
--> )\\
5. Edit the script "Filters And Headers" and follow the comments to add a new variable for your new filter field; again, you can copy what's done for "status" as your pattern. The beginning of the set variable for our new $sc_propertyActive variable looks like this:
Let ([
//The field to search in
sc_field = Properties::Active ;
//The value we are searching on
sc_value = MapSettings::SelectActiveGlob ;
//The value we are using to represent "All"
sc_allString = "All"\\
1. Create a new global field in MapSettings to be used as the filter field--the field users enter their filter criteria into. This will be like the existing SelectStatusGlob field: in our example we'll call it "SelectActiveGlob".
2. If the field you're filtering on has a value list, make a duplicate version of the value list that has "All" as the first option: you'll see value lists like this for status: "PropertyStatusFilter". In our example the new value list is called "PropertyActive_Filter".
3. On the PropertiesMap layout, duplicate the existing SelectStatusGlob field and change the label to "Select Status". Change the field to your newly created SelectActiveGlob field and assign the value list "PropertyActive_Filter" created above.
4. These global filter fields have script triggers on them so be sure your "SelectActiveGlob" field the same triggers as "SelectStatusGlob".
How can I create my own filters?
In addition to repurposing the filters that come with ProMaps & GoMaps, you can add your own. Let's say you have a field in the properties table called "active" and this contains either "yes" or "no". Here is how you'd add a filter for active:
The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
Can I show a FileMaker found set on the map?
The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
Can I show a FileMaker found set on the map?
Can I show a FileMaker found set on the map?
Can I show a FileMaker found set on the map?
Once you have your summary field created you will need to create a way to set that field data to a global variable. Either create a new script or edit an existing script you might have for viewing the map from the context of a property record / records. In that script add a script step to set a global variable. Name the global variable "$$sc_IDList" and set the contents of that variable to the summary field "IDList we created in the previous step. You will then want to reload the map data by adding a "Run Script" script step the will execute the script "Load Map". Then a "GoTo Layout" script step that navigates to the map layout.
Once you have your summary field created you will need to create a way to set that field data to a global variable. Either create a new script or edit an existing script you might have for viewing the map from the context of a property record / records. In that script add a script step to set a global variable. Name the global variable "$$sc_IDList" and set the contents of that variable to the summary field "IDList we created in the previous step. You will then want to reload the map data by adding a "Perform Script" script step the will execute the script "Load Map". Then a "GoTo Layout" script step that navigates to the map layout.
sc_value = Substitute ($sc_idList ; "¶" ; "','") ;
sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;
In the set variable script step add the following calculation contents:
In the set variable script step "$sc_idList" add the following calculation contents:
sc_value ≠ sc_allString ;
sc_value <> sc_allString ;
[@Let ([sc_field = Properties::_id ; sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;
[@Let ([
//The field to search in sc_field = Properties::_id ;
//The value we are searching on sc_value = Substitute ($sc_idList ; "¶" ; "','") ;
//The value we are using to represent "All"
"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"
"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"
[@Let ([sc_field = Properties::_id ;
)>><<
)@]
Let ([<<sc_field = Properties::_id ;\\sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;\\sc_allString = "All"\\] ;\\Case (\\sc_value ≠ sc_allString ;\\"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"\\)\\)
sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ; sc_allString = "All" ] ; Case ( sc_value ≠ sc_allString ; "a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')" ) )>><<
Let ([\\sc_field = Properties::_id ;\\sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;\\sc_allString = "All"\\] ;\\Case (\\sc_value ≠ sc_allString ;\\"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"\\)\\)
Let ([<<sc_field = Properties::_id ;\\sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;\\sc_allString = "All"\\] ;\\Case (\\sc_value ≠ sc_allString ;\\"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"\\)\\)
''Let ([ sc_field = Properties::_id ; sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ; sc_allString = "All" ] ; Case ( sc_value ≠ sc_allString ; "a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')" ) )''
Let ([\\sc_field = Properties::_id ;\\sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;\\sc_allString = "All"\\] ;\\Case (\\sc_value ≠ sc_allString ;\\"a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')"\\)\\)
Let ([
''Let ([
)
)''
That's it!
''Let ([
Let ([
)''
)
Then simply add our new "$sc_idList" variable to top of the list calculation in the "$sc_searchFieldString" set variable script step.
http://www.seedcode.com/rootimages/stikipad/gomaps/query-items.png
http://www.seedcode.com/rootimages/stikipad/gomaps/id-list.png
Let ([
//The field to search in
''Let ([
//The value we are searching on
//The value we are using to represent "All"
)
)''
Let ([
//------------------------- You shouldn't have to edit below this line -------------------------//
http://www.seedcode.com/rootimages/stikipad/gomaps/list-of.png
http://www.seedcode.com/rootimages/stikipad/gomaps/list-of.png
Once you have your summary field created you will need to create a way to set that field data to a global variable. Either create a new script or edit an existing script you might have for viewing the map from the context of a property record / records. In that script add a script step to set a global variable. Name the global variable "$$sc_IDList" and set the contents of that variable to the summary field "IDList we created in the previous step. You will then want to reload the map data by adding a "Run Script" script step the will execute the script "Load Map". Then a "GoTo Layout" script step that navigates to the map layout.
Now that we have a script that will set a global var to our list of ID's and take us to the map we need to modify our query process to accept this ID list. In script manager find and edit the script "Filters and Headers" and add an "if" code block as pictured below.
In the set variable script step add the following calculation contents:
//The field to search in sc_field = Properties::_id ;
//The value we are searching on sc_value = Substitute ($$sc_IDList ; "¶" ; "','") ;
//The value we are using to represent "All" sc_allString = "All"
] ;
//------------------------- You shouldn't have to edit below this line -------------------------//
Case ( sc_value ≠ sc_allString ; "a.\"" & GetValue (Substitute (GetFieldName (sc_field) ; "::" ; "¶") ; 2) & "\" IN ('" & sc_value & "')" ) )
The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
Can I show a FileMaker found set on the map?
Yes. This is possible but will require a few script modifications. The first step in the process is getting a list of ID's from your found set. This can be accomplished by either looping through records and building a return delimited list or if you are using FileMaker 13 or later you can use the Summary field type "List Of".
In this case we recommend using List Of if possible. Create a new field in your properties table called "IDList", select a field type of "Summary" and make sure in the options to select "List Of" summarizing your property table ID field.
http://www.seedcode.com/rootimages/stikipad/gomaps/list-of.png
Can I default the map to show zero properties unless it is fltered? Yes. This is easily done by editing the script "Filters And Headers" in GoMaps (the mobile file) and is generally a good idea if you have a large data set. You'll probably want to do it before you distribute GoMaps to your users. There is a couple of set variable script steps toward the top of the script that helps build the filter queries. They are "$sc_propertyType" and "$sc_propertyStatus". You will need to reference which one (or both) of these filters should be populated before querying for map data. To do this, just wrap the script step where we set the map data package "$$sc_mapDataPackage" in an if/else statement. The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
Can I default the map to show zero properties unless it is fltered?
Yes. This is easily done by editing the script "Filters And Headers" in GoMaps (the mobile file) and is generally a good idea if you have a large data set. You'll probably want to do it before you distribute GoMaps to your users.
There is a couple of set variable script steps toward the top of the script that helps build the filter queries. They are "$sc_propertyType" and "$sc_propertyStatus". You will need to reference which one (or both) of these filters should be populated before querying for map data. To do this, just wrap the script step where we set the map data package "$$sc_mapDataPackage" in an if/else statement.
The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
You'll notice that there are two value lists for ever filter. For example, there is both a "PropertyStatus" and a "PropertyStatus_Filter" list. Edit the one without "_Filter" in the name. We use the "_Filter" one solely so we can add "All" to the filters when we present them to users.
You'll notice that there are two value lists for ever filter. For example, there is both a "PropertyStatus" and a "PropertyStatus_Filter" list. Edit the one without "_Filter" in the name. We use the "_Filter" one solely so we can add "All" to the filters when we present them to users.
Can I default the map to show zero properties unless it is fltered? Yes. This is easily done by editing the script "Filters And Headers" in GoMaps (the mobile file) and is generally a good idea if you have a large data set. You'll probably want to do it before you distribute GoMaps to your users. There is a couple of set variable script steps toward the top of the script that helps build the filter queries. They are "$sc_propertyType" and "$sc_propertyStatus". You will need to reference which one (or both) of these filters should be populated before querying for map data. To do this, just wrap the script step where we set the map data package "$$sc_mapDataPackage" in an if/else statement. The if calculation will read "not IsEmpty ($sc_propertyType) or not IsEmpty($sc_propertyStatus)" without the quotes. Then within the if statement you will run the set variable for "$$sc_mapDataPackage" as it is now. After that add an "Else" statement and within that a script step that sets the variable "$$sc_mapDataPackage" to null / empty using two quotes. That's it... Now pins will only appear on the map when at least one filter is selected.
bg here https://seedcode.fogbugz.com/default.asp?19444#137914
> > instructions
Yes. This is easily done by editing the script "Filters And Headers" in GoMaps (the mobile file). You'll probably want to do it before you distribute GoMaps to your users
You'll find a SetVariable line for each filter you have, and you can select which field we search on (a field in the Properties table) and which field acts as the filter (a field in the Interface table). The script is well commented, so read through every line above the comment "You shouldn't have to edit below this line". (My favorite comment in all of scriptdom.)
You do this right in the value lists of the mobile GoMaps file (and you probably want to do it before you distribute GoMaps to your users.
You do this right in the value lists of the mobile GoMaps file (again, you probably want to do it before you distribute GoMaps to your users).
Note that if you make your own drop down fields for you own filters, you'll want to add the same script triggers we have on ours:
http://www.seedcode.com/rootimages/stikipad/gomaps/filterpop.png
> > instructions
> > instructions
How do I change the value lists used for filters?
You do this right in the value lists of the mobile GoMaps file (and you probably want to do it before you distribute GoMaps to your users.
You'll notice that there are two value lists for ever filter. For example, there is both a "PropertyStatus" and a "PropertyStatus_Filter" list. Edit the one without "_Filter" in the name. We use the "_Filter" one solely so we can add "All" to the filters when we present them to users.
If you mean "filter" as in "filter the records that come down to the iPad via sync"... yes you can. Read this: sync found sets.
If you mean "filter" as in "filter the records that come down to the iPad via sync", read this: sync found sets.
If you mean "filter" as in "filter the records that come down to the iPad via sync"... yes you can. Read this: sync found sets.
How do I only pull down "my" properties? That is, can I filter the records that come down in a sync?
Yes. In fact we strongly recommend that you only sync the data that each user need at any given time. Maybe that is "my customers" or "my customers to visit this week" but filtering the sync is key to a good user experience.
(If you're interested in reading more on this, check out.... blog XXXXX)
Filtering records this way is built into GoZync, the sync engine behind GoMaps. For instructions on how to add these sync filters to GoZync, read this: Downloading Found Sets
> > instructions bg here https://seedcode.fogbugz.com/default.asp?19444#137914
> > instructions
bg here https://seedcode.fogbugz.com/default.asp?19444#137914
Can I change the fields GoMaps filters on? (Currently status and Property Type)
> > instructions
Can I change the fields GoMaps filters on? (Currently Status and Property Type)
> > instructions bg here https://seedcode.fogbugz.com/default.asp?19444#137914
How do I only pull down "my" properties? That is, can I filter the records that come down in a sync?
Yes. In fact we strongly recommend that you only sync the data that each user need at any given time. Maybe that is "my customers" or "my customers to visit this week" but filtering the sync is key to a good user experience.
(If you're interested in reading more on this, check out.... blog XXXXX)
Filtering records this way is built into GoZync, the sync engine behind GoMaps. For instructions on how to add these sync filters to GoZync, read this: Downloading Found Sets
Can I change the fields GoMaps filters on? (Currently status and Property Type)
> > instructions