<?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>How to convert SQL to AML</title><link>https://www.aras.com/community/f/development/3500/how-to-convert-sql-to-aml</link><description>How to convert SQL to AML use IOM.dll version 11.0.0.6812 below:

SELECT MP.* , MN.keyed_name AS MN_keyed_name
FROM Manufacturer_Part MP
LEFT JOIN Manufacturer MN
ON(MP.manufacturer = MN.ID)
WHERE ( MP.ITEM_NUMBER = &amp;#39;CPART5566a&amp;#39; AND MP.manufacturer IS</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to convert SQL to AML</title><link>https://www.aras.com/community/thread/1148?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 22:31:07 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:31b66993-2e09-4c7d-9a8a-6819894127ef</guid><dc:creator>Former Member</dc:creator><description>Beacause large amount for data result, so performance of method above will slower than SQL query ?

Further: with case as below, process will difficult and slow than more if not used query SQL

SELECT *

FROM ABC XXX

INNER JOIN

(SELECT MP.* ,
(CASE WHEN MN.keyed_name IS NULL Then ‘1’ ELSE MN.keyed_name END) AS MN_keyed_name
FROM Manufacturer_Part MP
LEFT JOIN Manufacturer MN
ON(MP.manufacturer = MN.ID)
WHERE ( MP.ITEM_NUMBER = ‘CPART5566a’ AND MP.manufacturer IS NULL )
OR ( MP.ITEM_NUMBER = ‘CPART5566a’ AND MN.keyed_name = ‘MAKRT5566b’ )
ORDER BY modified_on) YYY

&lt;strong&gt;ON(XXX.ITEM_NUMBER = YYY.ITEM_NUMBER AND XXX.keyed_name = YYY.keyed_name)&lt;/strong&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert SQL to AML</title><link>https://www.aras.com/community/thread/1145?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 10:28:17 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:5388c6bf-dc96-4c27-9f1a-e84c37358a82</guid><dc:creator>Zahar Chernov</dc:creator><description>AML is not working as SQL.

You can apply AML to get data from the DB (and get the DB value of the keyed_name) and then you have 2 options:
&lt;ol&gt;
 	&lt;li&gt;You can pull all Items of type Manufacturer that keyed_name is_null and update the keyed_name value of each Item of type Manufacturer to &amp;quot;1&amp;quot;:
&lt;blockquote&gt;
&lt;pre&gt;Item queryResult = this.getInnovator().applyAML({@yourAML});
Item manufacturersWithEmptyKeyedName = queryResult.getItemsByXPath(&amp;quot;//Item[@type='Manufacturer' and keyed_name/@is_null='1']&amp;quot;);

for (int i = 0; i &amp;lt; manufacturersWithEmptyKeyedName.getItemCount(); i++) {
 	string keyed_name = manufacturersWithEmptyKeyedName.getItemByIndex(i).getProperty(&amp;quot;keyed_name&amp;quot;, &amp;quot;1&amp;quot;);
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
 	&lt;li&gt;In your code when ever you want to get keyed_name property use getProperty function with 2 parameters, when first one is property name and second one is &amp;quot;default&amp;quot; value of 1. So the idea with this method that if property in DB was null it will return the second parameter (in your case &amp;quot;1&amp;quot;)
&lt;blockquote&gt;
&lt;pre&gt;string keyed_name = someItem.getProperty(&amp;quot;keyed_name&amp;quot;, &amp;quot;1&amp;quot;)&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert SQL to AML</title><link>https://www.aras.com/community/thread/1141?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 01:49:30 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:a914b63b-ca77-4dab-a7e3-4938892a5611</guid><dc:creator>Former Member</dc:creator><description>Please for help with SQL below:

SELECT MP.* ,
&lt;strong&gt;(CASE WHEN MN.keyed_name IS NULL Then &amp;#39;1&amp;#39; ELSE MN.keyed_name END) AS MN_keyed_name&lt;/strong&gt;
FROM Manufacturer_Part MP
LEFT JOIN Manufacturer MN
ON(MP.manufacturer = MN.ID)
WHERE ( MP.ITEM_NUMBER = &amp;#39;CPART5566a&amp;#39; AND MP.manufacturer IS NULL )
OR ( MP.ITEM_NUMBER = &amp;#39;CPART5566a&amp;#39; AND MN.keyed_name = &amp;#39;MAKRT5566b&amp;#39; )
ORDER BY modified_on&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert SQL to AML</title><link>https://www.aras.com/community/thread/1104?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 03:44:16 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:3a7d19c6-6640-440f-8843-636055d31427</guid><dc:creator>Former Member</dc:creator><description>I already edit as below and result is OK. Thanks you very much!

&amp;lt;AML&amp;gt;
&amp;lt;Item type=&amp;#39;Manufacturer Part&amp;#39; action=&amp;#39;get&amp;#39;&amp;gt;
&amp;lt;item_number&amp;gt;CPART5566a&amp;lt;/item_number&amp;gt;
&amp;lt;or&amp;gt;
&amp;lt;manufacturer&amp;gt;
&amp;lt;Item type=&amp;#39;Manufacturer&amp;#39;&amp;gt;
&amp;lt;keyed_name&amp;gt;MAKRT5566b&amp;lt;/keyed_name&amp;gt;
&amp;lt;/Item&amp;gt;
&amp;lt;/manufacturer&amp;gt;
&amp;lt;manufacturer condition=&amp;#39;is null&amp;#39; /&amp;gt;
&amp;lt;/or&amp;gt;
&amp;lt;/Item&amp;gt;
&amp;lt;/AML&amp;gt;

&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert SQL to AML</title><link>https://www.aras.com/community/thread/1102?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 03:10:17 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:b017da5a-2637-4a96-8b93-34e0717ddb04</guid><dc:creator>Zahar Chernov</dc:creator><description>&amp;lt;AML&amp;gt;
&amp;lt;Item type=&amp;#39;Manufacturer Part&amp;#39; action=&amp;#39;get&amp;#39;&amp;gt;
&amp;lt;item_number&amp;gt;CPART5566a&amp;lt;/item_number&amp;gt;
&amp;lt;or&amp;gt;
&amp;lt;manufacturer&amp;gt;
&amp;lt;Item type=&amp;#39;Manufacturer&amp;#39;&amp;gt;MAKRT5566b&amp;lt;/Item&amp;gt;
&amp;lt;/manufacturer&amp;gt;
&amp;lt;manufacturer condition=&amp;#39;is null&amp;#39; /&amp;gt;
&amp;lt;/or&amp;gt;
&amp;lt;/Item&amp;gt;
&amp;lt;/AML&amp;gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>