Syntax of component().selected?




  • Avatar

    If it is inside a component group, you will need to reference the parent too:


    Comment actions Permalink
  • Avatar

    I am still having some trouble evaluating component selection. For example, we have a component group named "docs", with a child component named "quickguide". Both are selected by default. We have an action on the final page to display the Quick Guide, but we only want this action if the quickguide component was selected.

            <progressText>View the Quick Guide</progressText>
                <componentTest logic="selected" name="${component(docs).component(quickguide).name}"/>

    When I ran the installer, I left the quickguide component selected and deselected the parent component group. On the final page, it still displayed the action. Is that correct? If I deselect the parent group, isn't that supposed to deselect all of the components in the group as it appears to?

    Jim Shawver
    BCC Software

    Comment actions Permalink
  • Avatar

    Unfortunately deselecting the entire component tree when the parent component is not selected is not supported. We would recommend you to use a custom rule that accepts a component chain as a parameter and recursively check they are selected. Please find below a snippet:

    <functionDefinitionList> <ruleDefinition name="isComponentChainSelected"> <parameterList> <stringParameter name="chain" default="" /> </parameterList> <actionList> <setInstallerVariable name="component_selected" value="0"/> <actionGroup> <actionList> <setInstallerVariable name="component_selected" value="1"/> <while> <actionList> <setInstallerVariableFromRegEx> <name>component</name> <pattern>^([^\.]+)(\.(.*)|)$</pattern> <substitution>\1</substitution> <text>${chain}</text> </setInstallerVariableFromRegEx> <setInstallerVariableFromRegEx> <name>chain</name> <pattern>^([^\.]+)(\.(.*)|)$</pattern> <substitution>\3</substitution> <text>${chain}</text> </setInstallerVariableFromRegEx> <setInstallerVariable> <name>component_selected</name> <value>0</value> <ruleList> <componentTest logic="not_selected" name="${component}"/> </ruleList> </setInstallerVariable> </actionList> <conditionRuleList> <regExMatch> <logic>matches</logic> <pattern>^([^\.]+)(\.(.*)|)$</pattern> <text>${chain}</text> </regExMatch> <isTrue value="${component_selected}"/> </conditionRuleList> </while> </actionList> <ruleList> <stringTest text="${chain}" type="not_empty"/> </ruleList> </actionGroup> </actionList> <ruleList> <isTrue value="${component_selected}"/> </ruleList> </ruleDefinition> </functionDefinitionList>

    Then using it in your code would be:

    <finalPageActionList> <launchBrowser> <url>file://${installdir}/QuickGuide/index.html</url> <progressText>View the Quick Guide</progressText> <run>0</run> <ruleList> <isComponentChainSelected name="docs.quickguide"/> </ruleList> </launchBrowser> </finalPageActionList>

    Comment actions Permalink

Please sign in to leave a comment.