- Log in to post comments
This is not a trick but a feature that I don't see used very often, but defining a unique index provides you with auto generated methods to get an oref to a row in a table by column value rather than by knowing the %ID of the row.
For example, here's a simple table with two columns:
class DC.Example Extends %Persistent {
Property Name As %String;
Property DOB As %Date;
Index NameIDX On Name [Unique];
}Let's insert a value into this table:
INSERT INTO DC.Example(Name, DOB) VALUES('John',TO_DATE('01 Jan 1986'))Suppose you know that one of the rows in a table contains the name "John" but you want to get their DOB, you can get the oref by using an auto-generated method called "NameIDXOpen()" like so:
set oref = ##class(DC.Example).NameIDXOpen("John")
write $ZDATE(oref.DOB) //prints out "01/01/86"For the curious: https://docs.intersystems.com/iris20261/csp/docbook/DocBook.UI.Page.cls…
- Log in to post comments
The open error location feature is specially helpful. I no longer have to count lines while trying to remember which type of comment counts as a line for offset purposes.
- Log in to post comments
Hi Ethan, you should check out the SQL Specialist exam page, it contains a list of resources to help you prepare for the exam (for example, this great presentation on optimizing queries). You can also browse SQL courses on our online learning platform. To practice using SQL in IRIS, you can enroll in this course that that allows you to lunch a learning lab where you can run queries in IRIS in virtual environment as you follow along with its content.
If you have any questions about the exam itself, feel free to post here or send an email to certification@intersystems.com