Tips and Tricks

Mingle Tips and Tricks

This is a public Custom Hive  publicRSS

Mingle Tip

    Matt Quagliana
    Selecting values from THIS CARD
    Mingle Tip posted July 15, 2009 by Matt Quagliana
    2392 Views, 6 Comment
    Tip Name:
    Selecting values from THIS CARD
    Tip Description:

    There are times when it would be handy to select values from THIS CARD. However, you can't simply execute {{value query:  SELECT Iteration FROM THIS CARD}}

     

    I've been thinking about this for a while and have arrived at a (somewhat roundabout) technique for querying values from the current card. The technique makes use of a property of type Card that points to itself. Here are the steps:

     

     

    1. Create a property called "Card" of type Card.
    2. For each card, set "Card" to itself. (See below).
    3. Now you can write a MQL query that interrogates the current card. For example, on a Story card you might have:

    {{value query: SELECT Iteration WHERE Card = THIS CARD}}

     

    This returns a link to the parent card.

     

    So... how do you set the value of the "Card" property? The easiest way is to do it in bulk via Excel:

     

    1. Export all relevant cards to Excel.
    2. Delete all columns except Number and Card.
    3. Copy the Number values into the Card column.
    4. Use "Format Cells" to apply the format "#"0 to the Card column.
    5. Import the Number and Card values back into Mingle. (This will update the existing cards.)

     

    Of course, the one catch here is that you have to set the value of "Card" for any new cards created. (Or rig an API tool that will do this automatically for every new card.)

     

    There are several applications for this, including

    • Write a query that returns THIS CARD's parent (see example above)
    • Write a query that displays hidden property values from the card.

    Comment

    • Matt Quagliana
      posted September 16, 2009 by Matt Quagliana

      The "Card" property is useful in other ways. I have it on every Iteration card, which makes it possible to automatically show Iteration Start Date and End Date on the overview as such:

      Current Iteration is: {{project-variable name: (Current Iteration)}}

      Start Date: {{value query: SELECT 'Start Date' WHERE Type = Iteration AND Card = (Current Iteration)}}

      End Date: {{value query: SELECT 'End Date' WHERE Type = Iteration AND Card = (Current Iteration)}} <br>

      Once this is in place you never need to update the dates on your Overview. Would also work for passing dates into charts. (Correction: charts require literal dates, not queries that return dates.)

    • Suzie Prince
      posted April 13, 2010 by Suzie Prince

      Hi all

      Mingle 3.1 now supports more THIS CARD functionality out of the box. Please check it out if you are interested in accessing values of card properties in MQL and macros.

      Thanks

      - Suzie

    • Matt Deniston
      posted July 14, 2010 by Matt Deniston

      Hi Suzie,

      I think I must be missing something... am trying basically do what Matt Quagliana was doing above with the 'Card' property using the enhanced support for THIS CARD in Mingle 3.1. The examples provided in the updated MQL and Macro Reference help pages do not help.

      On my project I've got a Release (e.g. Iteration) card, where I've already created a custom property called 'Release Start' for Release cards, and set a date value for it for the current card. This of course works:

             Release End: {{value query: SELECT 'Release End' WHERE Number = 2}}

      But I'd obviously like to remove the hard-coded Number reference, and replace with THIS CARD. Seems like this should be a pretty easy thing to do... but everything I've tried doesn't work. For example, these queries of course do not work:

             {{value query: SELECT 'Release Start' WHERE Number = THIS CARD}}

             {{value query: SELECT 'Release Start' WHERE Name = THIS CARD}}

             {{value query: SELECT 'Release Start' FROM THIS CARD}}

      Now if I create another new property called 'Card' and set it for each card (Matt Quagliana's trick), then this works:

             {{value query: SELECT 'Release Start' WHERE Card = THIS CARD}}

      But I really don't want to have to maintain this self referential property on all cards. From your post, I understood this wouldn't be necessary.

      Thanks for your help,

      -m

    • Suzie Prince
      posted July 14, 2010 by Suzie Prince

      Hey Matt

      Yes, you should be able to do this and I think the problem is that you have been unable to find the help that describes how to use THIS CARD in the way you need. I apologise if this is because it is not very well placed in the MQL help. We will take a look to see if that can be improved.

      The help you need to look at is here (http://www.thoughtworks-studios.com/mingle/3.1/help/mql_reference.html) and within that page you need to take a look at the section called "How to access values of properties on a card". This shows one way to get to the data you want:

      {{ value query: SELECT "start date" WHERE "start date" = THIS CARD."start date" }}

      An alternative would be:

      {{ value query: SELECT "start date" WHERE "name" = THIS CARD."name" }}

      I hope this helps. Please let us know.

      Thanks Suzie

    • Matt Quagliana
      posted July 14, 2010 by Matt Quagliana

      Using Mingle 3.1, use this to display any card property within that card's description:

      {{value query: SELECT <property name> WHERE Number = THIS CARD.Number}

      BTW... you can also now show info from a parent card on a child card. So on a task card you can show the status of the parent Story"

      Story Status {{value query: SELECT 'Story Status' WHERE NUMBER IN (THIS CARD.Story)}}

    • Matt Deniston
      posted July 14, 2010 by Matt Deniston

      You guys are great - thanks!

      -m