Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: How to get ParentCategoryID

  1. #1
    senad.meskin is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default How to get ParentCategoryID

    How can I get ParentCategoryID in order to create back link.

    Thanks in advance

  2. #2
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    What is your scenario?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  3. #3
    senad.meskin is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default when certain category to create back button

    I would like to create back button on page if parent category id = xx otherwise it won't be visible. So i need to check if parent category id is one number (e.g. 79) if it is show back button.

  4. #4
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    You can just adjust the query in the XMLPackage and then use an XLS If statement to do exactly what you are talking about.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  5. #5
    senad.meskin is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default

    Its executing procedure, really complex procedure, so what I need is just to get parent category id, then I will use if statement. So how can I get value of ParentCategoryID from this

    Code:
    <query name="ParentCategoryID" rowElementName="ParentCategoryID">
        <sql>
          <![CDATA[select ParentCategoryID from Category where CategoryID=@CatID]]>
        </sql>
        <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0" validationpattern="" />    
      </query>
    
      <PackageTransform>

  6. #6
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    I would put the package in debug mode and then find the XPath to the element you want and then define a xsl:variable so you can use it in the If...Then statement later on.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  7. #7
    senad.meskin is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default

    I thought so, there is no easy way like
    Code:
    <xsl:when test="$EntityID=19">

  8. #8
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    Sure you can do that, you just need to have a xsl:variable for EntityID and you're good to go.

    If you need help, send me your XMLPackage.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  9. #9
    senad.meskin is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default

    I have param entity id, and its id of current category, what I need is to get ParentCategoryID of that id.

    eg in db there is category with id 73, and its parent is 83.

    So what I need is to get that ParentCategoryID from db, or from anywhere ?

    So what I have to manage is to select ParentCategoryID from db using query
    Code:
    <query name="ParentCategory" rowElementName="ParentCategoryID">
        <sql>
          <![CDATA[select ParentCategoryID from Category where CategoryID=@CatID]]>
        </sql>
        <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0" validationpattern="" />    
      </query>
    How can I put returned query value into param
    Code:
    <xsl:param name="ParentCategoryID">
            xxxx//I don't knwo what to put here
    </xsl:param>

  10. #10
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    It seems you don't understand how an XSL works. The parameter is something that has to be passed in, so you can use xsl:call-template and xsl:with-param to populate the xslaram variables.

    If you aren't using a template with parameters then you need to use xsl:variable.

    Have a look at notification.receipt.xml.config and you'll see pretty clearly what is going on, and how to work with extra SQL statements like you're trying to do. Otherwise, I'll need to see the entire XSL document to be able to help you.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM