source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.Doc/Help/html/63f4b599-a909-8e3d-bb30-e4fc835ddf45.htm@ 1146

Last change on this file since 1146 was 1146, checked in by Sam Habiel, 13 years ago

Initial Import of BMX4

File size: 19.4 KB
Line 
1<html xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><head><META NAME="save" CONTENT="history" /><title>TableFromCommand Method (String, String)</title><link rel="stylesheet" type="text/css" href="../styles/presentation.css" /><link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" /><link rel="stylesheet" type="text/css" href="ms-help://Dx/DxRuntime/DxLink.css" /><script type="text/javascript" src="../scripts/EventUtilities.js"> </script><script type="text/javascript" src="../scripts/SplitScreen.js"> </script><script type="text/javascript" src="../scripts/Dropdown.js"> </script><script type="text/javascript" src="../scripts/script_manifold.js"> </script><script type="text/javascript" src="../scripts/LanguageFilter.js"> </script><script type="text/javascript" src="../scripts/DataStore.js"> </script><script type="text/javascript" src="../scripts/CommonUtilities.js"> </script><script type="text/javascript" src="../scripts/MemberFilter.js"> </script><meta name="guid" content="63f4b599-a909-8e3d-bb30-e4fc835ddf45" /></head><body><input type="hidden" id="userDataCache" class="userDataStyle" /><input type="hidden" id="hiddenScrollOffset" /><img id="collapseImage" style="display:none; height:0; width:0;" src="../icons/collapse_all.gif" title="Collapse image" /><img id="expandImage" style="display:none; height:0; width:0;" src="../icons/expand_all.gif" title="Expand Image" /><img id="collapseAllImage" style="display:none; height:0; width:0;" src="../icons/collall.gif" title="CollapseAll image" /><img id="expandAllImage" style="display:none; height:0; width:0;" src="../icons/expall.gif" title="ExpandAll image" /><img id="dropDownImage" style="display:none; height:0; width:0;" src="../icons/twirl_unselected.gif" title="DropDown image" /><img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="../icons/twirl_unselected_hover.gif" title="DropDownHover image" /><img id="copyImage" style="display:none; height:0; width:0;" src="../icons/copycode.gif" title="Copy image" /><img id="copyHoverImage" style="display:none; height:0; width:0;" src="../icons/copycodeHighlight.gif" title="CopyHover image" /><img id="checkBoxSelectImage" style="display:none; height:0; width:0;" src="../icons/ch_selected.gif" /><img id="checkBoxUnSelectImage" style="display:none; height:0; width:0;" src="../icons/ch_unselected.gif" /><img id="checkBoxSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/ch_selected_hover.gif" /><img id="checkBoxUnSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/ch_unselected_hover.gif" /><img id="radioSelectImage" style="display:none; height:0; width:0;" src="../icons/r_select.gif" /><img id="radioUnSelectImage" style="display:none; height:0; width:0;" src="../icons/r_unselect.gif" /><img id="radioSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/r_select_hover.gif" /><img id="radioUnSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/r_unselect_hover.gif" /><img id="curvedLeftSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_sel_lft_cnr.gif" /><img id="curvedRightSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_sel_rt_cnr.gif" /><img id="curvedLeftUnSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_unsel_lft_cnr.gif" /><img id="curvedRightUnSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_unsel_rt_cnr.gif" /><img id="gradLeftSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_sel_lft_grad.gif" /><img id="gradRightSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_sel_rt_grad.gif" /><img id="gradLeftUnSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_unsel_lft_grad.gif" /><img id="gradRightUnSelectImage" style="display:none; height:0; width:0;" src="../icons/tab_unsel_rt_grad.gif" /><img id="twirlSelectImage" style="display:none; height:0; width:0;" src="../icons/twirl_selected.gif" /><img id="twirlUnSelectImage" style="display:none; height:0; width:0;" src="../icons/twirl_unselected.gif" /><img id="twirlSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/twirl_selected_hover.gif" /><img id="twirlUnSelectHoverImage" style="display:none; height:0; width:0;" src="../icons/twirl_unselected_hover.gif" /><img id="NSRBottomImage" style="display:none; height:0; width:0;" src="../icons/NSRbottomgrad.gif" /><div id="header"><table id="topTable"><tr id="headerTableRow3"><td><span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage, event)" tabindex="0"><img ID="toggleAllImage" class="toggleAll" src="../icons/collall.gif" title="CollapseAll image" /><label id="collapseAllLabel" for="toggleAllImage" style="display: none;">Collapse All</label><label id="expandAllLabel" for="toggleAllImage" style="display: none;">Expand All</label> </span> | <span id="languageFilterToolTip" style="cursor:default;" onmouseover="languageFilterImage.src=dropDownHoverImage.src;" onmouseout="languageFilterImage.src=dropDownImage.src;" tabindex="0"><img id="languageFilterImage" src="../icons/twirl_unselected.gif" title="DropDown image" /><label id="VisualBasicLabel" for="languageFilterImage" style="display: none;">Language Filter: Visual Basic</label><label id="CSharpLabel" for="languageFilterImage" style="display: none;">Language Filter: C#</label><label id="ManagedCPlusPlusLabel" for="languageFilterImage" style="display: none;">Language Filter: Visual C++</label><label id="JavaScriptLabel" for="languageFilterImage" style="display: none;">Language Filter: JavaScript</label></span><div id="languageSpan"><div id="VisualBasic" onclick="changeLanguage(data, 'VisualBasic', 'vb');"><img id="VisualBasicImage" onmouseover="mouseOverCheck(VisualBasicImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" onmouseout="mouseOutCheck(VisualBasicImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" src="../icons/r_unselect.gif" /> Visual Basic</div><br /><div id="CSharp" onclick="changeLanguage(data, 'CSharp', 'cs');"><img id="CSharpImage" onmouseover="mouseOverCheck(CSharpImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" onmouseout="mouseOutCheck(CSharpImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" src="../icons/r_unselect.gif" /> C#</div><br /><div id="ManagedCPlusPlus" onclick="changeLanguage(data, 'ManagedCPlusPlus', 'cpp');"><img id="ManagedCPlusPlusImage" onmouseover="mouseOverCheck(ManagedCPlusPlusImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" onmouseout="mouseOutCheck(ManagedCPlusPlusImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" src="../icons/r_unselect.gif" /> Visual C++</div><br /><div id="JavaScript" onclick="changeLanguage(data, 'JavaScript', 'cs');"><img id="JavaScriptImage" onmouseover="mouseOverCheck(JavaScriptImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" onmouseout="mouseOutCheck(JavaScriptImage,radioSelectImage,radioUnSelectImage,radioSelectHoverImage,radioUnSelectHoverImage)" src="../icons/r_unselect.gif" /> JavaScript</div><br /></div> | <a href="#exampleToggle" onclick="OpenSection(exampleToggle)">Example</a> | <a href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a></td></tr><tr id="headerTableRow1"><td align="left"><span id="runningHeaderText">.NET Framework Class Library</span></td></tr><tr id="headerTableRow2"><td align="left"><span id="nsrTitle">RemoteSession<span class="cs">.</span><span class="vb">.</span><span class="cpp">::</span>TableFromCommand Method (String, String)</span></td></tr><tr><td class="nsrBottom" background="../icons/NSRbottomgrad.gif" /></tr></table></div><div id="mainSection"><div id="mainBody"><div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()" /><div class="header"><font color="darkgray" /><p><font color="#a9a9a9">BMXNET 4.0 Developer API</font></p></div><div class="summary">
2 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.
3 </div><p />
4 <b>Namespace:</b>
5  <a href="58d4523c-9538-8ef8-a06c-5ae73a5250ff.htm">IndianHealthService.BMXNet</a><br />
6 <b>Assembly:</b>
7  <span sdata="assembly">BMXNET40</span> (in BMXNET40.dll)<h1 class="heading"><span onclick="ExpandCollapse(syntaxToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(syntaxToggle, event)" tabindex="0"><img id="syntaxToggle" class="toggle" name="toggleSwitch" src="../icons/collapse_all.gif" />Syntax</span></h1><div id="syntaxSection" class="section" name="collapseableSection" style=""><div id="syntaxCodeBlocks"><table class="filter" cellspacing="0" cellpadding="0"><tr id="curvedSyntaxTabs"><td class="leftTab" x-lang="CSharp"> </td><td class="middleTab" x-lang="CSharp"> </td><td class="rightTab" x-lang="CSharp"> </td><td class="leftTab" x-lang="VisualBasic"> </td><td class="middleTab" x-lang="VisualBasic"> </td><td class="rightTab" x-lang="VisualBasic"> </td><td class="leftTab" x-lang="ManagedCPlusPlus"> </td><td class="middleTab" x-lang="ManagedCPlusPlus"> </td><td class="rightTab" x-lang="ManagedCPlusPlus"> </td></tr><tr class="tabs" id="syntaxTabs"><td class="leftGrad" x-lang="CSharp"> </td><td class="tab" x-lang="CSharp" onclick="changeLanguage(data, 'CSharp', 'cs');">C#</td><td class="rightGrad" x-lang="CSharp"> </td><td class="leftGrad" x-lang="VisualBasic"> </td><td class="tab" x-lang="VisualBasic" onclick="changeLanguage(data, 'VisualBasic', 'vb');">Visual Basic</td><td class="rightGrad" x-lang="VisualBasic"> </td><td class="leftGrad" x-lang="ManagedCPlusPlus"> </td><td class="tab" x-lang="ManagedCPlusPlus" onclick="changeLanguage(data, 'ManagedCPlusPlus', 'cpp');">Visual C++</td><td class="rightGrad" x-lang="ManagedCPlusPlus"> </td></tr></table><div id="syntaxBlocks"><div class="code" x-lang="CSharp"><div id="CSharpDeclarationSection"><pre><a href="http://msdn2.microsoft.com/en-us/library/9186hy08" target="_blank">DataTable</a> <span class="identifier">TableFromCommand</span>(
8 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">string</a> <span class="parameter">aCommand</span>,
9 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">string</a> <span class="parameter">aContext</span>
10)</pre></div></div><div class="code" x-lang="VisualBasic"><div id="VisualBasicDeclarationSection"><pre><span class="keyword">Function</span> <span class="identifier">TableFromCommand</span> ( _
11 <span class="parameter">aCommand</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>, _
12 <span class="parameter">aContext</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a> _
13) <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/9186hy08" target="_blank">DataTable</a></pre></div></div><div class="code" x-lang="ManagedCPlusPlus"><div id="ManagedCPlusPlusDeclarationSection"><pre><a href="http://msdn2.microsoft.com/en-us/library/9186hy08" target="_blank">DataTable</a>^ <span class="identifier">TableFromCommand</span>(
14 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>^ <span class="parameter">aCommand</span>,
15 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>^ <span class="parameter">aContext</span>
16)</pre></div></div></div></div><div id="parameters"><h4 class="subHeading">Parameters</h4><dl paramName="aCommand"><dt><span class="parameter">aCommand</span></dt><dd><a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a><br />The co /// The name of the RPC </dd></dl><dl paramName="aContext"><dt><span class="parameter">aContext</span></dt><dd><a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a><br />The AppContext to set prior to the call</dd></dl></div><h4 class="subHeading">Return Value</h4>The resulting DataTable</div><h1 class="heading"><span onclick="ExpandCollapse(remarksToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(remarksToggle, event)" tabindex="0"><img id="remarksToggle" class="toggle" name="toggleSwitch" src="../icons/collapse_all.gif" />Remarks</span></h1><div id="remarksSection" class="section" name="collapseableSection" style="">
17 Normally the AppContext is set once, after logging into the BMX, with a
18 single AppContext for the current applications or specified in every RPC call.
19 </div><h1 class="heading"><span onclick="ExpandCollapse(exampleToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(exampleToggle, event)" tabindex="0"><img id="exampleToggle" class="toggle" name="toggleSwitch" src="../icons/collapse_all.gif" />Examples</span></h1><div id="exampleSection" class="section" name="collapseableSection" style="">
20 The VEN namespace is for PCC+ and the example below would be used at the beginning
21 of a PCC+ application.
22 <div class="code"><table width="100%" cellspacing="0" cellpadding="0"><tr><th><span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this, event)" onmouseover="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" tabindex="0"><img class="copyCodeImage" name="ccImage" align="absmiddle" title="Copy image" src="../icons/copycode.gif" />Copy Code</span></th></tr><tr><td colspan="2"><pre>
23 aRemoteSession.AppContext = "VEN RPC";
24 </pre></td></tr></table></div>
25 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.
26 <div class="code"><table width="100%" cellspacing="0" cellpadding="0"><tr><th><span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this, event)" onmouseover="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" tabindex="0"><img class="copyCodeImage" name="ccImage" align="absmiddle" title="Copy image" src="../icons/copycode.gif" />Copy Code</span></th></tr><tr><td colspan="2"><pre>
27 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.
28 PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
29 ;This simple RPC demonstrates how to format data
30 ;for the BMXNet ADO.NET data provider
31 ;
32 ;Returns a maximum of BMXCOUNT records from the
33 ;VA PATIENT file whose names begin with BMXPAT
34 ;
35 N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
36 ;
37 ; BMXY is passed in by reference. Set it to
38 ;the value of the variable in which we will return our data:
39 S BMXY="^TMP(BMX,"_$J_")"
40 ;
41 ;The first subnode of the data global contains the column header information
42 ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
43 ;where t is the column data type:
44 ; T for text
45 ; I for integer
46 ; N for floating point number
47 ; D for date/time.
48 ;xxxxx is the length of the column in characters.
49 ;
50 S BMXI=0,BMXC=0
51 S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
52 ;
53 ;You MUST set an error trap:
54 S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
55 ;
56 ;Strip CR, LF, TAB from BMXCOUNT parameter
57 S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
58 S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
59 S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
60 ;
61 ;Iterate through the global and set the data nodes:
62 S:BMXPAT="" BMXPAT="A"
63 S BMXPAT=$O(^DPT("B",BMXPAT),-1)
64 S BMXD=0
65 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
66 . Q:'$D(^DPT(BMXD,0))
67 . S BMXI=BMXI+1
68 . S BMXNODE=^DPT(BMXD,0)
69 . ;Convert the DOB from FM date to external form
70 . S Y=$P(BMXNODE,U,3)
71 . I +Y X ^DD("DD")
72 . S BMXDOB=Y
73 . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
74 . ;and terminated with a $C(30)
75 . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
76 ;
77 ;After all the data nodes have been set, set the final node to $C(31) to indicate
78 ;the end of the recordset
79 S BMXI=BMXI+1
80 S ^ TMP(BMX,$J,BMXI)=$C(31)
81 Q
82 ;
83 PDERR ;Error trap for PDEMO
84 ;
85 S ^ TMP(BMX,$J,BMXI+1)=$C(31)
86 Q
87 </pre></td></tr></table></div>
88 Register as an RPC
89 <p>
90 NAME: BMX DEMO TAG: PDEMO
91 ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
92 </p>
93 Call using a RemoteSession
94 <div class="code"><table width="100%" cellspacing="0" cellpadding="0"><tr><th><span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this, event)" onmouseover="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" tabindex="0"><img class="copyCodeImage" name="ccImage" align="absmiddle" title="Copy image" src="../icons/copycode.gif" />Copy Code</span></th></tr><tr><td colspan="2"><pre>
95 DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
96 </pre></td></tr></table></div>
97 </div><h1 class="heading"><span onclick="ExpandCollapse(seeAlsoToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(seeAlsoToggle, event)" tabindex="0"><img id="seeAlsoToggle" class="toggle" name="toggleSwitch" src="../icons/collapse_all.gif" />See Also</span></h1><div id="seeAlsoSection" class="section" name="collapseableSection" style=""><div class="seeAlsoStyle"><a href="15218990-392b-2525-75b3-834166ec97f7.htm">RemoteSession Interface</a></div><div class="seeAlsoStyle"><a href="534dc153-f26b-846c-6a67-7ccc52aaccc2.htm">TableFromCommand Overload</a></div><div class="seeAlsoStyle"><a href="58d4523c-9538-8ef8-a06c-5ae73a5250ff.htm">IndianHealthService.BMXNet Namespace</a></div></div><div id="footer"><div class="footerLine"><img width="100%" height="3px" src="../icons/footer.gif" title="Footer image" /></div>
98 <p />
99 <span>
100 Send
101 <a href="javascript:sendfeedback('Documentation Feedback (Sandcastle CTP): ', 'TableFromCommand Method (String, String)', '');">
102
103 comments
104 </a>
105 about this topic to Microsoft.
106 </span>
107 </div></div></div></body></html>
Note: See TracBrowser for help on using the repository browser.