source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORUTL19.m@ 1354

Last change on this file since 1354 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.5 KB
Line 
1RORUTL19 ;HCIOFO/SG - PATIENT DATA UTILITIES ; 1/29/07 9:53am
2 ;;1.5;CLINICAL CASE REGISTRIES;**2**;Feb 17, 2006;Build 6
3 ;
4 Q
5 ;
6 ;***** UPDATES THE LOCAL FIELDS
7 ;
8 ; IENS798 IENS of the registry record in the file #798
9 ;
10 ; .LFV Reference to a local variable that stores the
11 ; list of the local field values
12 ;
13 ; Return Values:
14 ; <0 Error code
15 ; 0 Ok. No changes in local fields.
16 ; >1 Ok. Local fields were modified.
17 ;
18UPDLFV(IENS798,LFV) ;
19 N DA,DIK,FLDIEN,IENS,IR,LFCNT,LFIEN,MOD,RC,RORFDA,RORLST,RORMSG,SCR
20 S (MOD,RC)=0
21 ;
22 S (LFCNT,LFIEN)=0
23 F S LFIEN=$O(LFV(LFIEN)) Q:LFIEN'>0 D
24 . S LFCNT=LFCNT+1,IENS="?+"_LFCNT_","_IENS798
25 . S RORFDA(798.02,IENS,.01)=LFIEN
26 . S RORFDA(798.02,IENS,.02)=$P(LFV(LFIEN),U,5)
27 . S RORFDA(798.02,IENS,1)=$P(LFV(LFIEN),U,6)
28 ;--- Delete values of active fields that are not present in the
29 ; LFV array (deleted by the user). Values of inactive fields
30 ;--- are always left intact.
31 S SCR="I $$LFACTIVE^RORDD01(+$G(^(0)))"
32 S IENS=","_IENS798
33 D LIST^DIC(798.02,IENS,"@;.01I",,,,,"B",SCR,,"RORLST","RORMSG")
34 Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,798.02,IENS)
35 S DIK=$$ROOT^DILFD(798.02,IENS),DA(1)=+IENS798
36 S IR=""
37 F S IR=$O(RORLST("DILIST","ID",IR)) Q:IR="" D
38 . S FLDIEN=+RORLST("DILIST","ID",IR,.01)
39 . I '$D(LFV(FLDIEN)) S DA=+RORLST("DILIST",2,IR) D ^DIK S MOD=1
40 ;--- Store the data
41 I $D(RORFDA)>1 S MOD=1 D Q:RC<0 RC
42 . D UPDATE^DIE(,"RORFDA",,"RORMSG")
43 . S:$G(DIERR) RC=$$DBS^RORERR("RORMSG",-9,,,798.02,IENS798)
44 ;--- Success
45 Q MOD
Note: See TracBrowser for help on using the repository browser.