source: cprs/branches/tmg-cprs/m_files/TMGRPCSR.m@ 834

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

Initial upload

File size: 6.3 KB
RevLine 
[796]1TMGRPCSR ;TMG/kst/RPC entry points for Search API ; 6/4/10
2 ;;1.0;TMG-LIB;**1**;05/25/10
3 ;
4 ;"RPC ENTRY POINTS FOR TMG FILEMAN SEARCH API
5 ;
6 ;"Copyright Kevin Toppenberg MD 5/25/10
7 ;"Released under GNU General Public License (GPL)
8 ;"
9 ;"NOTE: this function depends on new version of LIST^DIC, from G. Timpson Patch
10 ;"=======================================================================
11 ;" RPC -- Public Functions.
12 ;"=======================================================================
13 ;"CHANNEL(TMGRESULT,INPUT) -- general purpose channel RPC from a GUI config program
14 ;"LAUNCH(OUT,FILENUM,SRCHSTR) -- launch background search thread, return JOB #
15 ;"STATUS(OUT,JOBNUM) --Return status of background job.
16 ;"RESULTS(OUT,JOBNUM) -- Return results from background search job.
17 ;"
18 ;"=======================================================================
19 ;"PRIVATE API FUNCTIONS
20 ;"=======================================================================
21 ;"
22 ;"=======================================================================
23 ;"=======================================================================
24 ;"Dependencies:
25 ;" ^XLFSTR, ^TMGRPCS0, TMGSRCH1, TMGRPC1B
26 ;"=======================================================================
27 ;"=======================================================================
28 ;
29CHANNEL(TMGRESULT,INPUT) ;
30 ;"Purpose: This will be a general purpose channel RPC from a GUI config program
31 ;"Input: TMGRESULT -- this is an OUT parameter, and it is always passed by reference
32 ;" INPUT -- this will be array of data sent from the GUI client. Defined below:
33 ;" <Stuff will go here>
34 ;" INPUT("REQUEST")="cmd^params" Valid values for "cmd" are:
35 ;" "LAUNCH" -- Start background task for search
36 ;" params: FileNumber^SearchString <-- See docs for Search String in TMGSRCH.m
37 ;" "STATUS" -- Get status of background task
38 ;" params: JobNumber
39 ;" "IEN LIST" ; was RESULTS
40 ;" params: JobNumber^Fields
41 ;" NOTE: If Fields left blank, then NO FIELDS is assumed
42 ;" "IEN DETAILS" -- Get details of 1 IEN entry
43 ;" params: JobNumber^IEN
44 ;" "PREP SUBSET"
45 ;" params: JobNumber^[Field[;FLD[;FLD...]]]
46 ;" Field -- The desired field number(s).
47 ;" OPTIONAL. DEFAULT is .01
48 ;" If more than one supplied, then output is
49 ;" concatinated. Separate fieldnumbers with ';'
50 ;" "CLEAR" -- clear results from last search.
51 ;" params: JobNumber
52 ;" "ALLOWED FILES ENTRY SUBSET" -- get sublist of list .01 fields for allowed files (those pointing into FileNum)
53 ;" params: FileNum^ListStartValue^direction^MaxCount(optional, def=44)^Simple
54 ;" "FIELD LIST SUBSET" -- get sublist of fields names in file
55 ;" params: FileNum^ListStartValue^direction^MaxCount(optional, def=44)^Simple
56 ;" "RESULTS LIST SUBSET" -- get sublist of search results
57 ;" params: JobNum^ListStartValue^direction^MaxCount(optional, def=44)
58 ;"Output: results of this function should be put into TMGRESULTS array.
59 ;" For cmd:
60 ;" "LAUNCH"
61 ;" TMGRESULT(0)=1^JobNumber
62 ;" "STATUS"
63 ;" TMGRESULT(0)=1^%Done^Message. <-- Will be '1^100^#DONE#' when task is done.
64 ;" "IEN LIST"
65 ;" TMGRESULT(0)=1 if Success or -1^Message"
66 ;" TMGRESULT(1)=IEN^[Fld Value] <-- Field value returned, if requested
67 ;" TMGRESULT(2)=IEN^[Fld Value]
68 ;" etc ...
69 ;" "PREP SUBSET"
70 ;" TMGRESULT(0)=1^Success or -1^Message
71 ;" "CLEAR"
72 ;" TMGRESULT(0)=1^Success
73 ;" "ALLOWED FILES ENTRY SUBSET"
74 ;" TMGRESULT(0)="1^Success" or "-1^Message"
75 ;" TMGRESULT(1)=FileNum^FileName
76 ;" TMGRESULT(2)=FileNum^FileName
77 ;" etc ...
78 ;" "FIELD LIST SUBSET"
79 ;" TMGRESULT(0)="1^Success" or "-1^Message"
80 ;" TMGRESULT(1)=FLDNum^Name^Info
81 ;" TMGRESULT(2)=FLDNum^Name^Info
82 ;" etc ...
83 ;" "RESULTS LIST SUBSET"
84 ;" TMGRESULT(0)="1^Success" or "-1^Message"
85 ;" TMGRESULT(1)=IENNum^RequestedFieldNames
86 ;" TMGRESULT(2)=IENNum^RequestedFieldNames
87 ;" etc ...
88 ;"Result: none
89 ;
90 NEW TMGCOMMAND,TMGCOMMAND
91 SET TMGCOMMAND=$$TRIM^XLFSTR($$UP^XLFSTR($PIECE($GET(INPUT("REQUEST")),"^",1)))
92 SET TMGPARAMS=$$UP^XLFSTR($PIECE($GET(INPUT("REQUEST")),"^",2,199))
93 ;
94 ;"MERGE ^TMG("TMP","RPC","TMGRPCSR",$H,"TMGCOMMAND")=TMGCOMMAND
95 ;"MERGE ^TMG("TMP","RPC","TMGRPCSR",$H,"TMGPARAMS")=TMGPARAMS
96 ;
97 SET TMGRESULT(0)="-1^No command requested." ;"default to error state.
98 IF TMGCOMMAND="LAUNCH" DO
99 . DO LAUNCH^TMGRPCS0(.TMGRESULT,TMGPARAMS)
100 IF TMGCOMMAND="STATUS" DO
101 . DO STATUS^TMGRPCS0(.TMGRESULT,TMGPARAMS)
102 ELSE IF TMGCOMMAND="RESULTS" DO
103 . DO IENLIST^TMGRPCS0(.TMGRESULT,TMGPARAMS)
104 ELSE IF TMGCOMMAND="PREP SUBSET" DO
105 . DO PREPSB^TMGRPCS0(.TMGRESULT,TMGPARAMS)
106 ELSE IF TMGCOMMAND="CLEAR" DO
107 . DO CLEAR^TMGRPCS0(.TMGRESULT,TMGPARAMS)
108 ELSE IF TMGCOMMAND="ALLOWED FILES ENTRY SUBSET" DO
109 . DO GETAFSUB^TMGSRCH1(.TMGRESULT,TMGPARAMS)
110 ELSE IF TMGCOMMAND="FIELD LIST SUBSET" DO
111 . DO GETFLDSB^TMGSRCH1(.TMGRESULT,TMGPARAMS)
112 ELSE IF TMGCOMMAND="RESULTS LIST SUBSET" DO
113 . DO GETRSLTSB^TMGRPCS0(.TMGRESULT,TMGPARAMS)
114 ;
115 QUIT
116 ;
117INSTALL ;
118 ;"Purpose: to add the RPC's to the OPTION record OR CPRS GUI CHART
119 DO INSTALL1^TMGRPC1B("TMG SEARCH CHANNEL")
120 QUIT
121 ;
122
Note: See TracBrowser for help on using the repository browser.