Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGGSFL1

MAGGSFL1.m

Go to the documentation of this file.
  1. MAGGSFL1 ;WOIFO/GEK/SG - Image list Filters utilities ; 3/9/09 12:51pm
  1. ;;3.0;IMAGING;**8,93**;Dec 02, 2009;Build 163
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. ;***** UPDATES/CREATES THE IMAGE FILTER DEFINITION
  1. ; RPC: MAG4 FILTER SAVE
  1. ;
  1. ; .MAGRY Reference to a local variable where the result
  1. ; is returned to.
  1. ;
  1. ; .MAGGZ Reference to a local array that stores the filter
  1. ; data and related parameters.
  1. ;
  1. ; MAGZ(i) Data item
  1. ; ^01: Field number
  1. ; ^02: Field value
  1. ;
  1. ; The following special names can be used in place of
  1. ; field numbers:
  1. ;
  1. ; FLAGS - Value contains flags that control the
  1. ; execution (can be combined):
  1. ;
  1. ; S Selective save. If this flag is
  1. ; provided, then only the fields listed
  1. ; in the MAGZ array are updated; other
  1. ; filter properties are not changed.
  1. ;
  1. ; By default, all filter properties,
  1. ; which do not have new values in the
  1. ; MAGZ array, are cleared.
  1. ;
  1. ; IEN - Value is the Internal Entry Number of the
  1. ; filter that has to be modified.
  1. ;
  1. ; USER - Value is the IEN of the user who this
  1. ; filter is saved for.
  1. ;
  1. ; Return Values
  1. ; =============
  1. ;
  1. ; In case of an error, the first ^-piece of the MAGRY contains 0, and
  1. ; the second one - the error message.
  1. ;
  1. ; Otherwise, IEN of the filter is returned in 1st ^-piece, and the
  1. ; filter name (value of the .01 field) - in the second one.
  1. ;
  1. SET(MAGRY,MAGGZ) ;RPC [MAG4 FILTER SAVE]
  1. N $ETRAP,$ESTACK,FLAGS,FLTIEN,FLTUSER,MAGGDA,MAGGDAT,MAGGFDA,MAGGFLD,MAGOK,MAGGXE,RES,Z
  1. K MAGRY S (FLTIEN,FLTUSER)=0,MAGOK=1,FLAGS=""
  1. S MAGRY="0^Starting: Saving Filter..."
  1. S $ETRAP="D ERR^"_$T(+0)
  1. I $D(MAGGZ)<10 S MAGRY="0^No input data, Operation CANCELED" Q
  1. ;
  1. ;--- Parse the parameters
  1. S Z=""
  1. F S Z=$O(MAGGZ(Z)) Q:Z="" D Q:'MAGOK
  1. . S MAGGFLD=$P(MAGGZ(Z),U),MAGGDAT=$P(MAGGZ(Z),U,2,99)
  1. . I MAGGFLD=""!(MAGGDAT="") D Q
  1. . . S MAGOK="0^Field and Value are Required"
  1. . . Q
  1. . I MAGGFLD="FLAGS" S FLAGS=MAGGDAT Q
  1. . I MAGGFLD="IEN" S FLTIEN=+MAGGDAT D Q
  1. . . I FLTIEN>0,$D(^MAG(2005.87,FLTIEN)) Q
  1. . . S MAGOK="0^Invalid Filter IEN: "_FLTIEN
  1. . . Q
  1. . I MAGGFLD="USER" S FLTUSER=+MAGGDAT,MAGGFLD=20
  1. . I '$$VALID^MAGGSIV1(2005.87,MAGGFLD,.MAGGDAT,.RES) D Q
  1. . . S MAGOK="0^"_RES
  1. . . Q
  1. . S MAGGFDA(2005.87,"+1,",MAGGFLD)=MAGGDAT
  1. . Q
  1. I 'MAGOK S MAGRY=MAGOK Q
  1. ;
  1. ;--- Lock the file header
  1. L +^MAG(2005.87,0):10 E D Q
  1. . S MAGRY="0^The File Image List Filters is locked."
  1. . S MAGRY=MAGRY_" Operation canceled"
  1. . Q
  1. ;
  1. I FLTIEN>0 D
  1. . N IENS
  1. . S IENS=FLTIEN_","
  1. . ;--- Clear the old values if not requested otherwise.
  1. . I FLAGS'["S" F Z=1:1:16,20,21 S MAGGFDA(2005.87,IENS,Z)="@"
  1. . M MAGGFDA(2005.87,IENS)=MAGGFDA(2005.87,"+1,")
  1. . K MAGGFDA(2005.87,"+1,")
  1. . ;--- Update the filter
  1. . D FILE^DIE("","MAGGFDA","MAGGXE")
  1. . I $D(DIERR) D RTRNERR(.MAGRY) Q
  1. . S MAGRY=FLTIEN_U_$P(^MAG(2005.87,FLTIEN,0),U)
  1. . Q
  1. E D
  1. . N MAGGIEN
  1. . S MAGGFDA(2005.87,"+1,",22)=DUZ
  1. . ;--- Store the new filter
  1. . D UPDATE^DIE("S","MAGGFDA","MAGGIEN","MAGGXE")
  1. . I $D(DIERR) D RTRNERR(.MAGRY) Q
  1. . S MAGRY=MAGGIEN(1)_U_MAGGFDA(2005.87,"+1,",.01)
  1. . Q
  1. ;
  1. ;--- Cleanup
  1. L -^MAG(2005.87,0)
  1. D CLEAN^DILF
  1. Q
  1. ;
  1. ;+++++ RETURNS THE TEXT OF THE FILEMAN ERROR MESSAGE
  1. RTRNERR(ETXT) ;
  1. N MAGRESA
  1. D MSG^DIALOG("A",.MAGRESA,245,5,"MAGGXE")
  1. S ETXT="0^"_MAGRESA(1)
  1. D CLEAN^DILF
  1. Q
  1. ;
  1. ;+++++ ERROR HANDLER
  1. ERR ;
  1. N ERR
  1. L -^MAG(2005.87,0)
  1. S ERR=$$EC^%ZOSV
  1. S (MAGRY,MAGOK)="0^Error Filter Add/Edit: "_ERR
  1. D LOGERR^MAGGTERR(ERR)
  1. D @^%ZOSF("ERRTN")
  1. D CLEAN^DILF
  1. Q