<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=Updating_Base_Products</id>
	<title>Updating Base Products - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=Updating_Base_Products"/>
	<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Updating_Base_Products&amp;action=history"/>
	<updated>2026-05-15T15:16:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>http://in.compucrete.com/index.php?title=Updating_Base_Products&amp;diff=670&amp;oldid=prev</id>
		<title>WikiAdmin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Updating_Base_Products&amp;diff=670&amp;oldid=prev"/>
		<updated>2023-07-14T13:00:38Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:00, 14 July 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>WikiAdmin</name></author>
	</entry>
	<entry>
		<id>http://in.compucrete.com/index.php?title=Updating_Base_Products&amp;diff=669&amp;oldid=prev</id>
		<title>Intra&gt;Chanson: /* About Base Product */</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Updating_Base_Products&amp;diff=669&amp;oldid=prev"/>
		<updated>2020-09-29T13:59:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;About Base Product&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== About Base Product ==&lt;br /&gt;
The field Base_Product in ARTPROD, appears as Product Base in Product Maintenance.  Currently it's main use is to allow the dispatch system to transparently switch product codes between plants.  If Base_Product is not properly setup, then when a user ships a plant 2 product on a plant 1 order, the product will stay with the plant 1 product code.&lt;br /&gt;
&lt;br /&gt;
When properley setup, a base_product will include the product code, without the plant number and the plant separator character.  For example:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! Product Code&lt;br /&gt;
! Base Product&lt;br /&gt;
! Plant&lt;br /&gt;
! Comment&lt;br /&gt;
|- &lt;br /&gt;
| 3000-01&lt;br /&gt;
| 3000&lt;br /&gt;
| 01&lt;br /&gt;
| common 2 digit plant&lt;br /&gt;
|-&lt;br /&gt;
| 3000-02&lt;br /&gt;
| 3000&lt;br /&gt;
| 02&lt;br /&gt;
|-&lt;br /&gt;
| 30.1&lt;br /&gt;
| 30&lt;br /&gt;
| 1&lt;br /&gt;
| Single digit&lt;br /&gt;
|-&lt;br /&gt;
| 3034-021&lt;br /&gt;
| 3034&lt;br /&gt;
| 021&lt;br /&gt;
| Triple digit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Updating the Base Product Code==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This collection of queries is based on using the NOTES_1 field to temporarily store the new base product value.  Verify that the NOTES_1 field is available before proceeding.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Identify Mismatched BASE_PRODUCT codes:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select product_code,base_product,notes_1,plant_no,&lt;br /&gt;
 substr(product_code,strlen(product_code)-1,strlen(product_code)),&lt;br /&gt;
 description_1 from artprod&lt;br /&gt;
where base_product&amp;lt;&amp;gt;substr(product_code,1,strlen(product_code)-3)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Identify Products where the plant number doesn't match the product code.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select product_code,base_product,notes_1,plant_no,&lt;br /&gt;
 substr(product_code,strlen(product_code)-1,strlen(product_code)),&lt;br /&gt;
 active_flag from artprod&lt;br /&gt;
where plant_no&amp;lt;&amp;gt;substr(product_code,strlen(product_code)-1,strlen(product_code))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Identify null Plant numbers:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select substr(product_code,strlen(product_code)-1,strlen(product_code)),product_code,plant_No&lt;br /&gt;
 from artprod where plant_no is null&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update Plant Numbers if needed:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
update artprod&lt;br /&gt;
set plant_no=substr(product_code,strlen(product_code)-1,strlen(product_code))&lt;br /&gt;
 where plant_no is null and substr(product_code,strlen(product_code)-1,strlen(product_code)) between '00' and '99'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Update Products:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update artprod&lt;br /&gt;
set notes_1=substr(product_code,1,strlen(product_code)-3)&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code)-1,strlen(product_code))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Review the updated products&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select product_code,base_product,notes_1,plant_no,substr(product_code,strlen(product_code)-1,strlen(product_code)) from artprod&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code)-1,strlen(product_code))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check for duplicates:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
select notes_1,plant_no,count(*),mIN(product_code) First_Prod,max(product_code) Last_Prod from artprod&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code)-1,strlen(product_code)) AND NOTES_1 IS NOT NULL&lt;br /&gt;
group by notes_1,plant_no&lt;br /&gt;
having count(*)&amp;gt;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update the products&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
update artprod&lt;br /&gt;
set base_product=notes_1 where notes_1 is not null and notes_1&amp;lt;&amp;gt;''&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code)-1,strlen(product_code))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: You may need to clear old base products before updating.  Add the where clause if there are valid base products you want to keep:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
update artprod set base_product=null&lt;br /&gt;
where base_product&amp;lt;&amp;gt;substr(product_code,1,strlen(product_code)-3)&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Alternate Example - 1 Char Plant using NOTES_2 ==&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select product_code,base_product,notes_1,plant_no,&lt;br /&gt;
 substr(product_code,strlen(product_code),strlen(product_code)),&lt;br /&gt;
 description_1 from artprod&lt;br /&gt;
where base_product&amp;lt;&amp;gt;substr(product_code,1,strlen(product_code)-2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
select product_code,base_product,notes_1,plant_no,&lt;br /&gt;
 substr(product_code,strlen(product_code),strlen(product_code)),&lt;br /&gt;
 active_flag from artprod&lt;br /&gt;
where plant_no&amp;lt;&amp;gt;substr(product_code,strlen(product_code),strlen(product_code))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
update artprod&lt;br /&gt;
set notes_2=substr(product_code,1,strlen(product_code)-2)&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code),strlen(product_code))&lt;br /&gt;
&lt;br /&gt;
select product_code,base_product,notes_2,plant_no,substr(product_code,strlen(product_code)-1,strlen(product_code)) from artprod&lt;br /&gt;
where notes_2 is not null&lt;br /&gt;
&lt;br /&gt;
select notes_2,plant_no,count(*) from artprod&lt;br /&gt;
where plant_no=substr(product_code,strlen(product_code),strlen(product_code))&lt;br /&gt;
group by notes_2,plant_no&lt;br /&gt;
having count(*)&amp;gt;1&lt;br /&gt;
&lt;br /&gt;
update artprod set base_product=null&lt;br /&gt;
where base_product&amp;lt;&amp;gt;substr(product_code,1,strlen(product_code)-2)&lt;br /&gt;
&lt;br /&gt;
update artprod&lt;br /&gt;
set base_product=notes_2 where notes_2 is not null and notes_2&amp;lt;&amp;gt;'' and&lt;br /&gt;
 plant_no=substr(product_code,strlen(product_code),strlen(product_code))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==DataScope Product Review==&lt;br /&gt;
&lt;br /&gt;
Create a DataScope Report with this query:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select product_class,sales_gl,p.plant_no,base_product,p.active_flag,1 ct,product_code,description_1 prod_name,a.description acct_name,a.segment_2,c.description &amp;quot;Class Name&amp;quot;,LINK_PRICE_PRODUCT,&lt;br /&gt;
substr(product_code,strlen(product_code)-1,strlen(product_code)) &amp;quot;Prod Code Plant&amp;quot;,&lt;br /&gt;
substr(product_code,1,strlen(product_code)-3) &amp;quot;Prod Code Core&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 from artprod p&lt;br /&gt;
inner join gltacct a on a.gl_account=p.sales_gl&lt;br /&gt;
inner join artprcls c on c.class_no=p.product_class&lt;br /&gt;
where active_flag='Y'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recommended Field Layout&lt;br /&gt;
&lt;br /&gt;
Data:&lt;br /&gt;
*CT&lt;br /&gt;
&lt;br /&gt;
Rows:&lt;br /&gt;
*Product Class&lt;br /&gt;
*Class Name&lt;br /&gt;
*Base Product&lt;br /&gt;
*Product Code Core&lt;br /&gt;
&lt;br /&gt;
Columns:&lt;br /&gt;
*Plant&lt;br /&gt;
*Product Code Plant&lt;/div&gt;</summary>
		<author><name>Intra&gt;Chanson</name></author>
	</entry>
</feed>