Manually setting the Lat/Long for a distance condition

Currently on distance conditions, you have three options for the comparison location source. Fields from another model, running user’s location, and page parameters. I want to be able to filter a list of contacts with the source location being manually selected. I am currently using a dummy model and have tried a combination of Ui Only fields and actual reference fields.

The problem is when using “Fields from another model”, to get the condition to grab the latest change, you have to save that model and update both it and the model being filtered. This is problematic using a dummy model as I do not want to save the changes to it, and a UI only field would be reset doing this. 

I am setting the value for the distance value from my snippet. Is there anyway I’m missing to manually set the Lat/Long for that condition? I feel that would solve my problem.

Not exactly the answer you are looking for, but it is probably a quick fix for your issue. I create a custom object called “Settings”. I use it to collect any user preferences for Skuid Pages. You can add a model based on the settings object to any Skuid page and then save values to it as needed. The nice thing is that these changes persist after page refresh, so I use it for user specific filter preferences, background image choices, rendering of certain components like “one-time messages” on page load… very handy tool and it seems like it would fix your problem.

I have a similar object called UserSettings that I use. However, I was hoping to avoid adding a field for this.

Craig, I think that if the Condition’s Location Source is set to Page parameters, then if you’ve got the Condition object in JavaScript you can populate the latitudeValue and longitudeValue properties and when you re-query, those values will be used as the comparison location, e.g.

<br>var condition = myModel.getConditionByName("some_name");<br>condition.latitudeValue = 35.049309;<br>condition.longitudeValue = -85.3119634;

Thank you Zach! This worked very well. I had not tried URL Params or to manually set the values of the condition (although I was checking them in the console). I seem to remember seeing somewhere that condition properties should be treated as read-only and not modified in JS. 

I would say, yes, Condition properties should be treated as read-only, but in this case there’s no API for modifying the Lat/Long values manually, and these properties are not likely to change, so I’d say it’s safe.

Good to know. Thanks again for the help!