Chris Stewart · Apr 18, 2024 go to post

So, there's 2 ways to read this, either we want an "exists" check, or following the SQL, we want a count of all instances.   This snippet can be set to do either case based on the existscheck boolean.  Ideally though, you would have an index defined, and this could be read much more efficiently than having to scan an entire global

set count=0set existscheck=0//Set to 1 if we only want to find first instanceset targetValue=1329set key = ""for   {
    set key = $ORDER(^DataTest(key))
    quit:key=""if targetvalue = +$LG(^DataTest(key),2) do$INCREMENT(count)
    quit:existscheck&&count
}
w !,"Count value is "_count
Chris Stewart · Jun 3, 2024 go to post

If you just want a very basic conversion (i.e. not converting to a canonical date type first), then this will work

set dt = "2024-05-31T17:33:08+01:00"

set formatteddt=$ZSTRIP($PIECE(dt,"+",1),"*WPA")

write formatteddt

20240531173308
Chris Stewart · Jun 13, 2024 go to post

Hi Krishnaveni


There are 2 answers to this. The easy but wrong way , and the more correct way


The easy way would be to take the piece of the string before the space character, and then remove all nonNumeric chars

set output = $ZSTRIP($PIECE(input," ",1),"*AP")

The better was is to convert to the canonical date format, then convert back to the format you want.  Relevant documentation page: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…

set internaldate = $ZDATETIMEH(input,3)

set outputdate = $ZDATE(internaldate,8)
Chris Stewart · Jun 14, 2024 go to post

That time format isn't an inbuilt function for IRIS, so for this, you can adapt the string function above.  Take the piece before the . (as your expected output doesn't include it), then strip all non numeric

set output = $ZSTRIP($PIECE(input,".",1),"*AP")
Chris Stewart · Jun 14, 2024 go to post

The following SQL should do it

CREATE UNIQUE INDEX ON TABLE <table> (field1, field2)

You will then want to stop all operations against the data and build the index

Chris Stewart · Jun 18, 2024 go to post

It was great to see the Developer Community team!   I'm proudly wearing my new Dev Community socks today

Chris Stewart · Aug 13, 2024 go to post

The DB mappings go from least to most specific, so you could have a set such as 

GLOBAL* - GlobalsDB

GLOBAL.PKG* - PackageDB

GLOBAL.PKG.Excluded* - GlobalsDB

There is a bit of management overhead in this as you start getting more specific, but this should work

Chris Stewart · Sep 9, 2024 go to post

Thanks for all of the contributions Ben, and I share your anticipation of the return of the socks!

Chris Stewart · Sep 20, 2024 go to post

Just a note for reference in future.  The DynamicAbstractObject functionality was fully implemented in Caché 2016.2 and up (there was a version in 2016.1, but the syntax is different).   If you are on a higher version that this, using it is generally preferable to the ZENProxyObject version

Chris Stewart · Oct 9, 2024 go to post

Not sure I am quite understanding the ask, but I think you want something like

SELECT *                        
FROM PhysTable                        
WHERE ProviderName = 'DOE, JOE' AND Type = 'NPI' AND ProvId =8252
Chris Stewart · Oct 9, 2024 go to post

I am very confused about what the inputs are, and what the desired output is, but in that case a subquery would be needed

SELECT *                      
FROM PhysTable                        
WHERE ProviderName = 'DOE, JOE' AND Type = 'NPI' 
AND ProvId =(
             Select ProvId 
             from PhysTable 
             where ProviderName = 'DOE,JOE' 
              AND Type='EMPLOYEE NUMBER' 
              and IdentityId = 345678
            )
Chris Stewart · Oct 9, 2024 go to post

But 345678 is not of Type NPI, its an Employee_Number in your output above.  Restricting the subquery to NPI will return nothing for that number.   If you change the subquery to the correct Type restriction,  i would expect this to work

Chris Stewart · Oct 9, 2024 go to post

I see my mistake above, mixing Type and IdType.  Either 

IDTYPE = 'EMPLOYEE_NUMBER'

OR

TYPE ='NUM'

should give you results 

Chris Stewart · Dec 12, 2024 go to post

If you are on Windows, then you should have an .iris_history file on C:\Users\<yourusername>\.   Deleting this will clear your history

this looks ok.  Maybe try 

zw myobj

before entering the loop, just to make sure that the file stream has linked up ok?

JSON_Table got a deep dive in the context of the Document DB functionality.  @Stefan Wittmann presented an excellent session about this at last year's Global Summit

Yes, if you set up a response and request programatically as Oliver Thompson said, then you can just call the ClassMethods rather than going through HTTP to Rest.   

We have used Continous Integration to help with this.  Our Jenkins build will pull the source, compile it, zip it, and attach back to the Jenkins job.  On success, a secondary job sends this zip to the server, unpacks it, and updates the symlink for the web folder to the new one.  This way we only move source files, and we are not having to worry about build processes on a production environment

Hi Kurro

It's a bit of a low tech solution, but you can set up a stored SQL DSN for localhost, then use that to access your tables