How to check if the Analysis System in WB contains a particular component?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 470
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited December 2022 in General Language Questions

How to check if the Analysis System in WB contains a particular component? For example check if Analysis System "example" contains "Results":

enter image description here

enter image description here

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 470
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    The System object has all the components in the Attribute Components. You can use the following code:

    # Get the relevant system
    system = GetAllSystems()[2]
    # Filter out the results component
    result_component = filter(lambda x: ("Results" in x.Name), system.Components)
    
    # If not present the list is empty
    if result_component:
        print("Yes the component is there!")
    else:
        print("Sorry the component is missing!")
    
  • James Derrick
    James Derrick Administrator, Employee Posts: 283
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    I don't fully understand your question. Would you mind elaborating a bit in it? E.g. It's not clear how the image relates to the example you give.

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 470
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    @James Derrick: Actually it is pretty straightforward. The rows in the analysis system are components. The question is to check if the analysis system contains a certain component for example the "Result" row. Modified some pictures, is it clear now?

  • James Derrick
    James Derrick Administrator, Employee Posts: 283
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    I was thinking less for me and more for potential future readers, if that makes sense?