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

MAGNU001.m

Go to the documentation of this file.
  1. MAGNU001 ;WOIFO/NST - Utilities for RPC calls ; 25 Apr 2017 4:16 PM
  1. ;;3.0;IMAGING;**185**;Mar 19, 2002;Build 92;Aug 02, 2012
  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. ;; | 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. FM2IDF(FMDT) ; converts date time in FileMan format CYYMMDD.HHMMSS to YYYYMMDD.HHMMSS
  1. I FMDT="" Q ""
  1. N MAGTIME
  1. S MAGTIME=$P(FMDT,".",2)
  1. Q (FMDT\1+17000000)_"."_MAGTIME
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE = FileMan file number (e.g. 2006.917)
  1. GETFILNM(FILE) ; Returns file name
  1. Q $$GET1^DID(FILE,"","","NAME")
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE - FileMan file
  1. GETFILGL(FILE) ; Get Global root of the file
  1. Q $$ROOT^DILFD(FILE)
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE - FileMan file
  1. ; FNAME - Field name
  1. GETFLDID(FILE,FNAME) ; Returns a field number
  1. Q $$FLDNUM^DILFD(FILE,FNAME)
  1. ;
  1. GETFLDS(MAGRY,MAGRYW,FILE,FLAGS) ; Returns array with all fields in a file
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ; FILE = FileMan file number
  1. ; FLAGS = I - add I(internal) to the field numbers in Result e.g .01I;2I;3I
  1. ;
  1. ; Return Values
  1. ; =============
  1. ;
  1. ; Result=n1;n2;n3 (e.g. .01;2;3) - no multiple or word-processing fields
  1. ;
  1. ; MAGRY(n)=nth field name
  1. ; MAGRY(n,"TYPE")=type of the field (e.g. RP2006.916, 2006.9183, RD, RN, etc.)
  1. ;
  1. ; MAGRYW(n)=nth Word-Processing field name
  1. ; MAGRY(n,"TYPE")=type of the field (e.g. RP2006.916, 2006.9183, RD, RN, etc.)
  1. ;
  1. N I,FLDID,FLDS,DEL
  1. N WPTYPE,IVAL
  1. K MAGRY,MAGRYW
  1. S IVAL=$S($G(FLAGS)["I":"I",1:"")
  1. S I=""
  1. S FLDS=""
  1. F S I=$O(^DD(FILE,"B",I)) Q:I="" D ; IA #5551
  1. . S FLDID=$O(^DD(FILE,"B",I,""))
  1. . I $$ISFLDSUB^MAGNU001(.WPTYPE,FILE,FLDID) D
  1. . . S MAGRYW(FLDID)=I
  1. . . S MAGRYW(FLDID,"TYPE")=WPTYPE
  1. . . Q
  1. . E D
  1. . . S MAGRY(FLDID)=I
  1. . . S MAGRY(FLDID,"TYPE")=$$GET1^DID(FILE,FLDID,"","SPECIFIER")
  1. . . Q
  1. . Q
  1. S I="",DEL=""
  1. F S I=$O(MAGRY(I)) Q:I="" D
  1. . ; Skip multiple and word-processing fields GETS^DIQ cannot handle Word-Processing field
  1. . I $$ISFLDSUB^MAGNU001(.WPTYPE,FILE,I) Q
  1. . S FLDS=FLDS_DEL_I_IVAL
  1. . S DEL=";"
  1. . Q
  1. Q FLDS
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE - FileMan file
  1. ; FLDID - Field Number
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; TYPEDEF = Type of field
  1. ISFLDSUB(TYPEDEF,FILE,FLDID) ; Returns true(1) or false(0) if a field is from Word-Processing type or Multiple
  1. N FILESUB
  1. S TYPEDEF=""
  1. Q:'$$GET1^DID(FILE,FLDID,"","MULTIPLE-VALUED") 0
  1. S FILESUB=$$GET1^DID(FILE,FLDID,"","SPECIFIER")
  1. S TYPEDEF=$$GET1^DID(+FILESUB,.01,"","SPECIFIER")
  1. Q 1
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE - FileMan file
  1. ; FLDID - Field Number
  1. ISFLDDT(FILE,FLDID) ; Returns true(1) or false(0) if a field is from DATE/TIME type
  1. Q $$GET1^DID(FILE,FLDID,"","TYPE")="DATE/TIME"
  1. ;
  1. ; Return WP field value as a string
  1. ; WP = Word-Processing field values
  1. ; e.g. WP(1)=Line 1
  1. ; WP(2)=Line 2
  1. ;
  1. ;
  1. ; Input parameters
  1. ; ================
  1. ; FILE - FileMan file
  1. ; FLDID - Field Number
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; TYPEDEF = Type of Word-Processing field
  1. ISFLDWP(TYPEDEF,FILE,FLDID) ; Returns true(1) or false(0) if a field is from Word-Processing type
  1. N WPFILE
  1. S TYPEDEF=""
  1. Q:$$GET1^DID(FILE,FLDID,"","TYPE")'="WORD-PROCESSING" 0
  1. S WPFILE=$$GET1^DID(FILE,FLDID,"","SPECIFIER")
  1. S TYPEDEF=$$GET1^DID(WPFILE,.01,"","SPECIFIER")
  1. Q 1
  1. ;
  1. GSUBFILE(FILE,FIELD) ; Returns sub-file of a multiple field
  1. Q +$$GET1^DID(FILE,FIELD,"","SPECIFIER")
  1. ;
  1. GSUBROOT(FILE,FIELD,D0) ; Return open root of multiple field
  1. N ROOT,NODE
  1. S NODE=$$GET1^DID(FILE,FIELD,"","GLOBAL SUBSCRIPT LOCATION")
  1. S NODE=$P(NODE,";")
  1. S ROOT=$$GETFILGL(FILE)
  1. Q ROOT_D0_","_NODE_","