I've seen a few password change posts, but I wasn't 100% sure it was the same process, so I am asking here. We periodically have to change the passwords for a few Cache user accounts across several servers. Is there a process/script to change these passwords without having to go into the web portal on each server? Thanks so much, and I apologize if this was covered in some of the other articles that I've run across. Just looking for the best method.

0 3
0 335

I am trying to use %INLIST in SQL query using a cursor and the query fails to return results. It appears that the variable I use against %INLIST returns an empty string. All the examples I have seen use result sets and build the query as a string. Is it possible to use %INLIST in a cursor-based query? Below is a a snippet of the code I am using:

Property mylist as %String (MAXLEN="") [InitialExpression = "route1, route2, route3"];

set routeList = $LISTBUILD(mylist)

&sql(DECLARE MyReport CURSOR FOR

SELECT

ProcessStartDate,

0 3
0 581
Question
· Sep 13, 2018
Operators as Variables

We have the need to write a function that can loop through say a field in an OBX segment within HL7 and compare it to a string passed. Is it possible to have the user enter the Operator ( >,<,=,<>) as a variable inside Cache object script? Does anyone have any examples they can share?

Thanks

Scott Roth

The Ohio State University Wexner Medical Center

0 8
0 477

Hello Everyone,

I was wondering about the best way to initialize several variables, or several lists of variables.

Would it be better to write it like:

set (var1, var2, var3) = "value1"
set (var4, var5) = "value2"
set (var6,var7,var8) = "value3"

or

set var1="value1", var2="value1", var3="value1", var4="value2", var5="value2", var6="value3", var7="value3", var8="value3"

or

0 6
0 437
Question
· Jun 5, 2018
$CASE For Long Stories

Hi, Community!

$CASE is a fine syntax sugar for "Ifs" with one-line/one-word expressions, like in docs:

SET daynum=$ZDATE($HOROLOG,10)
  WRITE $CASE(daynum,
              1:"Monday",2:"Tuesday",3:"Wednesday",
              4:"Thursday",5:"Friday",
              6:"Saturday",0:"Sunday",:"entry error")

But if my expression for a current case is a multi-line business logic? Can I use "{}" somehow or better go with "IF" instead?

0 13
1 507
Question
· May 9, 2018
Standardizing Error Logging

I have been tasked with creating a class that will handle error logging in a consistent manor for an application I am working on. The need is to have all variables in the calling method logged along with some other information.

The example given was zwrite which is exactly what I need, however, I somehow need to capture the output of ZW and put it into a database table. Any easy way to capture this data? I was able to dump ZW to a file, but that is not ideal.

Any help is appreciated!

0 8
0 1.1K
Question
· Apr 5, 2018
Drawing boxes

Hello, Community!

Here's an interesting task I found on the Internet.

Problem description

Write a method that would draw a box of a specified size.

The goal is to write the shortest method.

Here's a method signature (it can't be modified):

ClassMethod main(s As %Integer = 10)

And call sample:

>do ##class(ITPlanet.Task4).main(5)
#####
## ##
# # #
## ##
#####

>do ##class(ITPlanet.Task4).main(10)
##########
##      ##
# #    # #
#  #  #  #
#   ##   #
#   ##   #
#  #  #  #
# #    # #
##      ##
##########
 
>do ##class(ITPlanet.Task4).main(20)
####################
##                ##
# #              # #
#  #            #  #
#   #          #   #
#    #        #    #
#     #      #     #
#      #    #      #
#       #  #       #
#        ##        #
#        ##        #
#       #  #       #
#      #    #      #
#     #      #     #
#    #        #    #
#   #          #   #
#  #            #  #
# #              # #
##                ##
####################

2 15
0 576
Question
· Aug 31, 2017
Extract piece of string

Hello guys,

I was wondering whether there is another alternative to extracting a certain string out from a bigger one, rather than using the function $piece.

Maybe regular expressions? Another specific function?

Example:

Big string:

NAD+SLA+++TextIsHereNAD+SLA+++TextIsHere

String I want to extract:

TextIsHere

Function I'm already using:

0 3
0 658

I'm aware of two ways to get list of files in a dir:

set dir = "C:\temp\"
set rs = ##class(%File).FileSetFunc(dir, , , 1)
do rs.%Display()

and:

set dir = "C:\temp\"
set file=$ZSEARCH(dir_"*")
while file'="" {
   write !,file
   set file=$ZSEARCH("")
}

Yet they bot return only files and directories in a current directory, but not files in subdirectories.

I suppose I call one of these recursively, but maybe there's a better solution?

1 25
1 3.6K

Hi, community!

Consider you need to exclude substring(s) from a string.

I did it with the following snippet:

/// excludes all the substrings from the string
ClassMethod ExcludeSubstring(substr,str as %String) As %String

{

 while ($L(str,substr)>1) {

 set str=$Piece(str,substr)_$Piece(str,substr,2,*)

            }

 quit str

}

So, for example:

0 2
0 410

Environment: Cache for Windows (x86-64) 2015.2.2 (Build 811U) Thu Mar 3 2016 12:55:48 EST [HealthShare Modules:Core:14.01.351

When try the following to send back SOAP Fault, is the following correct way?

Set fault=##class(%SOAP.Fault).%New()
Set fault.faultcode=$$$FAULTServer
Set fault.faultstring="Processing Error"
Set fault.detail= "Error on server"
Do ..ReturnFault(fault)

0 1
0 669

Hi,

I am new to Cache and I am trying to convert a JSON string (msgdata) that contains a JSON payload to an object to be saved into a Driver. Entity table. I am running into 2 issues and would appreciate any help:

1) It seems that when the 1st element of a list within the payload (Choices) is an empty string, after I call %ConvertJSONToObject, the obj.%data("payload").Choices contains just 1 empty element, removing the next 3 valid values (10,20,30). The same does not happen if I change the input to [10,20,"",30], in this case it works correctly.

0 3
0 969

A customer is using Caché online backups and needs to automatically purge the cbk files with a scheduled task.

This is a wheel has been reinvented uncountable times already and I know somebody out there has a well written, extremely robust version that has already stood the test of time.

Does anyone have a nice routine/class/task for purging old Caché backup files?

0 10
1 1.5K