Jack Huser · Oct 17, 2018 go to post

Hello,

There is several method to do so... depending of the context of your needs... if your error msg is at the beginning of the line, in the input text or alone...

You can use extract:

set mystring = "ERRORMSG"

write $extract(mystring,3,*), !

see: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…

this method would not be used if your input string does not start with "ERRORMSG"

if you know exactly that you want to remove ER from ERRORMSG you can use $replace

set mystring = "this is an ERRORMSG"

write $replace(mystring, "ERRORMSG", "RORMSG"), !

see: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…

you can use a $piece : https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…

set mystring = "this is an ERRORMSG"

set textToRemove = "ER"

write $piece(mystring,textToRemove)_$piece(mystring,textToRemove,2), !

Though this last method would have a problem is the string "ER" is repeated in the input string

I hope this help

Cheers,

Jacques

Jack Huser · Nov 6, 2018 go to post

Hello,

You have to navigate through subscript using $order.
Assuming your first node is "under2" and won't change, and assuming your date is "DD-MM-YYYY"

you can do:

ClassMethod TestGlobalAccess(){   set ^checker("under2", "Eric David", "02-05-2018") = ""   set ^checker("under2", "Eric2 David2", "02-07-2016") = ""   set ^checker("under2", "Name1 Name2", "07-06-2018") = ""   set Name = ""   for {        set Name = $order(^checker("under2", Name))        quit:Name=""        set DateBirth = ""        for {             set DateBirth = $order(^checker("under2",Name,DateBirth))             quit:DateBirth=""             set CacheDateBirth = $zdateh(DateBirth,15)             if ((+$h-CacheDateBirth)>730) {                  write $$$FormatText("%1 with Birthdate=%2 is older than 2 years",Name,DateBirth), !             }        }    }}

I hope this help.

for date conversion I decided to convert the birthdate into Cache Date, instead of converting $horolog into "DD-MM-YYYY" format.
But your method work also.

If you have only one record you can do:

ClassMethod Test(){   set ^checker("under2", "Eric David", "02-05-2018") = ""   set Name = $order(^checker("under2", ""))   quit:Name=""   set DateBirth = $order(^checker("under2",Name,""))   quit:DateBirth=""   set CacheDateBirth = $zdateh(DateBirth,15)   if ((+$h-CacheDateBirth)>730) {      write $$$FormatText("%1 with Birthdate=%2 is older than 2 years",Name,DateBirth), !   }}

I hope this help.

Cheers,

Jacques

Jack Huser · Feb 5, 2020 go to post

Hello Olga,

Are InterSystems employees allowed to fill a Review or is it only for clients and partners using InterSystems technologies?
Even if it is not for the reward, at least we can review the products we are working on, for our company's fame.

Regards,

Jacques

Jack Huser · Feb 5, 2020 go to post

Hello Evgeny,
True ^^
It would have been nice to say nice things on Gartner
I'm following Open Exchange carefully, and hope to have a good idea to develop and to share on it.

Cheers,

Jacques

Jack Huser · Feb 23, 2021 go to post

Hello,

Very nice article. Thank you very much for your time

Regards,

Jacques

Jack Huser · Aug 26, 2021 go to post

Hello Wanbo Wang,

This error means that you have some element modified in TrakCare as Site level (or deleted), but the Questionnaire is Region Level. To solve this issue, you should check in TrakCare what GUID is missing:

Tools >> Change Control >> Find GUID

 

Check which component should have been saved as Region level or has been removed.

Once you have it saves as Region Level you will be able to commit to P4.
I checked in Perforce and it seems the component was deleted on 6 november 2020 with JIRA TC-260035 but recreated on 1st august 2021 with JIRA TC-301371.

 

So your problem should have been solved.

Regards,

Jacques

Jack Huser · Aug 26, 2021 go to post

Hello,

It depends on the SQL Table you are considering.

Some SQL Table have a column Y/N indicating that the record is active or not. In addition to a DateFrom and DateTo.

if the component has a checkbox "active" the SQL can be
Select * from SQLUser.SQL_Table where ActiveColumn = 'Y' and (DateFrom <= CURRENT_DATE or DateFrom is null) and (DateTo >=CURRENT_DATE or DateTo is null)

But it depends on the Table you are considering.

Please can you detail your needs?

Regards,

Jacques

Jack Huser · Sep 10, 2021 go to post

Thank you very much Robert.
And for the $zh I did not know.

It's always a pleasure to learn from you and all the expert of Developer Community.

Jack Huser · Sep 14, 2021 go to post

Thank you very much, I never knew it was possible to read a file that way.
I tried too with MUMPS doing "open for {use read}" but had the same result. Thank you very much.

Jack Huser · Sep 21, 2021 go to post

Hello Everyone,

Thank you for all your really interesting comments. It helped a lot, especially on using ObjectScript classes I wasn't aware of.
But there could be a misunderstanding on the subject of this article.

The goal was not comparing several languages, but rather : "I did it with ObjectScript and the performances the way I did was not matching my expectations, so I would like to use an other language I know that match my expectations".
And to do so, before this language is embedded in ObjectScript I will use the external language Interface.
However, if I have known to use  %Stream.FileCharacter, I still would have done it in Python so that I can use $system.external Interface :)

Jack Huser · Sep 21, 2021 go to post

I apologize for the misunderstanding, my goal wasn't comparaing two languages, but rather using external languages Interface in ObjectScript ;)

Jack Huser · Oct 6, 2021 go to post

Hello Guilherme,

I'm not sure about what your goal is, but alternatively, you can use Stored Procedure attached to each group

<report xmlns="http://www.intersystems.com/zen/report/definition" name="MyName" runonce="true">
    <attribute name='attribute1' expression='..GetXXXXX(..P1)'/>
    <attribute name='attribute2' expression='..GetXXXXX(..P2)'/>
    <group name="GroupQuery1" queryClass='Custom.Reports.ZEN.StoredProc.StoredProc1' queryName='Query1'>
      <parameter field="attribute1"/>
      <parameter expression="..GetYYYY()"/>
      ...
      <group name="GroupResponse1">
        ...
      </group>
    </group>
    <group name="GroupQuery2" queryClass='Custom.Reports.ZEN.StoredProc.StoredProc2' queryName='Query2'>
      <parameter field="attribute2"/>
      <parameter expression="..GetZZZZZZ()"/>
      ...
      <group name="GroupResponse2">
        ...
      </group>
    </group>
</report>

Hope this help

Regards,

Jacques

Jack Huser · Feb 2, 2023 go to post

Very very very interesting tutorial and wonderful example.
And very funny too (loved the "Mordor co" stuff), thank you so far for taking that time to share.