cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

OIR: Folder selection according to Variant Specification attributes

N-Pyn
13-Aquamarine

OIR: Folder selection according to Variant Specification attributes

Hello,

I'm trying to create an OIR which directs Variant Specifications generated from different configurable products to their corresponding folders.


Example:

I have configurable products "Product 1", "Product 2" and "Product 3"  and each one of them has a different option set assigned to them.


When I create a new variant specification from Product 1, I want it to go to folder Default/Product 1, and when I create a variant spec from Product 2, I want it to go to Default/Product 2 and so on.


I think I could use either the variantSpecOptionSet or genericPartName attributes of the variant specification for identifying which product the variant specification relates, but I can't get the rule to work.


Here is a sample of the OIR I made and which doesn't work:

 

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">

    <!-- Check the option set used in creating the variant specification and select the default folder accordingly -->
    <Value algorithm="wt.rule.algorithm.CaseBranch">

        <!-- Case: "Product 1" -->
        <Value algorithm="wt.rule.algorithm.StringEqualsTest">

            <!-- Get substring of 9 first characters of the name of the option set used in creating the variant specification -->
            <Value algorithm="wt.rule.algorithm.Substring">
                    <Attr id="variantSpecOptionSet"/>
                    <Arg>0</Arg>
                    <Arg>9</Arg>
            </Value>

            <!-- Compare the characters to "Product 1" string -->
            <Arg>Product 1</Arg>
        </Value>

        <!-- If the strings match, use this folder as the default folder -->
        <Arg>/Default/Product 1</Arg>

        <!-- Case: "Product 2" -->
        <Value algorithm="wt.rule.algorithm.StringEqualsTest">

            <!-- Get substring of 9 first characters of the name of the option set used in creating the variant specification -->
            <Value algorithm="wt.rule.algorithm.Substring">
                    <Attr id="variantSpecOptionSet"/>
                    <Arg>0</Arg>
                    <Arg>9</Arg>
            </Value>

            <!-- Compare the characters to "Product 2" string -->
            <Arg>Product 2</Arg>
        </Value>

        <!-- If the strings match, use this folder as the default folder -->
        <Arg>/Default/Product 2</Arg>

        <!-- Case: "Product 3" -->
        <Value algorithm="wt.rule.algorithm.StringEqualsTest">

            <!-- Get substring of 9 first characters of the name of the option set used in creating the variant specification -->
            <Value algorithm="wt.rule.algorithm.Substring">
                    <Attr id="variantSpecOptionSet"/>
                    <Arg>0</Arg>
                    <Arg>9</Arg>
            </Value>

            <!-- Compare the characters to "Product 3" string -->
            <Arg>Product 3</Arg>
        </Value>

        <!-- If the strings match, use this folder as the default folder -->
        <Arg>/Default/Product 3</Arg>

        <!-- If none of the previous conditions are met, use this folder as default folder -->
        <Arg>/Default</Arg>

    </Value>

</AttrValue>

 
I'm using Substring algorithm because in my real case I need to compare only the few first characters of the option set name.

 

I tried the same also with genericPartName attribute which should give me the number (or name?) of the configurable product from which the variant specification was created but that didn't work either.

I also tried to convert the attribute values to strings even though Type and Attribute management says that both of the attributes should already be strings.

 

Does anyone know what is wrong with this OIR?

 

I think the problem might be that the values of the variantSpecOptionSet and genericPartName attributes are formatted in some strange way.

 

How can I check the values of these attributes in some existing variant specification? The attributes are shown in the General section of the variant specification Details page, but they are shown as object links instead of strings so they don't really tell me anything about the value returned from <Attr id='X'>.

0 REPLIES 0
Top Tags