BMXNET 4.0 Developer API

Calling a Custom Remote Procedure call (RPC) registered in VA FileMan’s REMOTE PROCEDURE file that results in a DataTable. You must design your remote procedure’s M routine to build its result its data in the specific format described later in this document.

Namespace:  IndianHealthService.BMXNet
Assembly:  BMXNET40 (in BMXNET40.dll)

Syntax

         
 C#  Visual Basic  Visual C++ 
DataTable TableFromCommand(
	string aCommand
)
Function TableFromCommand ( _
	aCommand As String _
) As DataTable
DataTable^ TableFromCommand(
	String^ aCommand
)

Parameters

aCommand
String
The co /// The name of the RPC

Return Value

The resulting DataTable

Remarks

Normally the AppContext is set once, after logging into the BMX, with a single AppContext for the current applications or specified in every RPC call.

Examples

The VEN namespace is for PCC+ and the example below would be used at the beginning of a PCC+ application.
Copy Code
            aRemoteSession.AppContext = "VEN RPC";
            
The M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
Copy Code
            Figure 5 2 shows the M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients.  See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
            PDEMO(BMXY,BMXPAT,BMXCOUNT)	;EP
            	;This simple RPC demonstrates how to format data
            ;for the BMXNet ADO.NET data provider
            ;
            ;Returns a maximum of BMXCOUNT records from the
            ;VA PATIENT file whose names begin with BMXPAT
            ;
            N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
            ;
            ; BMXY is passed in by reference.  Set it to 
            ;the value of the variable in which we will return our data:
            S BMXY="^TMP(BMX,"_$J_")"
            ;
            ;The first subnode of the data global contains the column header information
            ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
            ;where t is the column data type:
            ;	T for text
            ;	I for integer
            ;	N for floating point number
            ;	D for date/time.
            ;xxxxx is the length of the column in characters.
            ;
            S BMXI=0,BMXC=0
            S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
            ;
            ;You MUST set an error trap:
            S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
            ;
            ;Strip CR, LF, TAB from BMXCOUNT parameter
            S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
            S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
            S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
            ;
            ;Iterate through the global and set the data nodes:
            S:BMXPAT="" BMXPAT="A"
            S BMXPAT=$O(^DPT("B",BMXPAT),-1)
            S BMXD=0
            F  S BMXPAT=$O(^DPT("B",BMXPAT)) Q:BMXPAT=""  S BMXD=$O(^DPT("B",BMXPAT,0)) I +BMXD  S BMXC=BMXC+1 Q:(BMXCOUNT)BMXC BMXCOUNT)  D
            . Q:'$D(^DPT(BMXD,0))
            . S BMXI=BMXI+1
            . S BMXNODE=^DPT(BMXD,0)
            . ;Convert the DOB from FM date to external form
            . S Y=$P(BMXNODE,U,3)
            . I +Y X ^DD("DD")
            . S BMXDOB=Y
            . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
            . ;and terminated with a $C(30)
            . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
            ;
            ;After all the data nodes have been set, set the final node to $C(31) to indicate
            ;the end of the recordset
            S BMXI=BMXI+1
            S ^ TMP(BMX,$J,BMXI)=$C(31)
            Q
            ;
            PDERR	;Error trap for PDEMO
            ;
            S ^ TMP(BMX,$J,BMXI+1)=$C(31)
            Q
            
Register as an RPC

NAME: BMX DEMO TAG: PDEMO ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY

Call using a RemoteSession
Copy Code
            DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
            

See Also