Question
· Sep 26, 2017

How to Extract Values From a Global

Hi, I work on my application and I  want to develop rules for extracting values from my database but i've any idea:

I want to order my records by the most recent timestamps values with profile_id and biometric type as keys, after comparing them with my personal program date (when the timestamp > at my fixed date : an alert message is sent to the patient)

you find here the attached screenshots for my to databases. thank's

Discussion (6)1
Log in or sign up to continue

There are multiple options you can choose from when implementing automated actions as part of your application.  In the end, it all comes down to what solution fits best for your business use case.  Here are a few examples:

  • (automated option) You could implement a database trigger that would fire when a record is inserted or updated to your database table, where the trigger could perform some action, such as call a method to evaluate the record data and to auto-send a notification based on some business rule (i.e.  the debut date is greater than some date then auto-send the notification).  You will want to give thought to the business logic fired with the trigger to minimize performance impacts to your database transactions - but there are options for how to achieve that.
  • (automated option) You could setup a scheduled task to run at certain times of the day that would query your database table(s) for specific things and if those things (business rules) are true, then auto-send the notification
  • (manual option)  If you want a user to be the one who determines whether a notification should be sent out, then you could have a web portal application that would query your database table(s) and display key data values to the user.  Based on the data displayed, the user could manually select one or more rows and click a button or perform some action to cause the notifications to be sent.
  • and on....
  • and on....

Bottom line, it comes down to what option works best for your company/applications.

P.S.  Also, based on the size of your database tables, be sure to review the SQL Query Plans for each of your SQL Queries to insure your queries are performing optimally.  If necessary, add the appropriate indexes to the tables to help improve the query plans (and the query performance).

Hope this helps and Have a Great Day!!!   Go Team!!

Got it. But I think you missing Global and SQL views.

E.g. here is SQL view on Sample.Person (you can find it in your SAMPLES namespace):

 

Similar to your screenshot table structure, yes?

And here below there is a screenshot of Global data of the same table.

 

 

Anyway, regarding your question, there are SQL and GLobal ways to deal with your data but please provide more details on the scheme, either global names or SQL tables.

As I see you have JSON data in the field payload. So extract the data from this field with SQL query (this is a good article), extract date/time information via JSON and put it in another class field and sort via Index or just put it in a global index and get it sorted automatically.

HTH

Hi, Soufiene!

I beautified your question a bit:

Fixed the title:

extract values from global -> How to Extract Values From a Global

Fixed some bugs in English in your question.

Beautiful title and text of the question motivate DC members to answer it.

Regarding your question: you ask about extracting from a Global, but provide the result of SQL query. Do you really want to work with global? If so would you please send the screenshot or structure of the global with data?