Original Message:
Sent: 11-22-2023 02:28
From: Brian Zupke
Subject: Change notification help
Ryan,
Instead of populating CN_Target_Value_Source_SQL and its associated fields, change the CN_Target_SQL to produce a result set where the first column is the InternalRecordId of the records that need to be updated and the subsequent columns are the attribute names (not restricted names) of each attribute in that target record to be updated (along with the value). You can update as many attributes in the same record as you wish and update as many records as you wish. I'll leave it to you to figure out the SQL that will combine those InternalRecordIds with the appropriate values, but here is a simple example:
Let's suppose there are three repositories: Product and Item, and Size where each Product record will have one or more Item records linked to it through the Product ID attribute, and each Item record has one or more Size records linked to it through the Item ID attribute. For some reason, the Size repository has the attribute "Size Class" which is the concatenation of the Product's "Taxonomy" value and the Item's "Item Class" value and the Size's "Size" value.. Any time the Product record's Taxonomy is changed, the Sizes for the linked Items need to have their Size Class attribute updated. The SQL would be something like the following (please note this SQL was not tested for syntax errors):
SELECT s.InternalRecordId, p.Taxonomy + '.' + i.Item_Class + '.' + s.Size as [Size Class]
FROM Product_Staging p
JOIN Item_Staging i on i.Product_ID = p.Product_ID
JOIN Size_Staging s on s.Item_ID = i.Item_ID
WHERE p.InternalRecord = ||InternalRecordId||
This would be defined in a CN_Transformation_Registry record linked to a CN_Registry record on the Product_Staging repository. A similar rule would also be needed on the Item_Staging repository for when the Item Class is changed. The CN_Target_SQL would have the same joins, but the WHERE clause would be:
WHERE i.InternalRecordId = ||InternalRecordId||
------------------------------
Brian Zupke
Precisely Software Inc.
Original Message:
Sent: 11-21-2023 18:47
From: Ryan Hayes
Subject: Change notification help
Hello All,
I'm looking for some help with a change notification that combines Vendor Style (item repo) with Vendor SKU (SKU repo) to create a new Vendor Item Name (SKU repo). If the Vendor Style in Item repo is changed, then it needs to trigger and update the Vendor Item Name on all of the SKU records for that item. But if the Vendor SKU in the SKU repo is changed, it only needs to update the Vendor Item Name for that one particular SKU.
I'm new to change notifications, but if I understand it right I need one cn registry that triggers on Vendor Style in Item with a transformation that will update Vendor Item Name for all SKUs. And I need a cn registry that triggers on Vendor SKU with a transformation that will update just that one SKU.
So far I have the CN registry and transformation at the SKU level working. If the Vendor SKU is changed, it will update the Vendor Item Name for just that SKU with the new correct Vendor Item Name value of Vendor Style + Vendor SKU.
What I can't figure out is the one to many change to update all of the SKUs when Vendor Style at the Item level is changed. Right now it's updating all of the SKUs with the same data. It's pulling in the correct Vendor Style from Item, but then where it should add the different Vendor SKU for each SKU, it's just using the first Vendor SKU for all. I guess it's pulling the target value for just the first row and then applying that to all rows for that item.
For my CN Registry I have it triggering in my Item_Staging repo and the attribute as Vendor Style.
Here is what I have set up for the transformation rule since I'm assuming that's where I'm going wrong.
CN_Target_Repo
SKU_Staging
CN_Target_Attribute_Name
Vendor Item Name
CN_Target_SQL
SELECT InternalRecordIdFROM SKU_Staging WHERE Item_Number = ||Item Number||
CN_Target_Value_Source_SQL
SELECT LEFT(LTRIM(RTRIM(CONCAT(ISNULL(i.Vendor_Style,''), ' ', ISNULL(s.Vendor_SKU,'')))), 20) AS Vendor_Item_NameFROM Item_Staging iINNER JOIN SKU_Staging s ON i.item_number = s.item_numberWHERE s.Item_Number = ||Item Number||
CN_Target_Value_Source_Restricted_Name
Vendor_Item_Name
CN_Condition_Repo
SKU_Staging
CN_Condition_SQL
SELECT ISNULL(Vendor_Item_Name,'') AS Vendor_Item_Name FROM SKU_Staging WHERE Item_Number = ||Item Number||
CN_Condtion_Attribute_Restricted_Name
Vendor_Item_Name
CN_Condition_Operator
<>
CN_Condtion_Data_Type
Text
CN_Condition_Value_SQL
SELECT LEFT(LTRIM(RTRIM(CONCAT(ISNULL(i.Vendor_Style,''), ' ', ISNULL(s.Vendor_SKU,'')))), 20) AS Vendor_Item_NameFROM Item_Staging iINNER JOIN SKU_Staging s ON i.item_number = s.item_numberWHERE s.Item_Number = ||Item Number||
CN_Condition_Value_Retricted_Name
Vendor_Item_Name
Thanks!
------------------------------
Ryan Hayes
Sundance Catalog Co
UT
------------------------------