cancel
Showing results for 
Search instead for 
Did you mean: 

Move data only to first product in the hierarchy below using data action in SAC

abeera11
Explorer
0 Kudos
201

I have a Product dimension which has 2 hierarchies, PL6 and PL7. The hierarchy is something like this. I want to move the data from hierarchy PL6 level to PL7 but only to the first product in PL7 hierarchy. I'm trying to do it with the below code using FOREACH. It is moving the data to all the products in the PL7. [p/SKUPL6] is the attribute which has the connection between PL7 AND PL6 hierarchies. Each product at PL7 level has this attribute SKUPL6 which has the value for PL6 under which it belongs to. I'm trying to use FOREACH to move data from PL6 for each iteration to PL7 and then delete the product if SKUPL6 = null.. As SKUPL6 only has values for PL7 products and for PL6 products this attribute is blank. The below code is copying data for all products below PL6 but not deleting PL6 value within the FOREACH. I'm trying to delete the PL6 value so it only copies the value for the first product and for the next product it will have no value in PL6 to copy below.

How can I achieve this?

abeera11_0-1727948440772.png

 

 

View Entire Topic
William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos

As you already have the connection of PL6 and PL7, I assume probably you don't need FOREACH loop at all. 

Maybe you can try something as below: 

CONFIG.HIERARCHY = [d/PRODUCT].[h/L7] 

MEMBERSET [d/PRODUCT].[p/SKUPL6] != " "

DATA() = RESULTLOOKUP([d/PRODUCT] = [d/PRODUCT].[p/SKUPL6] )

DELETE([d/PRODUCT] = [d/PRODUCT].[p/SKUPL6]) 

abeera11
Explorer
0 Kudos
But I only need to move data to the first product in the PL7 hierarchy below PL6 and not all products below PL6, that's why I was using FOREACH so it copies the value for the first product at PL7 level and for the next product the value gets deleted at PL6 level and there is no value to copy for rest of the products at PL7 level but the value is not being deleted with my code within FOREACH loop
abeera11
Explorer
0 Kudos
Thankyou for your response!
William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos
Not sure how you define 'first product in the PL7 ', if you only maintain property of your first product in PL7, then you should not get value to other products.