﻿ Replies by Benjamin Irwin for InterSystems Developer Community

Rochdi,

Can you please expand on your needs.  Does what you are showing above work for you or are you getting errors?

The key is in your picture "Value DoesNotMatch" "3N.1""-""2N.1""-""4N"

This is MUMPS/Cache/IRIS pattern matching.  This pattern is looking for 3 numbers, a hyphen, 2 numbers, a hyphen, and 4 numbers.  In your custom rule you would be checking for 13 numbers at a minimum.  You could check for a gender match on that digit.  Also verify the citizenship digit.

"Value DoesNotMatch" "13N"

Wesley,

I am a retired Cache/MUMPS developer and have far too much time on my hands.  However, I think I have found a smooth and reliable way to accomplish what you need.  This was fun.  Thanks for the challenge.

CSZ
New X,CSZ
Set CSZ(\$Increment(CSZ(0)))="CANTON,TX.,75103"
Set CSZ(\$Increment(CSZ(0)))="MILFORD, OH 45150"
Set CSZ(\$Increment(CSZ(0)))="MILFORD OH 45150"
Set CSZ(\$Increment(CSZ(0)))="KANSAS CITY, MO, 12345"
Set CSZ(\$Increment(CSZ(0)))="KANSAS CITY MO, 12345"
Set CSZ(\$Increment(CSZ(0)))="ST. LOUIS MO, 12345"
Set CSZ(\$Increment(CSZ(0)))=" ST. LOUIS MO, 12345"
For X=1:1:CSZ(0) Write \$\$CSZ2(CSZ(X)),!
Quit
CSZ2(CSZ)
New CSZF,SC,CITY,STATE,ZIP
Set CSZF=CSZ
Set CSZF=\$Zconvert(CSZF,"U")
Set CSZF=\$Translate(CSZF,",."," ") // Translate to spaces
Set CSZF=\$Zstrip(CSZF,"<=>"," ") // Remove Leading, Trailing, and multiple spaces.
Set SC=\$Length(CSZF," ") // Count the number of spaces
Set CITY=\$Piece(CSZF," ",1,(SC-2)) // Select the multiple of city pieces
Set STATE=\$Piece(CSZF," ",(SC-1)) // Select one less the the max piece.
Set ZIP=\$Piece(CSZF," ",SC) // Select the max piece.
Quit CITY_"|"_STATE_"|"_ZIP

VISTA>D CSZ^CSZ
CANTON|TX|75103
MILFORD|OH|45150
MILFORD|OH|45150
KANSAS CITY|MO|12345
KANSAS CITY|MO|12345
ST LOUIS|MO|12345
ST LOUIS|MO|12345

Wesley,

Your example is a great usage of the \$Piece statement.

Set REC="CANTON,TX.,75103"

Set CTY=\$Piece(REC,",",1)

Set STA=\$Piece(REC,",",2)

Set ZIP=\$Piece(REC,",",3)

Sorry, I didn't see all the responses before answering.

Beyond Compare works outside of Studio and can compare files, folders, and it even does an Ok compare of Word files.  I have used it to track project changes as a manager to keep track of the changes the developers were making.  It worked great and we were able to catch some issues early in the project so that they could be fixed quickly.

This is really helpful Vitaliy Serdtsev.  Thanks for this information.  I set this up with Beyond Compare and it works great.  Do you know of anyway to get it to work across namespaces?  It would be nice to be able to compare a routine from one namespace to another.

 Compare Compares an open file to one that you select with Browse. You must have specified an external compare tool with the Compare setting in Options > Environment > General. To work correctly, the compare tool must be able to accept command line parameters as tool.exe file1 file2. Tested compare tools are Microsoft Windiff and Perforce p4Diff.exe.

One of the best tools that I have found for comparing routines is called "Beyond Compare".  You can create a small CSP that will serve up the a routine depending on the routine name in the query string of the URL.  Then you can put that URL directly in the file open dialog of "Beyond Compare" that it will bring up the routines and display a nice side-by-side compare.  It can also save the comparison in an HTML file for sharing with others.

I may not understand the question, but the best way to avoid the above error would be to correctly specify the namespace in the batch file.  For example the "VISTA" namespace in the following command line needs to be an existing namespace.

C:\InterSystems\Cache\bin\Csession.exe cache -U VISTA "^WBSS"

Allan,

There are Cache versions on the VA anonymous drive.  They usually keep the latest and a few previous versions available.

I actually have a cache-2017.1.1.111.0-win_x64, but I am not sure if Intersystems would want me to share it.

Thanks, Ben

Stephen,

This may be far more than you were looking for, but I will share what I did to determine what globals were being accessed in the VA VistA software.

The first step was to convert the routines to the CSV version using the %SyntaxColor class in Cache.  This link shows an example: https://www.bmirwin.com/vnode/RoutineDg/MainDisplay.php?routine=IB20E540.  The top frame is the routine and the bottom frame is the CSV version of the routine.  If you look at line 9 of both frames you can find the global ^IBA referenced.  In the CSV version it is identified by the COS 12 indicator.  Therefore, to find all the global references in a list of routines just looking for the COS 12 indicators will find them.

This link https://www.bmirwin.com/vnode/dg/index.php?ns=IB20E shows a listing of a group of routines.  The "ns" variable can be changes to look at any routine or set of routines within the system.

Ben Irwin

ben1irwin@outlook.com

Thanks to Robert Cemper for the answer.  However, I misunderstood that Robert was saying, but it fixed the issue.

My web service original was the following:

Method RtnReceive(RtnName As %String, RtnLines As %ListOfDataTypes) As %String [ WebMethod ]

At misunderstanding Robert's suggestion I changed the code to the following:

Method RtnReceive(RtnName As %String, RtnLines As %ListOfDataTypes(ELEMENTTYPE="%String", XMLITENAME=RtnLinesItem", XMLNAME="RtnLines")) As %String [ WebMethod ]

I had used the \$Extract to limit the line length to 50 to avoid the error, and now with the change I have removed the length limit and all is working.

To see an example of how this is going to be used see the following website:  www.bmirwin.com

The pages currently in this link are created on a local machine and SFTP'ed to the server using the Cache SFTP functionality.  Now with the web service functionality, these files can be pushed through the web service without first creating files.  This might work faster; that is the goal.

I think that Robert Cemper has provided the answer, but I am not sure how to apply it to coding.

The goal of this exercise is to send a routine from the ^ROUTINE global on one computer to the ^RTN global on another computer through a web service.

The following code is the web service code.

``````/// Routines.Upload
Class Routines.Upload Extends %SOAP.WebService [ ProcedureBlock ]
{

/// Name of the WebService.

/// SOAP Namespace for the WebService
Parameter NAMESPACE = "http://www.bmirwin.com";

/// Namespaces of referenced classes will be used in the WSDL.
Parameter USECLASSNAMESPACES = 1;

Method RtnReceive(RtnName As %String, RtnLines As %ListOfDataTypes) As %String [ WebMethod ]
{
Quit:RtnName="" "Failed"
Kill ^RTN(RtnName)
Set ^RTN(RtnName,0)=RtnLines.Count()
For X=1:1:RtnLines.Count()
{ Set ^RTN(RtnName, X)=RtnLines.GetAt(X) }
Quit "Done"
}

}

The following is the client that is just produced by importing the WSDL.

Class Routines.UploadSoap Extends %SOAP.WebClient [ ProcedureBlock ]
{

/// This is the URL used to access the web service.

/// This is the namespace used by the Service
Parameter NAMESPACE = "http://www.bmirwin.com";

/// Use xsi:type attribute for literal types.
Parameter OUTPUTTYPEATTRIBUTE = 1;

/// Determines handling of Security header.
Parameter SECURITYIN = "ALLOW";

/// This is the name of the Service

/// This is the SOAP version supported by the service.
Parameter SOAPVERSION = 1.1;

Method RtnReceive(RtnName As %String, RtnLines As %ListOfDataTypes(ELEMENTTYPE="%String",XMLITEMNAME="RtnLinesItem",XMLNAME="RtnLines")) As %String [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
}

}``````

Then the following is the code that I am using to call the web service.

``````RoutineOne(RtnName)
New UCI,x,y,z,RtnLines
Set UCI="VISTA"
Quit:RtnName="" 0
Quit:\$Data(^[UCI]ROUTINE(RtnName))=0 0
Set RtnLines=##class(%ListOfDataTypes).%New()
For x=1:1:^[UCI]ROUTINE(RtnName,0,0)
{
Do RtnLines.Insert(\$Extract(^[UCI]ROUTINE(RtnName,0,x),1,50))
}