TFS query to get Work Items created by a few users - tfs

I want to create a TFS query to show all the Work Items of type "Issue" & "Requirement" created by person "A" & "B".
I have the below query but it doesn't give me the expected results:
Can someone please tell me what changes I need to make?

Change the Created By clauses to "Or" and grouping them together. That should give you your expected results. Like this:

Found the answer here
https://msdn.microsoft.com/en-us/library/ms181360(v=vs.90).aspx
Thank you !
Adding details as suggested in the comments by #ios82
The main thing I had to do was to use the "grouped clauses" as described in the link above.
You do that by selecting the parameters you want to group by, right clicking and selecting the option of "Group Clauses". Screenshot below.
In my case I grouped both the "work item type" clauses together & the "created by". clauses together.
Also, the Condition on the CreatedBy (B) Should be changed to "OR" instead of "AND". That did it !!

Related

Results of running two subqueries do not add up to the number of results when running the main query

I am running a JQL query to count how many issues have an empty value for the "Components" field versus how many issues have a non empty value for the "Components" field.
Here is the screenshot that I get for my 1st JQL query: category = "Cloud Services" and component is empty, the number of results is 6631:
Checking for null is equivalent to checling for empty, I have tried it and it returns the same.
Here is the screenshot for my 2nd JQL query: category = "Cloud Services" and component is not empty
The thing that confuses me is that I get 6631 results for my first query and I get 51372 results for my second result so 51372 +6631 = 58003
However, when I try to retrieve all the issues belonging to the Cloud Services category with this query: category = "Cloud Services", I get the following: I get 64879 as a result which does not match 51372 +6631 = 58003 computed above. Anyone knows why? Normally, the total number should correspond to the result of the 3rd screenshot since every issue contains components.
this only means, you have in the project more than 1 component, that is why the adds dont match.
with the REST api you can verify howmany and which components you have:
https://<host>/rest/api/latest/project/<project_id>/components
Could also be that one of the projects has a field configuration with the Components field hidden?

How to alternate queries from drop down menu in Google Sheets

Hello Help Community,
I am trying to find a way to alternate queries from drop down menus. The idea is to be able to move between a list of queries and not have to rewrite the query when I want to use it again. I saw this done by writing the select statement in a drop down and referencing the cell containing the select statement in the query like this:
=QUERY(range, "" """"""&cell&"""""" "")
However, I cannot get this method to work. I can manipulate the same query using cell references and drop down menus but I would like to do more if it is possible.
Any idea how this could be achieved would be appreciated.
Regards, Andrew H"
example:
=QUERY(A2:D5, "where A = '"&B8&"'", 1)
if dropdown contains numbers use:
=QUERY(A2:D5, "where A = "&B8, 1)

How to concatenate three columns into one and obtain count of unique entries among them using Cypher neo4j?

I can query using Cypher in Neo4j from the Panama database the countries of three types of identity holders (I define that term) namely Entities (companies), officers (shareholders) and Intermediaries (middle companies) as three attributes/columns. Each column has single or double entries separated by colon (eg: British Virgin Islands;Russia). We want to concatenate the countries in these columns into a unique set of countries and hence obtain the count of the number of countries as new attribute.
For this, I tried the following code from my understanding of Cypher:
MATCH (BEZ2:Officer)-[:SHAREHOLDER_OF]->(BEZ1:Entity),(BEZ3:Intermediary)-[:INTERMEDIARY_OF]->(BEZ1:Entity)
WHERE BEZ1.address CONTAINS "Belize" AND
NOT ((BEZ1.countries="Belize" AND BEZ2.countries="Belize" AND BEZ3.countries="Belize") OR
(BEZ1.status IN ["Inactivated", "Dissolved shelf company", "Dissolved", "Discontinued", "Struck / Defunct / Deregistered", "Dead"]))
SET BEZ4.countries= (BEZ1.countries+","+BEZ2.countries+","+BEZ3.countries)
RETURN BEZ3.countries AS IntermediaryCountries, BEZ3.name AS
Intermediaryname, BEZ2.countries AS OfficerCountries , BEZ2.name AS
Officername, BEZ1.countries as EntityCountries, BEZ1.name AS Companyname,
BEZ1.address AS CompanyAddress,DISTINCT count(BEZ4.countries) AS NoofConnections
The relevant part is the SET statement in the 7th line and the DISTINCT count in the last line. The code shows error which makes no sense to me: Invalid input 'u': expected 'n/N'. I guess it means to use COLLECT probably but we tried that as well and it shows the error vice-versa'd between 'u' and 'n'. Please help us obtain the output that we want, it makes our job hell lot easy. Thanks in advance!
EDIT: Considering I didn't define variable as suggested by #Cybersam, I tried the command CREATE as following but it shows the error "Invalid input 'R':" for the command RETURN. This is unfathomable for me. Help really needed, thank you.
CODE 2:
MATCH (BEZ2:Officer)-[:SHAREHOLDER_OF]->(BEZ1:Entity),(BEZ3:Intermediary)-
[:INTERMEDIARY_OF]->(BEZ1:Entity)
WHERE BEZ1.address CONTAINS "Belize" AND
NOT ((BEZ1.countries="Belize" AND BEZ2.countries="Belize" AND
BEZ3.countries="Belize") OR
(BEZ1.status IN ["Inactivated", "Dissolved shelf company", "Dissolved",
"Discontinued", "Struck / Defunct / Deregistered", "Dead"]))
CREATE (p:Connections{countries:
split((BEZ1.countries+";"+BEZ2.countries+";"+BEZ3.countries),";")
RETURN BEZ3.countries AS IntermediaryCountries, BEZ3.name AS
Intermediaryname, BEZ2.countries AS OfficerCountries , BEZ2.name AS
Officername, BEZ1.countries as EntityCountries, BEZ1.name AS Companyname,
BEZ1.address AS CompanyAddress, AS TOTAL, collect (DISTINCT
COUNT(p.countries)) AS NumberofConnections
Lines 8 and 9 are the ones new and to be in examination.
First Query
You never defined the identifier BEZ4, so you cannot set a property on it.
Second Query (which should have been posted in a separate question):
You have several typos and a syntax error.
This query should not get an error (but you will have to determine if it does what you want):
MATCH (BEZ2:Officer)-[:SHAREHOLDER_OF]->(BEZ1:Entity),(BEZ3:Intermediary)- [:INTERMEDIARY_OF]->(BEZ1:Entity)
WHERE BEZ1.address CONTAINS "Belize" AND NOT ((BEZ1.countries="Belize" AND BEZ2.countries="Belize" AND BEZ3.countries="Belize") OR (BEZ1.status IN ["Inactivated", "Dissolved shelf company", "Dissolved", "Discontinued", "Struck / Defunct / Deregistered", "Dead"]))
CREATE (p:Connections {countries: split((BEZ1.countries+";"+BEZ2.countries+";"+BEZ3.countries), ";")})
RETURN BEZ3.countries AS IntermediaryCountries,
BEZ3.name AS Intermediaryname,
BEZ2.countries AS OfficerCountries ,
BEZ2.name AS Officername,
BEZ1.countries as EntityCountries,
BEZ1.name AS Companyname,
BEZ1.address AS CompanyAddress,
SIZE(p.countries) AS NumberofConnections;
Problems with the original:
The CREATE clause was missing a closing } and also a closing ).
The RETURN clause had a dangling AS TOTAL term.
collect (DISTINCT COUNT(p.countries)) was attempting to perform nested aggregation, which is not supported. In any case, even if it had worked, it probably would not have returned what you wanted. I suspect that you actually wanted the size of the p.countries collection, so that is what I used in my query.

Having trouble with my NVL function

So I followed the directions that I was given to me in my live lecture word for word and also researched this in my textbook and I've done everything (So I think) properly but I keep getting a error Which I have looked up to see what it means and it didn't help me at all and I've been working on it for a whole day so I'm reaching out to you guys to see if you can see my mistake anywheres in my code
This is the question that I am trying to complete:
Using the BOOK_CUSTOMER table and the NVL function, create a query that will return a list containing the customer number, first name, last name, and the characters ‘NOT REFERRED’ if the customer was not referred by another customer. Give the derived column an alias of REFERRED BY. Do not list any customers that were referred by another customer.
MY CODE =
SELECT CutomerID, FirstName, LastName,
NVL(TO_CHAR(Referred), 'Not Referred'))
FROM Book_Customer;
I also realize that I haven't completed the whole question. I'm just trying to get my NVL to work first and then go onto the Alias and the last part of the question because I do not know how to do either of those yet, any tips on that would be greatly appreciated as well
There's an extra (unmatched) closing paren in your SQL text, and that's going to throw a syntax error.
NVL(TO_CHAR(Referred), 'Not Referred'))
^
There's no matching opening paren for that last paren.
To assign an alias to an expression in the SELECT list, follow the expression with the keyword AS and an alias.
SELECT t.foo AS bar
The resultset will contain a column named bar.
SELECT b.CustomerID
, b.FirstName
, b.LastName
, NVL(TO_CHAR(b.Referred),'Not Referred') AS ReferredBy
FROM Book_Customer b
WHERE b.Referred IS NULL
I finally figured it out! The proper code was:
SELECT CustomerID, FirstName, LastName,
NVL(TO_CHAR(Referred), 'Not Referred') AS "Referred By"
FROM Book_Customer
WHERE Referred IS NULL;
Thank you everyone for all your helpful comments that helped me figure out this problem.

How to find issues that at some point has been assigned to you?

We use Jira extensively in our project, but I often have a hard time finding issues, that I know, I have been working on earlier. Usually, if some case is reported, that seems familiar to something I have been working on in the past, but I don't remember exactly what and when.
Usually, an issue is reported, then our scrum master assigns it to the developer, the developer fixes it (hopefully) and then passes it to the tester (yay, it works!). But then it is no longer assigned to me, and I have a hard finding old issues, that I remember vaguely.
I thought, perhaps it is possible to see the assigned history of an issue, there might be a way to form an advanced search/filter, that finds all issues, that at some time has been assigned to me.
Has anyone done this?
This is meanwhile possible by means of the JIRA Query Language (JQL) operator 'WAS', which has been introduced in JIRA 4.3 and extended in JIRA 4.4 to cover assignees and reporters as well, for example:
project = "Angry Nerds" and (assignee was 'johnsmith' or reporter was 'johnsmith')
General-purpose query for whichever 'current user':
assignee was currentUser()
This filter can be conveniently shared & anybody can put it on their dashboard, etc and it will return results specific to them.. Not supported on all old JIRA versions though.
This was my most-requested JIRA feature ever.
Check out JIRA Toolkit plugin - Participants custom field
https://studio.plugins.atlassian.com/wiki/display/JTOOL/JIRA+Toolkit+Plugin
This field allows you to easily track issues that you've "participated in". These are defined to be any issues you've commented on, raised or are the current assignee. See also the [JIRA Extended Participants] plugin.
Update
This works without plugins:
assignee was currentUser() OR reporter was currentUser() ORDER BY updated DESC
The original answer
This query worked for me:
Participants = currentUser()
try "assignee was username". it would get all tickets been assigned to the user before.
You can find issues by worklog entries directly in the database:
select distinct ji.pkey from jiraissue ji inner join worklog wl on ji.id=wl.issueid where wl.author='some_username';
I agree this should be implemented in the UI though.
For those that will be using JIRA 5+, there is also CHANGED operator that looks at the field changing to specific value within specific time range.
assignee CHANGED TO currentUser() AFTER startOfYear() BEFORE now()
More here: https://confluence.atlassian.com/display/JIRA052/Advanced+Searching#AdvancedSearching-CHANGED
Just another way how to achieve the same result, but might be useful for other cases.
was is not supported to assignee field when I tried recently. You must use CHANGED, FROM, TO keywords to filter.
I'm using something like this:
project = MindBlowingProject AND (assignee in (currentUser()) OR assignee CHANGED from (currentUser()) OR reporter in (currentUser())) ORDER BY updated DESC
So there are 3 scenarios:
1 - I changed it in some way - assignee changed by [UserName],
2 - I changed the status ( closed it, whatever) - OR status changed by [UserName],
3 - I still have it - OR assignee = [UserName]
So the whole query (assuming that the changed statement is allowed is:
assignee changed by [UserName] OR status changed by [UserName] OR assignee = [UserName]
I think the most sensible approach is to search the issue-history. The only thing, that is not logged there, is who accessed the issue (just watching, without changing anything).
But you can't search the ticket-history without database access (as far as I know, please correct me if I'm wrong)
So, to search all issues with "someUserName" in the issuehistory, you have to inner join the table changegroup (and maybe the table changeitem from there).
Example:
select ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.id as histid,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'someUserName';
c.id as histid ==> this is the number/id of the entry in the (issue-)"History" tab
Meaning: if there ever was a change by the user "someUserName" it is logged in the History and it will be listet with this query
The following example will just list every disting issue, where the "myusername" was found in the History after the date 20180501:
select distinct ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'myusername' and ji.created > '2018-05-01T00:00:00.000';
I annotated the necessary relation here:
From menu select Tempo->Reports
Select date-range
and you should see report.
I tried the below SQL query and it gives data of all the issues and all the assignees that were ever assigned to an issue. Any change in the assignee for any issue is captured by below query:
select distinct
p.pkey +'-'+cast(ji.issuenum as varchar(max)),
ji.SUMMARY,
cast(ci.OLDSTRING as nvarchar(max)) as 'Old value',
cast(ci.NEWSTRING as nvarchar(max)) as 'New value'
from
jiraissue ji
join project p on p.id = ji.PROJECT
join changegroup cg on cg.issueid = ji.id
join changeitem ci on ci.groupid = cg.id and FIELD = 'assignee'
Anyone looking for the query would find this useful : )
-Neha 'D' Pal

Resources