Article
· Sep 20, 2018 2m read
Get Day of the Week from Date

This code snippet determines the day of the week associated with a date. The class method "test" takes a date as a string in "mm/dd/yyyy" format, and returns an integer corresponding to a day of the week:


Class cartertiernan.getDayfromDate Extends %RegisteredObject
{
    classmethod test(date) as %Integer {
        //Set date = $ZDATE(date) //  Looks like: mm/dd/yyyy
     
        Set monthList = $LISTBUILD(0,3,3,6,1,4,6,2,5,0,3,5) // (Jan,Feb,Mar,Apr,...)
        Set centuryList = $LISTBUILD(6,4,2,0) // first two digits divisiable by 4, then subsequent centuries. EX (2000, 2100, 2200, 2300)
        Set dayList = $LISTBUILD("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") // Index goes from 0-6
         
        Set day = $PIECE(date,"/",2) // get the day 
        Set monthVal = $LIST(monthList,($PIECE( date,"/",1 ))) // get the month value
        Set first2DigsYear = $PIECE( date,"/",3 ) \ 100 // get the last 2 digits of the year
        Set last2DigsYear = $PIECE( date,"/",3 ) # 100 // get the first 2 digits of the year
         
        // Used for DEBUG perpouses
        /*write !,"day: ",day
        write !,"Month: ",monthVal
        write !,"last2: ",last2DigsYear
        write !,"first2: ",first2DigsYear
        write !,"cen Val: ",$LIST(centuryList,(first2DigsYear # 4) + 1),!!*/
         
        // Look here for formula explination (its the "Basic method for mental calculation")
        // http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
        Set dayOfWeekVal = ( day + monthVal + last2DigsYear + (last2DigsYear\4) + $LIST(centuryList,(first2DigsYear # 4) + 1 ) ) # 7
     
        Quit dayOfWeekVal
    }
}

Here's a link to the code on GitHub

(originally posted to CODE by Carter Tiernan, 6/18/14)

2 1
1 882

Hey Developers!

Do you want to reap the benefits of the advances in the fields of artificial intelligence and machine learning? With InterSystems IRIS and the Machine Learning (ML) Toolkit it’s easier than ever.

Join InterSystems Sales Engineers, @Sergey Lukyanchikov and @Eduard Lebedyuk, for the Machine Learning Toolkit for InterSystems IRIS webinar on Tuesday, April 23rd at 11 a.m. EDT to find out how InterSystems IRIS can be used as both a standalone development platform and an orchestration tool for predictive modelling that helps stitch together Python and other external tools.

3 1
0 456

I have two local instances:

  • IRIS for Windows (x86-64) 2018.1.2 (Build 626_3U) Wed Jun 12 2019 19:07:59 EDT
  • IRIS for Windows (x86-64) 2019.1 (Build 510U) Thu Mar 14 2019 14:13:37 EDT

I'm using Java Gateway to talk to external system.

Both instances are using the same:

  • jar
  • generated class
  • java version


They are calling the same method with this java signature:

1 1
1 190

We have a situation where we want to save the patient photo (or any other attachment) received via FHIR to a persistent property without decoding it. When it is sent out again using FHIR is is stored in the encoded format and need not be encoded. We do not need to decode it for our application. We always use it on another system that retrieves it or saves it via FHIR and therefore it is always received or sent embedded in JSON.

0 1
0 423

Introduction

Nowadays, there is a lot of applications that are using Open Authorization framework (OAuth) to access resources from all kinds of services in a secure, reliable and efficient manner. InterSystems IRIS is already compatible with OAuth 2.0 framework, in fact, there is a great article in the community regarding OAuth 2.0 and InterSystems IRIS in the following link here.

5 1
0 1.2K

Hi all, I am having problems trying to get Docker to run correctly on my Linux Mint machine.

I did the following:

1. Installed Docker.

docker --version

Docker version 19.03.6, build 369ce74a3c


docker-compose -v

docker-compose version 1.17.1, build unknown

2. Downloaded zip from https://github.com/intersystems-community/iris-fullstack-template/tree/42f9c174a9a4e63cb5eb3eb646abf3930a6e4d31

0 1
0 371

Hey Developers,

Enjoy watching the presentation of the IRIS-REST-API-DATABASEMANAGER app that allows you to create persistent Tables and Data in InterSystems Cache Database:

IRIS-REST-API-DATABASEMANAGER Demo

https://www.youtube.com/embed/bUT-NYZC9FM
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

7 1
0 145

InterSystems technologies are renowned for their high performing databases, which support the systems and operations of many organisations. However a key ingredient to this success is the quality and maintainability of their code.

The quality of code can impact everything from speed and ease of fixing bugs and making enhancements, to the overall performance of your organization and your ability to get ahead in the marketplace.

By ensuring your code is maintainable, you can reduce approximately 75% of the systems life cycle costs*. This is why, at George James Software, the solutions we build are always straightforward and written in high quality code - because we know that this solid foundation can positively impact the rest of your organization.

With a maintainable system you're able to reduce your overall maintenance as any issues that occur are significantly faster to identify and fix. This means you're free to allocate that time and budget to enhancements, enabling you to get the most value out of your applications and ultimately better support your organization.

Keep an eye out for our next few posts about what a maintainable system looks like and the tools that can help you keep your code maintainable, in order to help you to reduce those maintenance costs.

3 1
1 375
Question
· Apr 27, 2022
using SSH to connect to IRIS

Has anyone here successfully connected to a community edition version of IRIS through port 22 to localhost? I have been trying for hours and hours to connect a Mobaxterm terminal session to IRIS and am at a total loss. Im not sure if port 22 isnt opening at this point or if its a configuration issue on my part. I am seeing either "Remote side unexpectedly closed network connection" or "connection refused" when i try to run the SSH session. I have tried 22/51773/1972 etc port settings under add/edit server to no avail. Any help is appreciated. Thanks.

Mobaxterm settings

0 1
0 495

I want to embed the DTL editor in a third party web application.

If I open up the DTL editor then the full management portal banner is displayed.

http://localhost:52773/csp/healthshare/user/EnsPortal.DTLEditor.zen?DT=Foo.NewDTL1.dtl

If I open the same DTL in studio then I get just the editor, the banner is not displayed.

The DTLEditor page has the property studioMode that controls the banner display, but its not obvious how this is set.

0 1
2 174

Hi all.

I have a scenario where I am receiving NACKs and I'd like to adjust the error handing of the operation based on the content of the NACK.

For example, I could receive the following and want to move onto the next message:

MSH| ^~\&|||||20221025083135.489+0100||ACK ^A02^ACK|9271|D|2.5.1
MSA|AE|1664378390234
ERR|||207 ^Application internal error ^HL70357^^^^^^Cannot transfer patient, encounter is cancelled.|E

However, I could also receive the following and want to keep retrying:

0 1
0 214
Question
· Nov 30, 2022
Delegated Users

In our current UCR arhcitecture, we use two installations. We have one machine with Access, Registry and Edges and one machine with the ODS. On the machine with the Registry, I can create a user/clinician. When I log into the management portal with this user, a so-called delegated user is created in the cached users table. So far everything is going well.

When I try the same on the machine with the ODS I get the message : 'ERROR #822: Access Denied' . so no delegated user is created.... Does anyone have any idea where I can find the solution?

1 1
0 273

Is there a command that will loop through the flat files of a given Linux/Unix folder? I can write the code to open and read each file. But the file names are unknown. I am looking for a way to access each file given a named Linux folder. The files have differing structures so a record map will not work.

Thank you for reading and thank you even more for answering!

0 1
0 270

Methods written in ObjectScript can use pass-by-reference arguments to return information to the caller. Python doesn’t support pass-by-reference arguments, so Embedded Python in IRIS doesn’t support them either. That's it, that's the end of the post, hope you liked it. 😉 But wait, what about the Classic Rock & Roll?

7 1
1 250