Iryna Mykhailova · Mar 16, 2023 go to post

I know about multidimensional properties. But at this pint they aren't even listed as an option in the Wizard. And I'm not sure they are that useful for modern applications. I would guess their use was to transition applications from hierarchical model to object model. 

Iryna Mykhailova · Mar 16, 2023 go to post

> Hi @Iryna Mykhailova and welcome to the Tutorials Contest.

Why, thank you wink

Both %SQLQuery and %Query are class queries. As for the Studio - I do believe it's the easiest way for people who start working with IRIS to get acquainted with the technology!

You are right, I forgot to keep in mind that I have a parameter for the second example. I will correct it to reflect that I'm looking for people older than the exact age. Thanks for the heads-up!

Iryna Mykhailova · Mar 16, 2023 go to post

Before:

Query GetAllOlderThan(Age As %Integer = 65) As %Query(ROWSPEC = "Name:%Name,Age:%Integer") [ SqlProc ]
{
}

ClassMethod GetAllOlderThanExecute(ByRef qHandle As %Binary, Age As %Integer = 65) As %Status
{
    set qHandle = $lb($random(200), 0)
    Quit $$$OK
}

ClassMethod GetAllOlderThanClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = GetAllOlderThanExecute ]
{
    set qHandle = ""
    Quit $$$OK
}

ClassMethod GetAllOlderThanFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = GetAllOlderThanExecute ]
{
    if $ListGet(qHandle, 2) = $ListGet(qHandle, 1)
    {
       Set Row = ""
       set AtEnd = 1
    } else
    {
       Set Row = $Lb(##class(%PopulateUtils).Name(), ##class(%PopulateUtils).Integer(18, 90))
       set $list(qHandle, 2) = $list(qHandle, 2) + 1
    }
    Quit $$$OK
}

After:

Query GetAllOlderThan(Age As%Integer = 65) As%Query(ROWSPEC = "Name:%Name,Age:%Integer") [ SqlProc ]
{
}

ClassMethod GetAllOlderThanExecute(ByRef qHandle As%Binary, Age As%Integer = 65) As%Status
{
    set qHandle = $lb($random(200), 0, Age)
    Quit$$$OK
}

ClassMethod GetAllOlderThanClose(ByRef qHandle As%Binary) As%Status [ PlaceAfter = GetAllOlderThanExecute ]
{
    set qHandle = ""Quit$$$OK
}

ClassMethod GetAllOlderThanFetch(ByRef qHandle As%Binary, ByRef Row As%List, ByRef AtEnd As%Integer = 0) As%Status [ PlaceAfter = GetAllOlderThanExecute ]
{
	if$ListGet(qHandle, 2) = $ListGet(qHandle, 1)
	{
		Set Row = ""set AtEnd = 1
	} else
	{
    	Set Row = $Lb(##class(%PopulateUtils).Name(), ##class(%PopulateUtils).Integer($ListGet(qHandle, 3), 90))
    	set$list(qHandle, 2) = $list(qHandle, 2) + 1
	}
    Quit$$$OK
}

}
Iryna Mykhailova · Apr 17, 2023 go to post

I see that it's a known situation, they even added a NB in the post:

NB Dear contestants, please take into consideration that support for the contest cloud sql environment is only available during business hours M-F 9-5 US Eastern Time. We seem to be experiencing a failure of the cloud environment such that deployments are stuck in Pending status for some users.

Iryna Mykhailova · Apr 28, 2023 go to post

From what I understand in the article, in Caché 5.0 and earlier versions the modern Management Portal is called System Management Portal.

Iryna Mykhailova · May 10, 2023 go to post

This is a great opportunity to take and exam for free in a nice friendly setting. Therefore, I would definitely recommend using this opportunity.

Iryna Mykhailova · May 17, 2023 go to post

For me it's a horrible news 😭 I really prefer to use Studio when explaining how to create properties (particularly relationships) and queries (particularly Class Queries based on COS) to students who see IRIS for the first and the last time during my classes. And when something goes wrong (and it does a lot of the time) it's usually easier to ask them to delete the code that produces error and rewrite it while I'm looking than to figure out what's wrong with it. And if it something more complicated than simple properties it can take a lot of time.

Besides, not all students know (and want/need to learn) how to use VS Code and look for proper plug-ins, extensions etc. It will really make my life that much harder.

Iryna Mykhailova · Jun 14, 2023 go to post

You're not executing it:

vism1.Execute(cmd);

To make it shorter, can be

vism1.Execute('$$Check^logininput()');
sResult:=vism1.Value;

You can also find an example in this GitHub repository.

Iryna Mykhailova · Jun 27, 2023 go to post

In IRIS there are no built-in constructors. Classes that don't inherit from a system class are usually used as storage for class methods.  Therefore, if you want to create an object you need to inherit your own class from one of the system classes, like %RegisteredObject (won't save your objects to the database), %SerialObject (won't save your objects to the database on its own), %Persistent (will save your objects to the database) etc. For example:

Class Sample.Header extends%Persistent
{
Property Key As%String;Property Show As%Boolean;
}
Iryna Mykhailova · Aug 16, 2023 go to post

Can you open in your browser the address that you have in parameter LOCATION of your class that extends %SOAP.WebClient? You should at least get an error "Invalid action" if your SOAP server is created in IRIS.

Iryna Mykhailova · Aug 24, 2023 go to post

Yep, that was my first thought - can you change Property Organizations As list Of Organization; to parent/children Relationship? In this case you will get automatic cascade delete. You'll have

Relationship Responce As GetOrgUpdatesResponse  [ Cardinality = parent, Inverse = Organizations ];
Relationship Organizations As Organization [ Cardinality = children, Inverse = Responce ];

And it suggests that each responce has its own organizations objects that don't repeat.

Otherwise, you will have to delete them manually 1 by 1 in callback method %OnDelete for example

/// This callback method is invoked by the <METHOD>%Delete</METHOD> method to /// provide notification that the object specified by <VAR>oid</VAR> is being deleted./// /// If this method returns an error then the object will not be deleted.ClassMethod%OnDelete(oid As%ObjectIdentity) As%Status [ Private, ServerOnly = 1 ]
{
	Quit$$$OK
}
Iryna Mykhailova · Aug 25, 2023 go to post

I know, but it's not a question of examples, it's more a question of appreciation. There was another one interesting quiz question that actually prompted me to write this idea, I just don't remember what it was about. So, I think it would bring pleasure to authors of quiz questions to see that others like their work.

Iryna Mykhailova · Nov 14, 2023 go to post

I'd say in general, having a structured data with the actual names of fields is much better than "parsing" the text with delimiters. So I would vote for FHIR. Maybe at some point there will be a better way to represent data - and it is OK - and people will switch to it. The main idea - not to make it painful on the developers to rewrite everything!

Iryna Mykhailova · Nov 17, 2023 go to post

The command doesn't know. That's why you need to check the SQLCODE variable.

If SQLCODE  = 0 then the row exists and it was updated. If SQLCODE  = 100 then the row doesn't exist. If it not equal to either then you have a problem.

Example for Embedded SQL:

 &SQL(update WH.Size
   set Height = 1000where %ID = 10)
 write SQLCODE

Example for Dynamic SQL:

SET myquery = "update WH.Size set Height = 1000 where %ID = 10"SET tStatement = ##class(%SQL.Statement).%New()
 SET tStatus = tStatement.%Prepare(myquery)
 SET rset = tStatement.%Execute()
 write rset.%SQLCODE

Not sure what you mean by "if the row exists" in regards with insert. The row does not exist, because you're creating it.

Iryna Mykhailova · Nov 30, 2023 go to post

It's a shame, I feel like there is often something going on with Cloud SQL. Especially during contests 😄 That's why I don't feel confident to incorporate it in my course 😢 - I ask my students to use it and then they can't even set it up without a fuss.

Iryna Mykhailova · Dec 26, 2023 go to post

I'd agree with @David Hockenbroch - if you have a UI, you will most likely find it easier to work with a csp page like a usual html and all that. But if you don't have a UI (or it's super simple), then you would create a cls file and extend the %CSP.Page.