
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:
{{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:
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
Comment
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.)
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
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
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
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)}}
You guys are great - thanks!
-m