Component Selection

Answered

Comments

7 comments

  • Avatar
    alejandror

    You could create an empty component that would be always enabled but hidden, so its componentSelectionValidationActionList is always executed and throws an error if none of the required components was selected:

    <component>
        <name>components_selected_check</name>
        <show>0</show>
        <canBeEdited>0</canBeEdited>
        <componentSelectionValidationActionList>
            <throwError>
                <text>You should select at least one of the components componentA or componentB</text>
                <ruleList>
                    <componentTest name="componentA" logic="not_selected"/>
                    <componentTest name="componentB" logic="not_selected"/>
                </ruleList>
            </throwError>
        </componentSelectionValidationActionList>
    </component>
    

    Would that work for you?

    0
    Comment actions Permalink
  • Avatar
    MarkSDM

    Perfect, thank you! :)

    0
    Comment actions Permalink
  • Avatar
    Ashok Mazumder

    This does not work for component group. I was trying to create a logic where at least one component should be selected from each component group.

    How to handle this scenario?

    0
    Comment actions Permalink
  • Avatar
    BitRock support

    Hi Ashok,

    Could you try the following?

     

    ${project.component(groupName).component(componentName).selected}" logic="equals" value2="0">

    Best regards,

    Michiel

    0
    Comment actions Permalink
  • Avatar
    Ashok Mazumder

    Hi Michiel,

       I appreciate your quick response. I am new to InstallBuilder so I could not follow your instruction. It would be great if you could guide me with a  small example.

    Also I would like to know if you have any reference document (on top of user guide) to write logic. I am struggling to write different types of conditional logic.

    Regards,

    Ashok

    0
    Comment actions Permalink
  • Avatar
    BitRock support

    Hi Ashok,

    Please accept my apologies for giving an incomplete example. Here's a complete one:

     <componentList>
    <componentGroup>
    <name>componentGroup</name>
    <description>Component Group</description>
    <componentList>
    <component>
    <name>componentA</name>
    <description>Component A</description>
    </component>
    <component>
    <name>componentB</name>
    <description>Component B</description>
    </component>
    </componentList>
    </componentGroup>
    <component>
    <name>components_selected_check</name>
    <show>0</show>
    <canBeEdited>0</canBeEdited>
    <componentSelectionValidationActionList>
    <throwError>
    <text>You should select at least one of the components componentA or componentB</text>
    <ruleList>
    <compareValues value1="${project.component(componentGroup).component(componentA).selected}" logic="equals" value2="0"></compareValues>
    <compareValues value1="${project.component(componentGroup).component(componentB).selected}" logic="equals" value2="0"></compareValues>
    </ruleList>
    </throwError>
    </componentSelectionValidationActionList>
    </component>
    </componentList>

    Could you also try with the componentTest? It should also work with groups.

    You can find more information about rules in the following section of our manual:

    https://installbuilder.bitrock.com/docs/installbuilder-userguide.html#_rules

    Regards,


    Michiel

     

    0
    Comment actions Permalink
  • Avatar
    Ashok Mazumder

    Yes Michiel, I was able to achieve both ways.

    0
    Comment actions Permalink

Please sign in to leave a comment.