{"action":"created","issue":{"url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/528","repository_url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder","labels_url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/528/labels{/name}","comments_url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/528/comments","events_url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/528/events","html_url":"https://github.com/mistic100/jQuery-QueryBuilder/issues/528","id":242198049,"number":528,"title":"How to setRulesFromSQL when having more than one filter by database field","user":{"login":"mauriciojsola","id":1199946,"avatar_url":"https://avatars3.githubusercontent.com/u/1199946?v=3","gravatar_id":"","url":"https://api.github.com/users/mauriciojsola","html_url":"https://github.com/mauriciojsola","followers_url":"https://api.github.com/users/mauriciojsola/followers","following_url":"https://api.github.com/users/mauriciojsola/following{/other_user}","gists_url":"https://api.github.com/users/mauriciojsola/gists{/gist_id}","starred_url":"https://api.github.com/users/mauriciojsola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauriciojsola/subscriptions","organizations_url":"https://api.github.com/users/mauriciojsola/orgs","repos_url":"https://api.github.com/users/mauriciojsola/repos","events_url":"https://api.github.com/users/mauriciojsola/events{/privacy}","received_events_url":"https://api.github.com/users/mauriciojsola/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-11T22:04:33Z","updated_at":"2017-07-12T08:00:00Z","closed_at":null,"body":"Hi Mistic,\r\nFirst of all, I really appreciate your hard work and I have to say that your library is AWESOME!\r\n\r\nSo, given that said.... from your SQL plugin doc: \r\n\"setRulesFromSQL assumes that you have only one filter by database field. If this is not the case, you can use the getSQLFieldID changer to determine the filter's id.\"\r\n\r\nDo you have any example on how to determine the filter's id in order to support having more than one filter by field. Attached is an image about what I'm trying to achieve.\r\nBasically, I need to use the OR multiple times for the same field.\r\nIf I use each field only once, the Builder is able to rebuild the whole layout. Otherwise, everything gets messed up...\r\nI know I could use the IN clause and allow multiple values per filter, but it is not that flexible (for my case) and I'd like to see if I can get this sorted out anyway.\r\n \r\n![query builder sql](https://user-images.githubusercontent.com/1199946/28092486-eb640c68-6669-11e7-8311-88126f5d6d50.png)\r\n\r\nI hope you can help me with this.\r\nThanks in advance!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/comments/314686665","html_url":"https://github.com/mistic100/jQuery-QueryBuilder/issues/528#issuecomment-314686665","issue_url":"https://api.github.com/repos/mistic100/jQuery-QueryBuilder/issues/528","id":314686665,"user":{"login":"mistic100","id":41597,"avatar_url":"https://avatars0.githubusercontent.com/u/41597?v=3","gravatar_id":"","url":"https://api.github.com/users/mistic100","html_url":"https://github.com/mistic100","followers_url":"https://api.github.com/users/mistic100/followers","following_url":"https://api.github.com/users/mistic100/following{/other_user}","gists_url":"https://api.github.com/users/mistic100/gists{/gist_id}","starred_url":"https://api.github.com/users/mistic100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mistic100/subscriptions","organizations_url":"https://api.github.com/users/mistic100/orgs","repos_url":"https://api.github.com/users/mistic100/repos","events_url":"https://api.github.com/users/mistic100/events{/privacy}","received_events_url":"https://api.github.com/users/mistic100/received_events","type":"User","site_admin":false},"created_at":"2017-07-12T08:00:00Z","updated_at":"2017-07-12T08:00:00Z","body":"Hello\r\n\r\n```js\r\n$('#builder').on('getSQLFieldID.filter.queryBuilder', function(e, field, value) {\r\n   if (field === 'StoreFrontName') {\r\n     // your logic to return the filter id\r\n   }\r\n   else {\r\n     return field;\r\n   }\r\n});\r\n```"}}
{"actor":{"display_login":"mistic100"}}