source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.Doc/Help/html/7a3ebdd5-1ff9-4238-c93c-02cd9ae03370.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: 20.7 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, DataSet, 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="7a3ebdd5-1ff9-4238-c93c-02cd9ae03370" /></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, DataSet, 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/bwy42y0e" target="_blank">DataSet</a> <span class="parameter">aDataSet</span>,
10 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">string</a> <span class="parameter">aTableName</span>,
11 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">string</a> <span class="parameter">aContext</span>
12)</pre></div></div><div class="code" x-lang="VisualBasic"><div id="VisualBasicDeclarationSection"><pre><span class="keyword">Function</span> <span class="identifier">TableFromCommand</span> ( _
13 <span class="parameter">aCommand</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>, _
14 <span class="parameter">aDataSet</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/bwy42y0e" target="_blank">DataSet</a>, _
15 <span class="parameter">aTableName</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>, _
16 <span class="parameter">aContext</span> <span class="keyword">As</span> <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a> _
17) <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>(
18 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>^ <span class="parameter">aCommand</span>,
19 <a href="http://msdn2.microsoft.com/en-us/library/bwy42y0e" target="_blank">DataSet</a>^ <span class="parameter">aDataSet</span>,
20 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>^ <span class="parameter">aTableName</span>,
21 <a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a>^ <span class="parameter">aContext</span>
22)</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="aDataSet"><dt><span class="parameter">aDataSet</span></dt><dd><a href="http://msdn2.microsoft.com/en-us/library/bwy42y0e" target="_blank">DataSet</a><br />The DataSet to be populated with a resulting DataTable named aTableNAme</dd></dl><dl paramName="aTableName"><dt><span class="parameter">aTableName</span></dt><dd><a href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank">String</a><br />The name of the DataTable in the DataSet to populate or to create</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="">
23 Normally the AppContext is set once, after logging into the BMX, with a
24 single AppContext for the current applications or specified in every RPC call.
25 </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="">
26 The VEN namespace is for PCC+ and the example below would be used at the beginning
27 of a PCC+ application.
28 <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>
29 aRemoteSession.AppContext = "VEN RPC";
30 </pre></td></tr></table></div>
31 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.
32 <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>
33 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.
34 PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
35 ;This simple RPC demonstrates how to format data
36 ;for the BMXNet ADO.NET data provider
37 ;
38 ;Returns a maximum of BMXCOUNT records from the
39 ;VA PATIENT file whose names begin with BMXPAT
40 ;
41 N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
42 ;
43 ; BMXY is passed in by reference. Set it to
44 ;the value of the variable in which we will return our data:
45 S BMXY="^TMP(BMX,"_$J_")"
46 ;
47 ;The first subnode of the data global contains the column header information
48 ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
49 ;where t is the column data type:
50 ; T for text
51 ; I for integer
52 ; N for floating point number
53 ; D for date/time.
54 ;xxxxx is the length of the column in characters.
55 ;
56 S BMXI=0,BMXC=0
57 S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
58 ;
59 ;You MUST set an error trap:
60 S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
61 ;
62 ;Strip CR, LF, TAB from BMXCOUNT parameter
63 S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
64 S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
65 S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
66 ;
67 ;Iterate through the global and set the data nodes:
68 S:BMXPAT="" BMXPAT="A"
69 S BMXPAT=$O(^DPT("B",BMXPAT),-1)
70 S BMXD=0
71 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
72 . Q:'$D(^DPT(BMXD,0))
73 . S BMXI=BMXI+1
74 . S BMXNODE=^DPT(BMXD,0)
75 . ;Convert the DOB from FM date to external form
76 . S Y=$P(BMXNODE,U,3)
77 . I +Y X ^DD("DD")
78 . S BMXDOB=Y
79 . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
80 . ;and terminated with a $C(30)
81 . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
82 ;
83 ;After all the data nodes have been set, set the final node to $C(31) to indicate
84 ;the end of the recordset
85 S BMXI=BMXI+1
86 S ^ TMP(BMX,$J,BMXI)=$C(31)
87 Q
88 ;
89 PDERR ;Error trap for PDEMO
90 ;
91 S ^ TMP(BMX,$J,BMXI+1)=$C(31)
92 Q
93 </pre></td></tr></table></div>
94 Register as an RPC
95 <p>
96 NAME: BMX DEMO TAG: PDEMO
97 ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
98 </p>
99 Call using a RemoteSession
100 <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>
101 DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
102 </pre></td></tr></table></div>
103 </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>
104 <p />
105 <span>
106 Send
107 <a href="javascript:sendfeedback('Documentation Feedback (Sandcastle CTP): ', 'TableFromCommand Method (String, DataSet, String, String)', '');">
108
109 comments
110 </a>
111 about this topic to Microsoft.
112 </span>
113 </div></div></div></body></html>
Note: See TracBrowser for help on using the repository browser.