Hi Guys
I'm rather new to HealthConnect, and I've been doing a lot of work with the browser based SQL portal and don't particularly like it. Is there an alternative application that I can use, something like SQL Express or VScode with a plugin?
Andy
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
Hi Guys
I'm rather new to HealthConnect, and I've been doing a lot of work with the browser based SQL portal and don't particularly like it. Is there an alternative application that I can use, something like SQL Express or VScode with a plugin?
Andy
One of our apps uses a class query to support a ZEN Report and works just fine in that report, producing the expected results every time. We’ve since migrated to InterSystems Reports and noticed that, for a report using the same class query, 100s of extra rows with the same column values appear at its bottom.
We eliminated InterSystems Reports as the source of the problem by recreating the same “extra rows” issue with an Excel spreadsheet calling the same class query as a stored procedure.
What was the issue?
I want to INSERT a record in a database using JDBC in OBJECTSCRIPT. At the same time, I want to obtain the insert ID. Is there a way to achieve this using the SQL Outbound adapter?
My code is something like this now:
Property Adapter As EnsLib.SQL.OutboundAdapter;
set sql = " INSERT INTO Prenotazioni_CUP "_
" (ID, cf
" VALUES (SEQTAB.NextVal, ?) "
set status = ..Adapter.ExecuteUpdate(.rs, sql, pRequest.cfAssistito)
Hi guys,
My client has a requirement to add a column of random numbers to the query result.
I wrote a function as below:
Class Utils.SqlUtility Extends %RegisteredObject
{
ClassMethod GetSomeNumber(intInput As %Integer) As %Integer [ SqlName = GetNumber, SqlProc ]
{
Return $R(intInput)
}
}
But in the returned sql result, every row share the same value, as below,
SELECT Utils.GetNumber('456'),
ID, Citizenship, DOB, FirstName, Gender, IDNumber, LastName, PatientNumber, PhoneNumber
FROM CDR.Patient
.png)
How may I refactor the function or sql to make the random value really random on each of the rows?
Thanks.
I need to execute multiple DELETE statements in a single query like this
DELETE FROM TableName WHERE ID = 2;
DELETE FROM TableName WHERE ID = 3;
DELETE FROM TableName WHERE ID = 4;However It does not work when there're more than 2 statements and gives me an error
Expected FROM found WHERE^DELETE FROM TableName WHERE
Using IN is not an option.
Good morning -
As we're starting to create more custom message classes to represent out JSON-based integrations, I was pondering how to implicitly grant SELECT privileges to a specific Security Role so they can utilize Message Viewer to search through the message history.
So if all of our custom JSON message classes are under OurParentPkg.Messages.REST.* (e.g., OurParentPkg.Messages.REST.AddPatientRequest and OurParentPkg.Messages.REST.AddPatientResponse), is there a method to ensure that our analysts can be granted the SELECT permission to anything created under OurParentPkg.Messages.
Hello, I wonder if we can run SQL queries to find data in Lookup tables?
I have written below method inbound adapter myAdapter Extends Ens.InboundAdapter [ ProcedureBlock ] returns -400
If i have written in any other Extends %Persistent cls , always returning -30 which means Table not found
ClassMethod FetchMsgCount() As %Integer
{
set msgCount=-1
&sql(SELECT count(ID) INTO :msgCount FROM Ens.MessageHeader)
If SQLCODE=0 Quit msgCount
Quit SQLCODE
}
Could you please some one tell me where should write this class method? What I am doing wrong?
Thanks
PRASHANTH
Benjamin De Boe wrote this great article about Universal Cached Queries, but what the heck is a Universal Cached Query (UCQ) and why should I care about it if I am writing good old embedded SQL? In Caché and Ensemble, Cached Queries would be generated to resolve xDBC and Dynamic SQL. Now in InterSystems IRIS embedded SQL has been updated to use Cached Queries, hence the Universal added to the name. Now any SQL executed on IRIS will be done so from a UCQ class.
Why did InterSystems do this? Good Question! The big win here is flexibility in a live environment.
Hi Community
I have extended my operation class from Ens.BusinessOperation class . I want to execute below sql on cache.
&sql(Select demoVersion into :DemoVersion from demointerface.DemoInstances where ID=:demoID)
this line not even giving error.
Please suggest me how to make sure my sql query should work everytime , when i call the class method
Same code is working fine in production but not working in local:(
Thanks a lot
Prashanth Ponugoti
I have an ObjectScript class with a Log property of type %Stream.GlobalCharacter. I need to search the end of each of the logs - is there a way to extract the last 10 lines of the Log stream for each object via SQL? Or is my only option to write an ObjectScript routine to walk the table and inspect each Log property one by one?
Thanks!
Hi Community,
We're pleased to invite you to the upcoming webinar in Spanish called "IntegratedML - Creating ML models in minutes"!
Date & Time: September 30, 4:00 PM (CEST)
Speaker: @Eduardo Anglada, Sales Engineer, InterSystems Iberia
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…
method Export(savertn As %Boolean = 0) [ Language = objectscript ]
I am looking to export table to a text file in a programmatic way. I am not familiar with this class and how to invoke a "savertn" as input here.
Essentially I would like to Export Table (SELECT * FROM Table) and save it as a text file locally on Linux server. Is there any examples out there of that? Perhaps I need to save the query output to a global and then pass that input to the export?
So I am working with an inherited SQL query that queries 8 different tables. 5 of which have over a million records.
I have 3 different servers.
Server 1, Server 2 and Server 3. They all have the same data/tables/structure across all servers.
Server 3 has an Iris database engine and the other 2 are Cache 2015.1.4.
I have a problem with views and performance across the servers being inconsistent.
Thankfully Server 1 is the current live server that performs "fast enough".
Server 2 is being synced from Server 1 and acts as a report server.
And Server 3 is supposedly a new Live server.
Hello Community,
we want to use a specific index on our sql-class.
The index we want to use is called "iFilter".
Currently we use the following technique of ignoring all other indices because the automatically chosen index is always too slow.
SELECT TOP 100 d0.ID FROM %IGNOREINDEX Belegindex %IGNOREINDEX KundenNrGlobalindex %IGNOREINDEX Rechnungsnummerindex %IGNOREINDEX Erfassungsartindex %IGNOREINDEX Belegsuche %IGNOREINDEX DatumAuftragindex %IGNOREINDEX OnlineBestellnummerindex %IGNOREINDEX Belegnummerindex %IGNOREINDEX KundenNrGlobalindex %IGNOREINDEX VAMindex %IGNOREINDEX BelegnummerbeiLagerLagerBestellungIndex %IGNOREINDEX iStatusSolr db.BelegeKopf AS d0 WHERE (((d0.KundenNr = 'BUKR01')) AND d0.ErfassungsartBez IN ('AB', 'AN') AND d0.DatumAuftrag >= '2020')Hello everyone
I am new to cache. In an interview i was asked how to optimize a sql query.
I just said I will create index on conditions which are present in where clause. But as per interviewer I should check How query plan is getting executed. This will help in optimizing Sql queries.
I want to know what will be the answer for how to optimize SQL query in cache.
Thanks in advance!!
How Can I Do It (rebuild index) using ObjectScript?
.png)
After linking in Oracle Table with Field Column's Data Types of NUMBER, my updates into these table fields are resulting in data that is being rounded to 2 decimal places. I insert a record with 1234.1234 and 1234.12 is stored.
It appears Cache xDBC might be manipulating my values prior to sending to Oracle. Is there a setting or system parameter that is controlling this? If so, is there a way to relax this from occurring so the values I send are being stored in Oracle with the same values?
I'm wanting to write a query in SQL that will return a row with a count for each day for a given month or year for a specific operation or configname. The following is a start but I'm not finding what I want in the documentation to parse out the TimeLogged field of the table. Nay help is appreciated.
SELECT count(TimeLogged), ConfigName
FROM Ens_Util.Log
where TimeLogged like '2021-07%'
and ConfigName = 'operation_Name'
group by TimeLogged
Hi, Is there a way to connect to a MYSQL ODBC? I tried using the SQL Connect class but getting an error.
Set conn=##class(%SQLGatewayConnection).%New()
Set sc=conn.Connect("databasename","username","password")
&sql(insert into ORDERS (column1, column2, column3, column4, column5) values(:value1,:value2,:value3,:value4,:value5))
s sc=res.Close()
Set sc=conn.Disconnect()
But I am getting an error :
Please can you advice how I can do this?
Trackcare 2021.2
Please may I know how to access SQL parameter with string as datatype with NO reference to SQL Table and SQL Column.
Hi Experts,
I have these two clarifications to make:
This is what I tried: Tired to create ERD diagrams and try to extract Primary and Foreign keys to associate, but I cannot in this case
I would like to do something like this
Select * FROM
SQLUser.SS_User SSU
LEFT JOIN SQLUser.CT_Loc CTL ON CTL.CTLOC_Desc = ?? < Cannot find Info here>
WHERE SSUSR_Initials = 'xxxx"Hi,
How to write code in table trigger to send SMS upon any modification on particular column?
Thanks
Dear Experts,
I have to pull out a report of certain code tables and this is my first script and I need to write many.
1. If I have to refer to the table, seeing the reference in the components with reference to SQL table and column,
can I use Select < What I need from the table>
Inner join with reference table?
I tried, I used the code table reference in the components, but I am getting errors,
| Code | CT_abc |
| Loc | ID |
| Type |
P: Public Pv: Private C: Community |
| code | CT_loc. |
How strange this is to me. I'm querying a table against a numeric(15,2) column call max_client_resp_service. When I query max_client_resp_service > 0 or any number, I get results, but they are not always right, for example where max_client_resp_service > 5 returns values less than 5, e.g. 2.00. When I query < 110 of any higher number I get zero results. It's as though the comparison operator, especially less than function is not working. See attachments for screen shots. I'm stumped. Ok looking at this further, it appears ">" returns all records, "<" returns no results.
I'm working in an application that uses %SIMILARITY to find matches among a set of documents that vary greatly in length. It's generally good but I've noticed issues with ranking short partially-matching documents over longer documents that match the search string entirely.
Reading up on the Okapi BM25 ranking function (which is what %SIMILARITY / the %Text package use) at https://en.wikipedia.org/wiki/Okapi_BM25
Hi,
When for any particular reason I need to update a record and don't want to pull the triggers, the keyword %NOTRIGGER can be used. But I've been trying to do the same when I change the row using the object approach, but I can't find it. Anyone knows if it's possible to avoid pulling triggers when working with objects?
Sadly, the utility "DISABLE^%NOTRIGGER" doesn't seem to exist ;-)
Thank you,
David
Apologies if this isn't the correct forum but here goes..
I'm accessing an Intersystems database from MS SQL Server using Intersystems ODBC driver and using OPENQUERY statement to read metadata of tables using
SELECT * FROM OPENQUERY([<linked server name>], 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS')
but I get an error message saying INFORMATION_SCHEMA.COLUMNS cannot be found.
Intersystems SQL documentation does reference this table so is there some other way to access this table or is it maybe a permissions issue?
When I'm asked questions about SQL, I like Intersystems staff at the WRC, generally ask about the Query Plan. My feeling is that even before you run a query you should examine the results of Show Plan to confirm that the code is going to give me the results in the manner I would expect. If I expect it to leverage an index and I see that it is not then I go back and look at what I might have done incorrectly and try to re-write the query to get the index behavior I'm looking for.
How to implement table splitting in cache
Hello All
I'm running into an issue performing UPDATES that I'm not getting on INSERTS. It's probably obvious, but I'm just not seeing it and could use a little help.
I'm going over an HL7 message and depending upon varying criteria, the relevent variables will get items added to them like the following:
Set patientId = pRequest.GetValueAt("PID:3")
Set sqlColumns = sqlColumns_",patient_id"
Set sqlValues = sqlValues_",?"
Set par($i(p)) = patientIdAfter compiling the variables, I check to see if accession number is found in the table.
set performInsert = 1
set performUpdate = 0
...
set sqlQueryText = "SELECT id FROM table_name WHERE accession_number= ?"
set sc = ..Adapter.ExecuteQuery(.resultSet,sqlQueryText,accessionNumber)
if $$$ISERR(sc) {return sc}
while (resultSet.%Next() '= 0){
Set performUpdate = 1
Set performInsert = 0
}
Set par = p