Hi Community!
Suppose I have a property in a ObjectScript class:
Property values As list Of %StringWhat an SQL query can help to return the values of the property as JSON array via SQL access (JDBC)?
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
Hi Community!
Suppose I have a property in a ObjectScript class:
Property values As list Of %StringWhat an SQL query can help to return the values of the property as JSON array via SQL access (JDBC)?
Is there a way or can it be done to use conditional logic in sql like so
Query Q1(formal as %String) As %SQLQuery [ Final ]
{
SELECT patientnumber,ID, CASE
WHEN ID = 50 THEN "The is 50"
WHEN ID = 30 THEN "This is 30"
ELSE "The quantity is under 30"
END FROM Audit.Table WHERE ID = :formal AND EndDate is null} }
I got a quick answer from this forum yesterday so I'm going to try my luck again today! I've hit an error in another table when trying to extract through the Cache ODBC driver, but this one gives me less details and I'm struggling to pinpoint what might be causing the error.
The table I am trying to extract is called REF_TABLE_ONE.
Here's the Error:
[Cache Error: <<NOLINE>%0AmBx1^%sqlcq.PRD.2249>]
[Location: <ServerLoop - Query Fetch>]
Based on my research, it looks like the error results from something missing in a routine. I have limited access to this system.
I'm working on exporting data from an Intersystems Cache database through the Cache ODBC Driver. There is a particular table that is giving me an error message. The ODBC Driver crashes and reports an error from the Cache system. I think I was able to trace down where the error is coming from, but I do not know how to debug or fix the error.
The table I am trying to extract is called SEDMIHP.
Here's the Error:
[Cache Error: <<UNDEFINED>%0AmBd16^%sqlcq.PRD.3284 ^SEDMIHP(4,77)>]
[Location: <ServerLoop - Query Fetch>]
Let Say I have
Class Carrier Extends %Persistent
Property Employee As Array of Class Employees
Class Employees Extends %SerialObject
Property Name As %String
Property Address As Array of Class AddressDetail
Class AddressDetail Extends %SerialObject
Property Street1 As %String
Property Street2 As %String
I can get value for Employee Name as Employee_Name.
But I want to Get Value of Address Street1 and Street2 of Class AddressDetail using SQL Query
How can I get that?
Hi, I'm looking for a way to implement the JDBC pattern "executeBatch" in ObjectScript: https://www.tutorialspoint.com/jdbc/jdbc-batch-processing.htm
Since Ensemble 2017.2.2 there is a new method called executeParametersBatch : https://docs.intersystems.com/ens20172/csp/docbook/relnotes/index.html#…
Even in the Ensemble 2018.1 change log, mention a patch on this method: https://docs.intersystems.com/ens20181/csp/docbook/relnotes/index.html#…
Do you have any examples or tracks to use the executeParametersBatch method of %Net.Remote.Java.JDBCGateway?
I need to select my result into a list and be able to loop through the list when query finished any help appreciated here is where I am
##sql(SELECT %ID INTO :IDArray() FROM MergeHyland.TypeTwoDimesionCollection WHERE GUID = :Key AND EndDate IS NULL)
for I=1;1:$LISTLENGTH(IDArray)
{
w $Data(IDArray),i
}
I have this query That I am trying to use in my class when testing on the terminal I expect to get the results printed on the terminal but I am only getting zero printed please can anyone out there advice on what I am doing wrong
Method PatientInfo(ID As %String) As %Status
{ #dim status as %Status=$$$OK
SET myquery="SELECT GUID, IDType,IDValue FROM MergeHyland.TypeTwoDimesionCollection WHERE GUID ="_ID
SET rset=##class(%ResultSet.SQL).%Prepare(myquery,.err,"")
WHILE rset.%Next() {
WRITE !,rset.GUID & ":" & rset.IDType& ":" & rset.IDValue
}
WRITE "End of data"
return status
}Let's say I have this property:
Property FavoriteColors As List Of %String;
I heed to convert it to JSON using SQL or at least without object access (so direct global access).
What's the fastest way to do that?
I thought about JSON_ARRAY and JSON_ARRAYAGG sql functions but they don't do that.
I have a persistent class.
I want to store one of the properties there as a stream or a string depending on a size.
99% of values would be strings (less than $$$MaxStringLength characters) so I don't want to store everything as streams.
What do you think of this approach?
What's the best architecture to implement in this situation?
I've mapped multiple tables (UNION on mapped SQL classes) into a view, using CREATE VIEW.
Through ODBC, in Entity Framework, I am querying against that view and offering paging. The paging is implemented using IQueryable.Skip and IQueryable.Take.
Skip seems to have unexpected results, I believe due to incorrect SQL generated by the Entity Framework provider, though perhaps I've done something incorrectly. The generated SQL looks similar to this (with some bits replaced or altered for security reasons), the basic structure is unaltered.
I have an sql statement that I would like to execute but I get the error
"zSearchChanges+5^MergeHyland.TypeTwoUtil.1 *KeyIDand here is my sq
l "&sql(SELECT Key INTO :KeyIDHi Community!
New session recording from Global Summit 2018 is available on InterSystems Developers YouTube Channel:
Hello,
I'm looking to find if there is a datatype convert equivalent in Object Script to SQL convert function. Have a VarBinary string coming in from source application (which is really performing a SQL dump). The source application uses the standard SQL convert function to convert from varchar to varbinary on their side.
I know &sql(Convert()) should work in Object Script, but am wondering if there is a better way of doing this.
Getting data in via flat file (Record Map), then using data transform to transpose this data to SDA3.
A very simple SQL
SELECT field1 F1, count(field2) CntF2
FROM GCT.PA_Data
where field1 is not null
group by field1
gives an error back:
[SQLCODE: <-461>:<Communication link failure>]
[%msg: <Connection 'TRAKCARELIVE': Execute: SQLState: (HY000) NativeError: [10053] Message: [Cache ODBC][State : HY000][Native Code 10053] [c:\intersystems\ensemble\bin\cache.exe] Software caused connection abort> ]
It does work in another (test) environment, but not on live. Any idea why?
Dear all,
In our application made in Caché object script, when we deploy some classes modified we have the option of calling "Purge queries" feature of Caché.
We only were doing this call when a %Persistent class definition (table) was modified, as we assume that no other changes affect the cached queries and we don't want to purge them by default, as the first run of a query becomes slow.
We had a case where no table definition was changed but a purge queries was the solution.
Do you know if any other change could affect the cached queries and a purge queries is necessary?
Regards,
I am trying to use %INLIST in SQL query using a cursor and the query fails to return results. It appears that the variable I use against %INLIST returns an empty string. All the examples I have seen use result sets and build the query as a string. Is it possible to use %INLIST in a cursor-based query?
Hello, I need help in health insight. I am trying to generate reports on deep see but i am not able to pull in the patient ids as these are our requirements for the project. Can anyone help me in unlocking this feature. Can anyone help me with link to correct documentation on how to access the edge gateways of multiple facilities to access the clinical data on sql explorer.
When using the JSON_OBJECT() function in Caché SQL on a %String property that contains JSON syntax, it converts the %String into a JSON object instead of escaping it as a string literal. How can I prevent this? (without ridiculous hacks like "add a space to the beginning of the value" as we don't always know which properties will contain these values and I certainly don't want to have to check for nulls and add/remove a space every single place this value is used in the application)
I don't want these strings automatically marshalled into JSON objects.
Hi
Is this a bug? We came across it on an older version of Cache but I've also just tried it in version "Cache for Windows (x86-64) 2017.2.2 (Build 865U)" and got the same result.
Create a Class like so:
Class My.Email Extends %Persistent
{
Property AddSeq As %Integer(MAXVAL = 32767, MINVAL = -32768) [ Required ];
Property EffBegDat As User.SQLdatetime;
Property EffEndDat As User.
Greetings all,
I have a quick SQL question. I am working with a class, which has a calculated property, which in turned indexed.
The calculation for this property is created based on another property value via:
SqlComputeOnChange = attributes - so basically every time I add a property attribute to my class, my new property
is calculated based on some SqlComputeCode which calls some class method.
That initial setup works as designed.
Question: If my code for whatever reason gets to a ROLLBACK, does the calculated property always rolls back,
and it's index always cleared?
Hi,
Most of my classes are mapped from Globals. I want to access Cache classes from a BI software through ODBC connection.
'Last update' information does not exist in most of the classes. My question is whether there is a 'last update' timestamp that is automatically generated for each line in classes I can extract to external systems?
Thanks
Hi Everyone,
I am trying to built a SSIS package thru BIDS Visual Studio 2013. My Datasource is a InterSystems Cache Database, I wanted to Import Tables records from the Datasource to MS SQL Server 2014.
As a Sanity check. I only created one Package to import one Table to MSSQL Server to try out. The connection to the InterSystems Cache Database was successful. The DSN for the InterSystems Cache Database is created in the System for 32 and 64 Bit.

Here is where my Problem lies.
Hello,
I have been trying to pull data through a linked server in SSMS from an InterSystems Cache Database for a while, this is to enable us to join the data to other source systems in our Data Warehouse.
I have set up an ODBC connection and a linked server to the database and can execute queries through OPENQUERY in Management studio, but the data is huge (> 100million rows). So when I execute a SQL query with a WHERE clause the query just spins.
If I SELECT TOP 100 with no where clause the query returns data, so I know that all the connections are correct.
What is the difference between %ID and ID in a database table? Both seem to reference the same column labelled ID.
For context, I am trying to create a viewer class for an existing persistent class.
Let us call the persistent class A, with SqlTableName = OldA.
The viewer class will be B with SqlTableName = A and ViewQuery = {select %ID, <other fields> from <some other class with the same fields as A>}
In A, there exists a class query: select %ID from A. However, A fails to compile, giving an error: "Field '%ID' not found in applicable tables". If the %ID is replaced with ID, the class compiles.
Hi every body
I hope it's the right place & I'm not offending any body.
I'm a veteran Mumps/Cache/Ensemble programmer . I think my only draw back is my age, although my brain is still young & bubbly.
I'm looking a long time for work without success.
I gathered a lot of knowledge & experience during those long years , developed many projects & i'm ready to do any work only to feel useful.
I'll add my resume, I hope & wish that this post will bring some change as I'm desperate to get some work.
Thank you very much Simcha my email is shiluvg@gmail.
Hello everyone,
I want to fill data into my select component with sql request and parameter.
I tried to follow this example https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…
I need to call a method because my parameter can be different. I tried something like this but it doesn't work...
ClientMethod changeParams() [ = javascript ]
or like this :
changeParams() [ = javascript ]
You can see my select here :
I have a ZEN page with nine tablepanes. Each tablepane queries a table in the same SQLServer db. I have a single SQLGateWay(odbc) to this SQLServer db. I need to get better performance when I query all nine table at the same time. Would my performance improve if I had nine SQLGateWays(nine odbc configurations/connections), one for each query? I would appreciate any and all suggestions for getting the very best performance when using SQLGateWays. Thank you.
I have created a view to stage some data in a different format and then want to reference that view in a SQL query from a table that filters the data from the view using a property of the table.
Example:
select
MsgId,
FileName,
(select
ReportName
from
custom_view
where
MsgId = ReportId
) as ReportName
from
main_table
Is this even possible? When I try this, I get an error table not found for the view?
David
Hi,
I am trying to have the output of a field in sql have double quotes around them. The script is in Studio and I am accessing It through a task.
I have tried """"tect"""" and others...Please help
Aloha
Lou