Is it possible to filter phpgrid data with more than one field(Search Json)?

QuestionsIs it possible to filter phpgrid data with more than one field(Search Json)?
toki asked 11 years ago

Hi abu,

Is it possible to filter phpgrid data with more than one field(Search Json)?

e.g. WHERE NOT (i.mk_id=102 and ne ba'A ') ne= not equal
(written to ged rid of for invalid characters message)

"groupOp":"AND",
"rules":[
{"field":"mk_id","op":"eq","data":"102"},
{"field":"mk_id","op":"ne","data":"A"}

]

Regards…

6 Answers
Abu Ghufran answered 11 years ago

Yes, it work as expected. If you are having some issues, email me the code for review.

toki answered 11 years ago

Hi Abu,

WHERE NOT (i.mk_id=102 and ne ba'A ') ne= not equal

As you see where we put NOT of the above sql query in the Search Jsson Code ?

Thanks…

Abu Ghufran answered 11 years ago

You can write this with NOT too.
See http://en.wikipedia.org/wiki/De_Morgan's_laws

toki answered 11 years ago

Hi Abu,

I think I could not explain my question clearly to you.

WHERE NOT (i.mk_id=102 and ne ba'A ') ne= not equal

I am asking in below code where "NOT" can be placed to work same as above SQL code;

"groupOp":"AND",
"rules":[
{"field":"mk_id","op":"eq","data":"102"},
{"field":"mk_id","op":"ne","data":"A"}

]

Regards…

Abu Ghufran answered 11 years ago

Yes, i understand what you asked. Alternate solution is to negate the conditions and change AND to OR. (d'morgan). This will produce same result.

"groupOp":"OR",
"rules":[
{"field":"mk_id","op":"ne","data":"102"},
{"field":"mk_id","op":"eq","data":"A"}

]

toki answered 11 years ago

Abu,

Now it is clear NOT can not be used for search Json like used in SQL query.
I will try to solve with De_Morgan's_laws.

Thank you.

Your Answer

7 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?