source: cprs/branches/tmg-cprs/m_files/TMGRPC3G.m@ 1536

Last change on this file since 1536 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 3.4 KB
Line 
1TMGRPC3G ;TMG/kst/Support Functions for GUI_Config ;08/31/08
2 ;;1.0;TMG-LIB;**1**;08/31/08
3 ;
4 ;"TMG RPC FUNCTIONS for a GUI config program
5 ;
6 ;"Kevin Toppenberg MD
7 ;"GNU Lessor General Public License (LGPL) applies
8 ;"7/20/08
9 ;
10 ;"=======================================================================
11 ;" RPC -- Public Functions.
12 ;"=======================================================================
13 ;" <none>
14 ;"=======================================================================
15 ;"PRIVATE API FUNCTIONS
16 ;"=======================================================================
17 ;"GETERSTR(TMGEARRAY) -- convert a standard DIERR array into a string for output
18 ;"ADDFDA(TMGFDA,TMGOUT,INDX) -- output the TMGFDA into the TMGOUT variable
19 ;
20 ;"=======================================================================
21 ;"=======================================================================
22 ;"Dependencies:
23 ;" None, but should be called FROM TMGRPC3* only
24 ;
25 ;"=======================================================================
26 ;"=======================================================================
27 ;
28GETERSTR(TMGEARRAY) ;
29 ;"Purpose: convert a standard DIERR array into a string for output
30 ;"Input: TMGEARRAY -- PASS BY REFERENCE. example:
31 ;" array("DIERR")="1^1"
32 ;" array("DIERR",1)=311
33 ;" array("DIERR",1,"PARAM",0)=3
34 ;" array("DIERR",1,"PARAM","FIELD")=.02
35 ;" array("DIERR",1,"PARAM","FILE")=2
36 ;" array("DIERR",1,"PARAM","IENS")="+1,"
37 ;" array("DIERR",1,"TEXT",1)="The new record '+1,' lacks some required identifiers."
38 ;" array("DIERR","E",311,1)=""
39 ;"Results: returns one long equivalent string from above array.
40 ;"Note: This is a copy of the function GetErrStr^TMGDEBUG
41 ;" I copied it here so that this file has no TMG* dependencies.
42 ;
43 NEW TMGESTR,TMGIDX,TMGENUM
44 SET TMGESTR=""
45 FOR TMGENUM=1:1:+$GET(TMGEARRAY("DIERR")) DO
46 . SET TMGESTR=TMGESTR_"Fileman says: '"
47 . IF TMGENUM'=1 SET TMGESTR=TMGESTR_"(Error# "_TMGENUM_") "
48 . SET TMGIDX=$ORDER(TMGEARRAY("DIERR",TMGENUM,"TEXT",""))
49 . IF TMGIDX'="" FOR DO QUIT:(TMGIDX="")
50 . . SET TMGESTR=TMGESTR_$GET(TMGEARRAY("DIERR",TMGENUM,"TEXT",TMGIDX))_" "
51 . . SET TMGIDX=$ORDER(TMGEARRAY("DIERR",TMGENUM,"TEXT",TMGIDX))
52 . IF $GET(TMGEARRAY("DIERR",TMGENUM,"PARAM",0))>0 DO
53 . . SET TMGIDX=$ORDER(TMGEARRAY("DIERR",TMGENUM,"PARAM",0))
54 . . SET TMGESTR=TMGESTR_"Details: "
55 . . FOR DO QUIT:(TMGIDX="")
56 . . . IF TMGIDX="" QUIT
57 . . . SET TMGESTR=TMGESTR_"["_TMGIDX_"]="_$GET(TMGEARRAY("DIERR",1,"PARAM",TMGIDX))_" "
58 . . . SET TMGIDX=$ORDER(TMGEARRAY("DIERR",TMGENUM,"PARAM",TMGIDX))
59 ;
60 QUIT TMGESTR
61 ;
62ADDFDA(TMGFDA,TMGOUT,INDX) ;
63 ;"Purpose: To output the TMGFDA into the TMGOUT variable (so show erroneous
64 ;" FDA.
65 ;"Input: TMGFDA -- the FDA as send to fileman. PASS BY REFERENCE
66 ;" TMGOUT -- the variable that will be passed back as the result of
67 ;" the RPC call. PASS BY REFERENCE.
68 ;" INDX -- the index to start adding the TMGFDA at.
69 ;"Results: none.
70 ;"
71 NEW TMGI SET TMGI=""
72 FOR SET TMGI=$ORDER(TMGFDA(TMGI)) QUIT:TMGI="" DO
73 . SET TMGOUT(INDX)="FDA("_TMGI_")="_$GET(TMGFDA(TMGI))
74 . SET INDX=INDX+1
75 QUIT
76 ;
Note: See TracBrowser for help on using the repository browser.