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

INHMSR11.m

Go to the documentation of this file.
  1. INHMSR11 ;KN; 28 Nov 95 11:55; Statistical Report - Definition Screen
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME: Statistical Report - Definition Screen Utility
  1. ; array (INHMSR11).
  1. ;
  1. ; DESCRIPTION:
  1. ; The processing of this routine is used to contain for Utility
  1. ; INA array and support for the module INHMSR1, INHMSR10.
  1. ;
  1. Q
  1. ;
  1. GATHER(INA,INCNT) ;Build INA Array.
  1. ;
  1. ; Description: The function GATHER is used to construct
  1. ; INA array of user selected criteria.
  1. ; The structure of the INA(Sub1,Sub2) array is as follow:
  1. ; o Sub1 = order in which user select.
  1. ; . INA(0)=0 user select field .01, no range
  1. ; . INA(0)=1 user select field .01, and also set range
  1. ; . INA(0)=2 user not select field .01
  1. ; . Sub1=I (I = 1-7) user selected order
  1. ; o Sub2 = for user selected items such as:
  1. ; 1 = field ien, 2 = field name, 3,4 = range from and to.
  1. ; 5 = line where the item is located, 6 = field type(date,number).
  1. ; 7 = total (yes or no), 8 = Mumps code from computed field
  1. ; Return: 0 = Error in processing.
  1. ; n = no error, return number of selection
  1. ; Parameters:
  1. ; INA = Name of statistical report criteria array.
  1. ; INCNT = Number of fields in the current file
  1. ; Code begins:
  1. N TSEL,SEL,ERR,INSUB,INFD,IINA,ING
  1. K INA
  1. ; TSEL is number of selection, to compare if user enter repeat order
  1. S TSEL=0,SEL=0,ERR=0,INA(0)=0
  1. F ING=1:1:INCNT S:$G(DWLTXT(1,ING))'="" TSEL=$G(TSEL)+1
  1. F ING=1:1:INCNT D
  1. .I $G(DWLTXT(1,ING))'="" D
  1. ..; Set value in INA array to mark this order has been made
  1. ..I $D(INA($G(DWLTXT(1,ING)),1))=0 D
  1. ...; Increment the count and store in INA array
  1. ...S SEL=$G(SEL)+1,INA($G(DWLTXT(1,ING)))=""
  1. ...;save field ien, field name, range, and total
  1. ...S INSUB=$G(DWLTXT(1,ING)),INA(INSUB,1)=IN(6,ING),INA(INSUB,2)=IN(2,ING)
  1. ...; Get range FROM and TO
  1. ...S FROM=$G(DWLTXT(3,ING)),TO=$G(DWLTXT(4,ING)),INA(INSUB,5)=ING
  1. ...; Save field type in INA(1,6)
  1. ...S INA(INSUB,6)=$$GPC2^INHMSR10(INIEN,IN(6,ING)),INA(INSUB,7)=$G(DWLTXT(5,ING))
  1. ...; Store computed field i.e. DD piece 5 in ina(insub,8)
  1. ...; Get piece 5 and 6 to overcome ^ in global ^INTHU
  1. ...S:INA(INSUB,6)["C" INA(INSUB,8)=$P($G(^DD(INIEN,IN(6,ING),0)),U,5,6)
  1. ...;make sure FROM < TO before store in INA array, only when both exist
  1. ...I ($G(FROM)'="")&($G(TO)'="")&(INA(INSUB,6)'["D") D
  1. ....; For number and date
  1. ....I (INA(INSUB,6)["N") D
  1. .....I FROM<TO S INA(INSUB,3)=FROM,INA(INSUB,4)=TO
  1. .....E S INA(INSUB,3)=TO,INA(INSUB,4)=FROM
  1. ....E D
  1. .....; In this case of string, using operator ] to compare
  1. .....I TO]FROM S INA(INSUB,3)=FROM,INA(INSUB,4)=TO
  1. .....E S INA(INSUB,3)=TO,INA(INSUB,4)=FROM
  1. ...E S INA(INSUB,3)=FROM,INA(INSUB,4)=TO
  1. Q:'$G(SEL) 0
  1. ; Compare for repeat order
  1. I $G(SEL)=$G(TSEL) S ERR=$$INACHK^INHMSR10(INIEN,.INA)
  1. E D MESS^DWD(5,10) W "Sort order cannot be repeated - Please try again!" S INTMP=$$CR^UTSRD,ERR=1
  1. ; INA(0)=2 means .01 is not selected
  1. S:$G(INA(0))=2 TSEL=$G(TSEL)+1
  1. I ('ERR)&($G(TSEL)<2) D MESS^DWD(5,10) W "ERROR! - you enter at least one field other than the "_INF1_" field" S INTMP=$$CR^UTSRD,ERR=1
  1. I ('ERR)&($G(TSEL)>5) D MESS^DWD(5,10) W "ERROR! - Without the "_INF1_" field. You may only select a maximum at four (4) fields" S INTMP=$$CR^UTSRD,ERR=1
  1. Q $S(ERR=1:0,1:SEL)