SQL

Syndicate content 27 

Hi everyone,

Im new  in cache, i came from Java and im missing some features that i couldn't find in the documentation,  I hope you can help me with this questions.

Just a brief introducction: 

- Im in a project with old cache version, so saddly i can't use Eclipse + Atelier, so im using Studio.

- Currently im in a project with persistent classes, we want to turn apart the globals and focus on tables. 

The questions:

Is there any way to make something like hibernate for cache %Persistent classes? For example, if i want to get all the records for a table in Java+Hibernate+Criteria i'll do something like this:

myListOfObjects = myPersistentClass.list(); // Equivalent to SELECT *

In cache i have to  create a %SQL.Statement, put the query inside and get the recordSet, iterate it and then get a list of %Persistent objects, for every object i want to use it.

0   0 1
0

answers

0

comments

25

views

0

rating

Hi, I have used CSP to exec SQL selects from  any own NAMESPACE. But in our servers we have many SQL GATEWAY CONNECTIONS.

I'd like to create a CSP page that could use these gateway to exec SQL using these gateway connections, only Administrators will use that page to launch many select at many dsn. I'm not sure if we must deploy that CSP on %SYS namespace and how to use DSN(SQL Gateway connections) that are defined on server.

Anoyone has made that?

For example:

DSN CLIENT ONE

DSN CLIENT ONE

 

CSP Webpage:

TEXTBOX: Introduce your select:

select count(*) from product where stock<100 

OPTION BUTTON:

*CLIENT ONE

*CLIENT TWO

 

Result:

Product One.

Product Two.

Product Five...

 

 

 

 

0   0 1
0

answers

0

comments

36

views

0

rating

SQL gateway. 'Locking' problem.

while debugging, is there in Caché a command to 'unlock' the instance of a class ?

close class, and kill class is not enough.

same problem in %Activate link

for each debug I have to exit (Halt) the terminal, 

make debug in C#

coming back , and re-load again in Caché.

Regards,

Emanuel

0   0 1
0

answers

0

comments

75

views

0

rating

I have the following class definitions:

Class PET.RadioTracer Extends %Persistent
{
Property TracerName As %String;
}
Class PET.Injection Extends %SerialObject
{
Property RadioTracer As RadioTracer;
}
Class PET.ImageStudy Extends %Persistent
{
Property Injection As array Of Injection;
}
Class PET.ImageFile Extends %Persistent
{
Relationship Study As PET.ImageStudy [ Cardinality = parent, Inverse = ImageFiles ];
Property InjKey As %String;
}

I can refer to the TracerName for a given ImageFile object with the following syntax:
obj.Study.Injection.GetAt(obj.InjKey).RadioTracer.TracerName

Is it possible to write an SQL statement to search the PET.ImageFile table to find a match based on the RadioTracer.TracerName?


 

Last comment 20 August 2018
0   0 3
0

answers

327

views

0

rating

Hi,

I have a question related with EnsLib.SQL.OutboundAdapter adapter.

Is there a way to open an oracle transaction and do either commit or rollback depending on the query result?

Is posible to keep open an oracle transaction to execute a lot of queries on different methods on the same business operation and do a commit when the business process finished?

Thanks and Best Regards

Sergio Vidal

Last comment 24 July 2018
0   0 2
0

answers

158

views

0

rating

Without installing Kerberos has anyone Authenticated a SQL JDBC connection? Currently we are using local SQL Accounts to sign onto External SQL Databases, but we are being told that we need to switch to Service accounts that live on a Active Directory Domain. 

I wrote with a little help a ZAUTHENICATE to do the Authentication for Ensemble, can I use something like that to connect to an External SQL Database using a Service Account on a Active Directory Domain?

Thanks

Scott

Last comment 7 June 2018
0   0 3
0

answers

169

views

0

rating

Any insights, news, alternatives or experience about sequence pattern querying like with Oracle's MATCH_RECOGNIZE, more declarative, less simple direct COS way? Both obvious solutions (shadowing data to oracle cloud or implementing MATCH_RECOGNIZE compiler in COS from scratch) seem big overkill. Do Intersystems have plans to adopt this "2007 ANSI standard proposal" and "SQL:2016 standard"

My problem is regular need to do analytics on medical lab data dynamics and correlations, and while its always doable by COS and multiple SQL statements, such handcrafting for every new hypothesis/idea or statistic takes some hours each and definitely is not something that can be delegated to non-programmers.

Last comment 4 May 2018
0   0 2
0

answers

168

views

0

rating

I have a lookup table and record batch Table I would like to do a count on the records stored in that batch by counting the number of records in that batch that have  a certain key on the responseKey column. This column keys are stored in the look up table for comparison. So I would like to do a join sql pivot that will use my keys stored in the lookup as columns and count as values

so far I have managed to do this but this is not efficient I would like to fire that sql once not on every count

SELECT * FROM
(
SELECT tMatch.DataValue, Count(*)
FROM ResponseRMAP.Record bRecord
JOIN Match ON tMatch.TableName = 'Match' AND tMatch.KeyName = bRecord.ResponseCode
WHERE bRecord.%ParentBatch = 55

)
 
Last comment 4 May 2018
0   0 2
0

answers

275

views

0

rating

Hi, I'm a student, weak programming. I ask for your help, I write a program in C #, there are two tables, but I do not understand how to organize the connection between them many to many. Table in DataGridView1 from DataSet1 on Form1 key connection in DataGridView1 from DataSet1 to Form3

I do this on Form1

private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 
{
  if (e.RowIndex >= 0)
  {
    DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
    Form1.IDfor3form = row.Cells[1].Value.ToString(); // By the Bilet column
    Form3 c = new Form3();
    c.Owner = this;
    c.Show();
  ​}
}

and on Form

Last comment 12 December 2017
0   0 1
0

answers

235

views

0

rating

I have a simple SQL service that does a simple select from an SQL database. After the select, I do an update to set the ProcessedFlag to "Y" for yes, so my next pass doesn't select records already processed. The service works fine, except when it's done I get the error below, anybody know what is causing this error

Last comment 24 August 2017
0   0 3
0

answers

173

views

0

rating

I am trying to balance a query using a SQL Inbound Adapter against the output of Ensemble. I am finding that a couple of records here and there are missing in the output file. 

Most of our queries are based of of views which may or may not have a unique key.

So If you don't have a Delete Query in your settings and Key Field Name is blank, it is possible that some records may or may not make it through to your endpoint?

Thanks

Scott Roth

Integration - Interfaces

The Ohio State University Wexner Medical Center

0   0 1
0

answers

0

comments

141

views

0

rating

 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.  Here is one that works:

    SELECT COUNT(DISTINCT DestinationURI) FROM HS_IHE_ATNA_Repository.Aggregation
    WHERE EventType = 'CROSS GATEWAY QUERY'

Last comment 30 November 2016
0   0 4
0

answers

1654

views

0

rating

Hello! 

I'm trying to run a simple SQL query in atelier but it complains about the manager.  I'm not sure if this is the best way to do it but here is what I got so far:

 



	ZNSPACE "User"
	
	SET domId = 1
	SET flister=##class(%iKnow.Source.SQL.Lister).%New(domId)
	SET myloader=##class(%iKnow.Source.Loader).%New(domId)
 
 
	SET myquery="select top(10) EntityValue, CorpusFrequencyAsRelation, CorpusSpreadAsRelation from %iKnow_Objects.EntityUnique  WHERE DomainId = 1 ORDER BY  CorpusFrequencyAsRelation desc"
	SET idfld="EntityValue"
	SET grpfld="CorpusSpreadAsRelation"
	SET dataflds=$LB("CorpusSpreadAsRelation")

	SET stat=flister.AddListToBatch(myquery, idfld, grpfld, dataflds)	
		IF stat '= 1 {WRITE "The lister failed: ",$System.Status.DisplayError(stat) QUIT }
	SET stat=myloader.ProcessBatch()
		IF stat '= 1 {WRITE "The loader failed: ",$System.Status.DisplayError(stat) QUIT }


And the error I get

Last comment 14 March 2016
+ 1   0 7
0

answers

216

views

+ 1

rating

What is the recommended approach to handle the following scenario: Large number of HL7 messages are serviced via Ensemble. Those messages are then transformed and routed to an Operation which calls a web service which does a number of different activities. If will do address normalization, location geo coding, MPI lookup and resolution, and insert into a SQL Server database to stage for an analytics product. Unfortunately all of this work takes time and the first thing that happens in the web service is a lock taken out on the Patien in SQL Server. Each call can take seconds where the message input is taking milliseconds. This starts to impact the operation queue as the soap calls can be blocked by the locks. The Ensemble operation is waiting on the web service to return.

Last comment 4 March 2016
+ 1   0 5
0

answers

386

views

+ 1

rating

Here is my original query:

SELECT EventType, InitiatedAt, COUNT(*) as cnt
FROM HS_IHE_ATNA_Repository.Aggregation
WHERE EventType = 'LOGIN'
AND LocalDateTime > '2016-02-16 11:00:00'
GROUP BY EventType, InitiatedAt

This gives me data like this:

LOGIN%SYSTEM69918
LOGINOTHER39


However, I need to get the data back as two columns with all but the last concatenated and delimited, more like this

Last comment 17 February 2016
0   0 4
0

answers

1000

views

0

rating

Hi!

Is there any simple way to query data about processed messages in all Ensemble productions?
What I ultimately would like to do is to periodically export that data to another system and run statistics on it.

I've been digging around in the SQL tables view and Ens.MessageHeader seems to contain most of what I'm after.
Using ODBC I could access that table view and query data, but only for one namespace per DSN it seems.

Can Ens.MessageHeader from different namespaces be mapped into a single namespace so that it can be accessed with ODBC?
Or is there a better way to access this data than to use the ODBC interface?


Thanks
Andreas
 

Last comment 31 January 2016
0   0 5
0

answers

269

views

0

rating

New to CSP and Zen.  I've been going through tutorials and have made some progress.  Using the "Contacts" tutorial as an example, I'm trying to create a "ViewContact" page.  I want this to be linkable so I'm using URI Parameters, which I understand.  However, what I'm not sure about is how to retrieve a specific record.  Should I use a SQL statement?  If so, how?

Let's say I just wanted to display the property "Name" for the contact with ID 12.  What would be the best way to do so?

Last comment 14 January 2016
0   0 4
0

answers

135

views

0

rating