QUERIES TAB

Here is where you can see a list of all the ‘queries’ contained in the database.  In this case there are two queries (ActivePatients and InactivePatients)

Again, we have exactly the same 4 buttons along the right side of the screen:

* OPEN – Opens the selected query and allows you to view/edit the contents.
* NEW – Allows you to CREATE a NEW query.
* EDIT – Allows you to EDIT an existing query.
* DELETE – Allows you to DELETE an existing query.

Note:  The following screenshots are taken from the Patient sample application which can be downloaded HERE:

Let's try creating a NEW query.  Let's click the NEW button and proceed...

Here we’re presented with the abcDB™ ‘Query-Builder’.

The first step is to choose the table we wish to query.  Let’s choose the PATIENTS table.

Now let’s choose the fields we wish to display in our query results.  For example, let’s assume that we want to view the names of all the patients in our database who are marked as being active.

 

In this next screenshot, we have chosen to display the FIRSTNAME and LASTNAME fields.

Notice that we have chosen NOT to display the contents of the ACTIVE field.

The 4th row in the Query Builder is for entering ‘criteria’.  In this instance we only want to display records where the ACTIVE field is set to TRUE.  In order to accomplish this, all we have to do is enter the following in the ‘criteria’ row under our ACTIVE field:

= True

If we tap the TEST button, we’ll see the results. 

Move to next step ŕ

Now let’s suppose that we only want to see patients who are active and whose FirstName is TERY.

All we need to do is modify our query and add the following ‘criteria’ under the FIRSTNAME column:

= ‘Tery’

If you are a ‘power-user’ who would rather enter SQL commands manually, just click the SQL button at the top of the Query-Builder.  You will then be presented with the following screen, where you can manually enter your SQL.

When you’re happy with your query, you can save it clicking SAVE and entering a name.  Do that now, and call this query 'MyPatients'.

But wait a minute!  We just realized that we also wanted to see the ROOM number that the patient is in!

No Problem!  Let's move to the next section ... 'Editing Queries' , and we'll see how this can be done!