<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>getItemById including select statement possible?</title><link>https://www.aras.com/community/f/development/4044/getitembyid-including-select-statement-possible</link><description>Hi,

I sometimes have seen code that uses getItemById with additional parameters. It seems that it&amp;#180;s also possible to include a select statement. 

Is it actually possible to do something like this?
 var myManufacturer = inn.getItemById(&amp;quot;Manufacturer</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: getItemById including select statement possible?</title><link>https://www.aras.com/community/thread/2295?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 11:32:25 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:254f5a3e-6355-4870-9647-a8ca68afbf45</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi Angela,

I think functionally those two calls would be identical. However, using &lt;code&gt;aras.IomInnovator&lt;/code&gt; will be more generally applicable. Unlike a Server method, the &lt;code&gt;this&lt;/code&gt; context item of a Client method doesn&amp;#39;t have to be an Aras Item object, so you may not be able to call &lt;code&gt;this.newInnovator();&lt;/code&gt; from any client event.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getItemById including select statement possible?</title><link>https://www.aras.com/community/thread/2294?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 05:47:19 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:da4ccce8-93e7-406e-9605-5886b6226188</guid><dc:creator>AngelaIp</dc:creator><description>Hi Chris,

ok, that´s really some special behavior and probably has it´s reason. The code where I have seeen the additional properties were quite special use cases. In my case, the classical and proven get queries already perfectly do the job. I do not have to make experiments everywhere.

One last question: Is there any difference between these two ways to call the IOM on client side?

&lt;pre&gt;&lt;code&gt;var itm = aras.IomInnovator.newItem(&amp;quot;Part&amp;quot;, &amp;quot;get&amp;quot;);
itm.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;name&amp;quot;);
itm.setID(&amp;quot;C1A218EE1CF5461F964BEAED127211E6&amp;quot;);
itm = itm.apply();&lt;/code&gt;&lt;/pre&gt;


&lt;pre&gt;&lt;code&gt;var inn = this.newInnovator(); 
var itm = inn.newItem(&amp;quot;Part&amp;quot;, &amp;quot;get&amp;quot;);
itm.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;name&amp;quot;);
itm.setID(&amp;quot;C1A218EE1CF5461F964BEAED127211E6&amp;quot;);
itm = itm.apply();&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getItemById including select statement possible?</title><link>https://www.aras.com/community/thread/2293?ContentTypeID=1</link><pubDate>Fri, 16 Nov 2018 11:02:17 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d2d2c4e0-4729-45fe-9332-28f9e4510886</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi Angela,

I took a deeper look into the method code and it looks like the select is applied when the call is made to the sever. However, once the item is retrieved from the server it is not immediately returned to the user. Instead the property data is merged into the cached version of the item that exists on the client. This is why you&amp;#39;re still able to get &lt;strong&gt;city&lt;/strong&gt; even though you didn&amp;#39;t include it in the select statement.

If your use case requires that these other properties are not populated at all, you can try the sample below which will let you use an API more similar to a server method.

&lt;pre&gt;&lt;code&gt;var itm = aras.IomInnovator.newItem(&amp;quot;Part&amp;quot;, &amp;quot;get&amp;quot;);
itm.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;name&amp;quot;);
itm.setID(&amp;quot;C1A218EE1CF5461F964BEAED127211E6&amp;quot;);
itm = itm.apply();&lt;/code&gt;&lt;/pre&gt;


Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getItemById including select statement possible?</title><link>https://www.aras.com/community/thread/2292?ContentTypeID=1</link><pubDate>Fri, 16 Nov 2018 09:14:33 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d686d32d-81b0-4e0c-8236-cd9d654c156e</guid><dc:creator>AngelaIp</dc:creator><description>Hi Chris,

thanks for explanation! Didn´t know about the different between the server and client version. 
I made some very quick test with the ItemType Manufacturer:

&lt;pre&gt;&lt;code&gt;var manunfacturer = aras.getItemById(&amp;quot;Manufacturer&amp;quot;, myId ,0,undefined,&amp;quot;name&amp;quot;);
var name = aras.getItemProperty(manunfacturer, &amp;quot;name&amp;quot;,&amp;quot;empty&amp;quot;);     
var city = aras.getItemProperty(manunfacturer, &amp;quot;city&amp;quot;,&amp;quot;empty&amp;quot;);&lt;/code&gt;&lt;/pre&gt;


In my version, the select statement stil seems to be ignored. The code will return both &amp;quot;name&amp;quot; and &amp;quot;city&amp;quot;, also &amp;quot;city&amp;quot; is not included in the select statement. 

Angela&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getItemById including select statement possible?</title><link>https://www.aras.com/community/thread/2291?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 09:52:26 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:affcbbdb-b032-4769-b873-b14fd374a236</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi Angela,

You might be seeing a difference between the Server-side function that exists on the &lt;code&gt;Innovator&lt;/code&gt; object and the Client-side function that exists on the &lt;code&gt;aras&lt;/code&gt; object. The Server-side function accepts only two parameters: the ItemType name and the id of the item. The Client-side function on the other hand can accept more arguments such as a select statement. You can find the definition of the Client-side &lt;strong&gt;getItemById&lt;/strong&gt; function in your code tree under &lt;code&gt;\Innovator\Client\javascript\item_methods.js&lt;/code&gt;.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>