Hi All, In Cache Table i have stored the data value as horlog format ,by query how to retrive the data when i give the data field as date format.
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
Hi All, In Cache Table i have stored the data value as horlog format ,by query how to retrive the data when i give the data field as date format.
I am trying to return the maximum of the value of 2 fields: LastViewed and LastDownloaded AS a local variable -LastAccessed for each row, using a SQL query . These values are stored as $ H format. Is there an existing SQL command that compares two column values ? I could not find one, so I tried using a $Select statement . I got an error that said A term expected beginning with either of: identifier, constant, aggregate, $$,(,:,+.
Encryption of sensitive data becomes more and more important for applications. For example patient names, SSN, address-data or credit card-numbers etc..
Cache supports different flavors of encryption. Block-level database encryption and data-element encryption. The block-level database encryption protects an entire database. The decryption/encryption is done when a block is written/read to or from the database and has very little impact on the performance.
With data-element encryption only certain data-fields are encrypted. Fields that contain sensitive data like patient data or credit-card numbers. Data-element encryption is also useful if a re-encryption is required periodically. With data-element encryption it is the responsibility of the application to encrypt/decrypt the data.
Both encryption methods leverage the managed key encryption infrastructure of Caché.
The following article describes a sample use-case where data-element encryption is used to encrypt person data.
But what if you have hundreds of thousands of records with an encrypted datafield and you have the need to search that field? Decryption of the field-values prior to the search is not an option. What about indices?
This article describes a possible solution and develops step-by-step a small example how you can use SQL and indices to search encrypted fields.
I have been following the online Zen Quickstart Tutorial using the lastest release documentation. In addition to playing around with the styling and making a few minor functionality tweaks, I wanted to add an additional column that shows a count of the number of phone numbers for that Contact (as shown in the image below).

The idea here is that you can see what contacts have phone numbers without having to click on the "view phones" link. All I have done here is add a blank additional column to the %ZEN.Component.tablePane object
I have a tablePane ZEN Component and I am trying to get a filter running on the Specimen Id / Lab Number. The SQL is fairly complex with 3 UNION ALL statements joining 4 tables and a couple of lookup tables.
How would I get the filter on SpecId to work for my tablePane? It's not automatically applying the filter for me so I think I need code something.
I use the HS_IHE_ATNA_Repository.Aggregation table a lot. Someone just referred me to the HS_IHE_ATNA_Repository.Document table, which has an AggregationId column.
I assume that column references the ID column in the .Aggregation table. If so, does this mean that if the same document was requested 1,000 times that there will be 1,000 entries for it in the .Document table? This seems inefficient to me. Why not have one record in the document table and have a DocumentId column in the Aggregation table?
I have a property, Emails, that needs to contain a list of comma-delimited values, or "". Is there a benefit to making this property a list of %String, a Collection[list] (or however you do it), an array, or anything other than a simple %String type?
I just need to store some values, and return these values in SQL -- so it needs to be SQL compatible. I don't need to index the values or use individual values in the SQL statement (e.g. Select * from table where emails [ "email@co.com" -- I don't need to do this, although maybe this would work anyway if it's of type %String).
We've been noticing that we're getting this (https://community.intersystems.com/post/cach%C3%A9-sql-error-odbc) error more frequently and having to constantly purge cached queries in order to resolve it. Is there a way to avoid the issue in the first place?
thanks!
I have the following query which tells me how many documents were retrieved for each customer, but it only works for the "on-demand" customers:
All the other PatientFacility's show up as "Documents".
I want to override getter for a serial property as a whole, because getter code depends on a class in which a property is defined.
Let's say I have CS.Serial as a serial class:
Class CS.Serial Extends %SerialObject
{
Property Year As %Integer;
Property Month As %Integer;
}And CS.Persistent as a persistent class:
Class CS.Persistent Extends %Persistent
{
Property data As CS.Serial [ SqlComputeCode = {set {*} = ##class(CS.Persistent).dataGetStatic()}, SqlComputed, Transient ];
/// data getter method in object context
Method dataGet() As CS.Serial
{
return .So I know it's been a while, and I hate to let my adoring fans down... just not enough to actually start writing again. But the wait is over and I'm back! Now bask in my beautiful ginger words!
For this series, I am going to look at some common problems we see in the WRC and discuss some common solutions. Of course, even if you find a solution here, you are always welcome to call in and expression you gratitude, or just hear my voice!
This week's common problem: "My query returns no data."
Now, supposedly you've checked that your query SHOULD return
When working with a large query executed though an ODBC connection what is the best way to allow the paging of the results at the client side. I have tried some methods using %VID and similar methods, but these really don't seem to work as the value returned is related to the ID of the data and not the position in the results set. What would be ideal is if the value seen in the management portal when you check of "Row Number" was available to external queries through ODBC. I have not seen a way to return this however. This would be similar to SQL server Last n and Skip n capabilities.
Hi guys.
Do You known If Caché has suport to Common Table Expressions (With queries)
By example: https://www.postgresql.org/docs/9.6/static/queries-with.html
Hello,
I read the Cache Documentation where it describes Private Property as below:
If you have a lot of SQL queries to external systems (or even internal dynamic ones), you can encounter something like this:
Set SQL = "SELECT "_
"c.cid AS Id,"_
"c.nid AS Nid, "_
"FROM_UNIXTIME(c.created) AS Created,"_
"c.uid AS Uid,"_
"IFNULL(vv.average,0) AS AvgVote,"_
"IFNULL(vv.amount,0) AS VotesAmount,"_
"body.So, I played with row level security and was unable to find a way to get to work it dynamically. I want to determine if the user can access the row in runtime based on a state of external system, but it seems that row level access is calculated during INSERT/UPDATE and stored in %RLI index. Is there a way to achieve runtime access calculation?
Hello,
Is there some way to reproduce the SQL GROUP_CONCAT(http://sql.sh/fonctions/group_concat) with the Caché DB ?
That is exactly what I would expect.
That is NOT expected.
We don't often use SQL within our org, which is mostly due to the performance issue we experience due to the quantity of data we are reviewing.
Aside from the standard performance measures for non-Caché databases, are there any recommended approaches when querying large tables?
The table would have roughly 50M records, but there are not a finite amount of sub-nodes.
Hello Fellow Caché Developers,
The purpose of this post is to ask for everyone's thoughts and input around the use of transient, SQLCalculated/Computed properties within persistent classes.
This approach allows for extra data values needed in SQL queries to be available without having to join to other tables.
Very simple/basic example to illustrate the topic:
Let's say I have a persistent class named ICDAutoCodeDefn to hold ICD Auto-Coding definitions, such as:
Class ApplicationName.DB.MedicalCoding.
Error:
[SQLCODE: <-400>:<Fatal error occurred>]
[Cache Error: <<SUBSCRIPT>%0AmEdun+4^%sqlcq.HSREGISTRY.cls966.1 ^||%sql.temp(1,"")>]
[Location: <ServerLoop - Query Fetch>]
[%msg: <Unexpected error occurred: <SUBSCRIPT>%0AmEdun+4^%sqlcq.HSREGISTRY.cls966.1 ^||%sql.temp(1,"")>]
Here is an example of a query that gives the error:
SELECT COUNT(DISTINCT Criteria) as Relevance FROM HS_IHE_ATNA_Repository.Aggregation
WHERE EventType = 'CROSS GATEWAY QUERY'
The content of the actual field is XML, but the query simply returns a number.
I have a class which defines a property as array of %String. Is it possible to index values of this property and use this property in SQL?
I have tried 'Index idx On prop(ELEMENTS)' and then a select from the generated collection table, but this is still orders of magnitude slower than queries to the containing class.
Is there a tool to get the slowests queries ?
In writing some code on:
Cache for Windows (x86-64) 2015.1 (Build 429U) Fri Feb 13 2015 14:37:23 EST
I noticed an unexpected "ROLLFAIL" error when a Unique Index fail was generated in a %Save() call.
The object SHOULD fail to save, since the Unique criteria is not met, but I didn't expect to see a ROLLFAIL error as the "Last Error".
When running the following class code:
Class BUG.Test Extends %Persistent
{
Property Field1 As %String;
Property Field2 As %String;
Index idx1 On Field1 [ Unique ];
ClassMethod Test()
{
kill ^BUG.TestD
kill ^BUG.I would like to integrate SQL into our ObjectScript routines in order to illustrate how SQL can be used to minimize development time. However, there are two questions I have.
I'm trying to use the standard TSQL DECLARE syntax but I get the following error:
[%msg: < IDENTIFIER expected, @ found^ DECLARE @>]
How do I declare a variable? For instance:
i have this error
DrawTableError : <MAXSTRING> zDrawTable+349^%CSP.Util.TablePane.2
perhaps i have the possibility of Deleting all history queries, but i think better to check the table where last queries were stored and solve it by deleting wrong registries. anybody knows where is the table 'QueryHistory'.
I get this on some queries in some namespaces. For instance, this query:
It works fine in HSBUS but in HSREG it throws the error.
Server closed communication device
Does anyone know what would cause this? Would it log something more useful somewhere?
Since now i have been working from external connection but i want to work with the SQL utility of Management Portal
i dont know how to do with several instructions like in other editors like this example
update Prod.Articulos set Alto = 1646, Ancho = 16, Fondo = 80 where CodigoNum = '100' and Empresa = 'CO' update Prod.Articulos set Alto = 1646, Ancho = 16, Fondo = 400 where CodigoNum = '101' and Empresa = 'CO' update Prod.
Running TuneTable accounts among other the parameter named Block Count. In documentation, we see that this is an approximate numbers of 2K-blocks in which SQL-maps are stored. Databases in recent Cache doesn't support 2K-physical blocks so SQL-blocks are not physical blocks as it seems. So two questions:
- what are these blocks?
- how knowledge about count of blocks can help in SQL optimization?
Thanks for intelligent answer to stupid questions!