Topic
  • 4 replies
  • Latest Post - ‏2012-12-06T17:12:57Z by SystemAdmin
briangDRS
briangDRS
5 Posts

Pinned topic Setting Iteration Conditions - Q Language

‏2010-05-13T16:02:15Z |
All,

What I want to do is iterate through a set of classes and generate one set of text for classes that are stereotyped (for the sake of this discussion, let's call the stereotype name "Stereotype") and to generate another set of text for the classes that are not stereotyped.

I have an idea what my Q-language script should look like but I am still getting a Syntax Error. Can someone please explain how I should structure my script? I know it's not difficult but I'm missing something fundamental. Thanks.
Updated on 2012-12-06T17:12:57Z at 2012-12-06T17:12:57Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1305 Posts

    Re: Setting Iteration Conditions - Q Language

    ‏2010-05-18T10:29:26Z  
    Hello,

    so, on the Class iteration, you add an expression:

    if $name of stereotype = "stereotype" then "the text you want to display" else ""

    You can also check the 'Use alternate text' when inserting the expression, and this will remove the <<no model data>> insert
    Regards,

    A
  • SystemAdmin
    SystemAdmin
    1305 Posts

    Re: Setting Iteration Conditions - Q Language

    ‏2012-12-05T13:43:41Z  
    I have another question on iteration condition syntax.

    What I would like to do is only print certain packages...not ones named "xx" and "yy".

    What would the Q language condition look like in this case?

    "print all packages who's names are NOT "xx" or "yy""

    Please help.

    Thanks.
  • SystemAdmin
    SystemAdmin
    1305 Posts

    Re: Setting Iteration Conditions - Q Language

    ‏2012-12-06T17:10:29Z  
    I have another question on iteration condition syntax.

    What I would like to do is only print certain packages...not ones named "xx" and "yy".

    What would the Q language condition look like in this case?

    "print all packages who's names are NOT "xx" or "yy""

    Please help.

    Thanks.
    Hi,
    so I test this by right-clicking in the template window (bottom left),
    Add New item and set the Iteration to Class, this generates a list of all elements

    On the condition tab,I put the following:

    $name "xx" and $name "yy"

    The is not equals but the 'and', it's rather unusual but it seems to work.

    Andreas
  • SystemAdmin
    SystemAdmin
    1305 Posts

    Re: Setting Iteration Conditions - Q Language

    ‏2012-12-06T17:12:57Z  
    Hi,
    so I test this by right-clicking in the template window (bottom left),
    Add New item and set the Iteration to Class, this generates a list of all elements

    On the condition tab,I put the following:

    $name "xx" and $name "yy"

    The is not equals but the 'and', it's rather unusual but it seems to work.

    Andreas
    The carrots didn't come through the editor here.
    See image attached

    Attachments