Download presentation
Presentation is loading. Please wait.
Published byMelina May Modified over 9 years ago
1
ObjectScript Highlights Ian Cargill Development Manager Dendrite Clinical Systems
2
Using Unique Indexes Normally work with classes using the ID or IdKey field: ##class(My.Class).%ExistsId(idval) ##class(My.Class).%OpenId(idval) ##class(My.Class).%DeleteId(idval) Not well known, you can actually test / open / delete objects based on a unique index.
3
Using Unique Indexes E.g. if a class contains: Index IxNHSNumber On NHSNumber [unique] You can use: ##class(My.Class). IxNHSNumberExists(NhsNum,.id) ##class(My.Class). IxNHSNumberOpen(NhsNum,.sc) ##class(My.Class). IxNHSNumberDelete(NhsNum) ##class(My.Class). IxNHSNumber Check( NhsNum ) ?? %Library.CacheIndex documents these!
4
$CLASSMETHOD $METHOD $PROPERTY $CLASSNAME Runtime Class Access
5
Syntax Set oDat=$CLASSMETHOD(Class, "%New") Set oDat=$CLASSMETHOD(Class, "%OpenId", ObjId) Set CurrentVal=$PROPERTY(oDat, FldName) Set $PROPERTY(oDat, FldName)=NewValue
6
Useful Intrinsic Functions $INCREMENT- DIY locks +1, -1 –Set x=$I(x)Set x=$I(x,-1) $CASE –Set x=$Case(val,1:"red",2:"blue",:"green") $ZSTRIP –Set str=$ZStrip(str, "<>W") –Set str=$ZStrip(str, "*P", "; ", "Z")
7
Useful Intrinsic Functions $ZCONVERT –$ZCVT(str, "U")- to uppercase –$ZCVT(str, "L")- to lowercase –$ZCVT(str, "O","HTML ") –$ZCVT(str, "O", "JS") –$ZCVT(str, "O","URL")
8
Useful Intrinsic Functions: Listblocks $LISTFROMSTRING $LISTTOSTRING $LISTSAME $LISTVALID $LISTDATA $LISTNEXT
9
Bulk loading data $SORTBEGIN $SORTEND Use these to inhibit indexing while bulk loading data. Do all indexing in one hit.
10
Error Handling “Old” style - $ZTrap –I still prefer this Try / Catch / Return –Would prefer, but not until Return available Return - coming, but not yet !!
11
Error Handling try { set res="ok" } catch { set res="fail" } Quit Res// oh dear!!!!!
12
Class Storage You can control class storage View | Storage in Studio Default like –^Test.PersonD^Test.PersonI I prefer –^MYDB("Test","Person","D") –^MYDB("Test","Person","I")
13
%SYSTEM.Encryption This class provides class functions to perform data encryption, Base64 encoding, hashing, and generation of message authentication codes. Some complex encryption support for experts, but a number of useful applications for the more humble programmer:
14
%SYSTEM.Encryption Encrypting passwords for storage –e.g. MD5Hash, SHA1Hash Encoding binary data for 'plain text' transmission. E.g. SOAP messages. –Base64Encode –Base64Decode
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.