How do I use a custom query value?

Top   « Previous  Next »


Custom query values can be created to associate a system variable with a given user do that purely generic queries can be created relevant to that user.


An example would be to create a UserID or EmployeeID as a query value, so that when a generic query is run, query results are returned only for that User/Employee.


Another example might be a school who gives parents access to their child's absentee record and grades. When a parent sends a message with a generic query 'student', MobileDataNow recognizes which parent the message comes from, relates it to their child's student ID, runs a query related to that student and sends the results back to the parent. We'll create an example below for this scenario.



This is a sample database of students





We connect to this database as below





Create a View called Students.





Move to the Users & Groups tab and click Custom Query Values. Enter a new Custom Query Value StudentID. This will allow us to attach the corresponding Student through their StudentID to the appropriate parent.





Add a new group, call it School and Save it.





Then we add the parents names as users, add them to the newly created School group and add in their messaging details.





Then we move to the Custom Query Values tab for this user and select StudentID and assign it the value 1001, which is the student 'Tom Smith' from the database. Tom Smith is the son of Mr and Mrs Smith, our user we setup here.





Next, write a new query called Students. You will now see the custom field StudentID we created earlier is in the parameter list. Select it for this query.






Choose the mobile number parents will send their query to. There is no need for a keyword as we didn't define a [User Input] value in the query builder. So, parents can send a blank SMS message to a phone number, MobileDataNow will recognize their phone number, and only return their child's results.


cqv-messaging details



Format how the message will be sent back to the parents


cqv-msg format



Start the messaging services and send a message to the mobile number you choose. MobileDataNow will check to see which mobile number the message came from and run the query. The parents will see only their child's details.

Note: You can only test this with your phone (not within the application) as it requires the custom query value to be inserted.