Iryna Mykhailova · Mar 23, 2024 go to post

I'm not sure there is a ReplaceStr or Strip functions in ObjectScript. But $replace should work if you need to get rid of "\T\":

USER>write $replace("AIS|1||COLO \T\ EGD^COLONOSCOPY \T\ EGD|||||||Can||", "\T\", "")
AIS|1||COLO  EGD^COLONOSCOPY  EGD|||||||Can||
Iryna Mykhailova · Mar 23, 2024 go to post

First of all, there are no links to docs you've tried in your post. If you add them (or the code from them) it will be easier to understand what you've already tried.

In general, I believe the easiest way to insert data in your case will be to use SQL. You can either write something like 

insert into JASON.BikeDB (Make, Model) values (:make, :model)

and pass the values of parameters.

Or if you wish to use your class method, you will first need to add a modifier SqlProc to it:

ClassMethod SaveNew(Make As %String, Model As %String) [SqlProc]
{
    Set obj=##class(JASON.BikeDB).%New()
    Set obj.Make=Make
    Set obj.Model=Model
    Set sve=obj.%Save()
}

and then call this as a stored procedure:

begin
   JASON.DataBase.SaveNew(:make, :model);
end;
Iryna Mykhailova · Mar 21, 2024 go to post

I feel like I have to pass more courses on the Learning Services to get more badges now 😁

Iryna Mykhailova · Mar 21, 2024 go to post

Can't even log in there - I get asked for a login and password in a loop 😭🤣 It doesn't seem to work for the Developer Community moderators' accounts.

Iryna Mykhailova · Mar 19, 2024 go to post

I will definitely agree with @Chi Nguyen-Rettig - it may be pretty helpful for some basic stuff you forgot when you're middle or senior developer and when you know exactly what you're looking for. So it's basically a bit like doing the usual search but without the need to wade through the search results.

But when you're talking about beginners - I see all kinds of things from my students (who for some reason just don't want to open the lecture and prefer to get answers themselves from other sources) that have nothing to do with the reality and don't work most of the time.

All in all, I wouldn't use ChatGPT to write code that does something complicated. But it may or may not be a good source answers for simple questions. And in this case, you still need to understand what's going on to be able to assess the correctness of what you see. Case in point, some spam posts on the Community - people try to cheat and write "articles" using ChatGPT which generates class/package names that don't even exist.

And if you think about it, where does ChatGPT get its answers? From the knowledge base somewhere. So if this data is not there, it can extrapolate and come up with something that may give you general direction but may not work.

Iryna Mykhailova · Jan 19, 2024 go to post

Oh, wow! It's so cool to be recognized not in 1 but 2 nominations! Congratulations to everyone!

Iryna Mykhailova · Dec 30, 2023 go to post

Congratulations to the winners! Well done! Hope you had fun doing all the daily challenges!

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.

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 · 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 = 1000
 where %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 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!