JQL search to find issues with double labeling in camelcase

Benjamin Horst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2023

In one of our projects people worked with two labels that have different upper/losecase letters, but are equal otherwise (e.g. myLabel_1 , mylabel_1).

Now the trouble is that (for whatever reason) some people even added both labels to their issues.

I tried using

labels = myLabel_1 AND labels = mylabel_1

 and Jira (Server) even suggests both labels as different ones. But when the search runs, it does not take the "AND".

From what I found, Jira accepts camelcase as a label and in the auto-completion of the JQL, but neglects camelcase when searching.

Has anyone faced this and found a solution that can be done from the UI or REST API? Or can give me a hint? I am not very fond of messing around directly in the database.

 

3 answers

1 accepted

0 votes
Answer accepted
Benjamin Horst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2023

Thank  you for the answers. 

I adapted the answer of @Bert van Dijk _TMC_nl_ to the following, that I had already summarized in the comment to Bert. 

  • create a new temporary field
    • add it to the screens of the project
  • find all issues with one of the two labels set -> bulk change
  • bulk change the value of the temporary field or Component to the new labels value
  • delete the labels completly
  • find all issues with the temporary field set-> bulk change
  • bulk change all issues to one label
  • delete the temporary field

This worked ok, even though the handling of Labels in Jira (Server/DC at least) seems inconsistent to me.

1 vote
Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 4, 2023

Hi @Benjamin Horst

you should be able to export all your issues to CSV, and then write a script to detect the duplicate labels. Then, you might be able to use the bulk edit flow to clean up the data.

Alternatively, if you're open to solutions from the Atlassian Marketplace, I think you should get pretty close using the app that my team and I are working on, JXL for Jira.

JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a number of advanced features, including support for (configurable) issue hierarchiesissue grouping by any issue field(s), sum-ups, or conditional formatting - as well as the ability to filter issues via regular expressions

With regular-expression-based filtering, you can apply pretty much any logic, including the one that you are after:

regex-duplicate-labels.gif

(Note how the issues have labels pied-piper and Pied-Piper.)

The regex that I'm using is

(^|, )(?<label>[\w-]+)(, [\w-]+)*, \k<label>($|,)

There's a few things going on here, but TLDR, it checks if a certain label, captured as <label>, reoccurs somewhere in the field (via \k<label>).

You can also check for specific labels; say you want to check for multiple occurrences of myLabel_1, mylabel_1, etc., you could use

(^|, )mylabel_1(, [\w-]+)*, mylabel_1($|,)

(In both cases, just make sure that the Match case option is off.)

Once you've identified your issues, you can work on them directly in JXL (e.g., bulk edit them via copy/paste), or trigger various operations in Jira.

Since you've tagged your question for Jira Server: As you may have heard, apps sales have ended for Jira Server. Are you planning to migrate to Data Center or Cloud? I'd strongly recommend that. If you need some more time, JXL is perfectly compatible with Jira Server; it's just that we need to generate a license for you. If the above looks interesting, just let me know, and I'll happily start a free trial for you.

Hope this helps,

Best,

Hannes

Benjamin Horst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2023

Hello @Hannes Obweger - JXL for Jira , thanks for pointing the app out. But I wanted to do this one without using a new app. 

To your other question: we are currently migrating Confluence and will afterwards migrate Jira to the Cloud as well. 

As for the license: thank you for your offer, but we are fine. Looking at the Jira migration I seriously wish I had far less Apps installed in that instance :D.

1 vote
Bert van Dijk _TMC_nl_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2023

Hi @Benjamin Horst ,

This is a good reason for not using labels, but use an option field. This can be a custom field or for example the component field. You can use the "bulk edit" feature to migrate all values.

Benjamin Horst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2023

Hi @Bert van Dijk _TMC_nl_ ,

I am completly with you. I regularly recommend to no use labels in Jira at all, because using them is errorprone in comparison to your mentioned alternatives.

As for the bulk edit : I don't see how I can copy values from one field to the other in a bulk edit. So it would have to be:

  • create a new temporary field (or add a Component)
    • add it to the screens of the project
  • find all issues with one of the two labels set -> bulk change
  • bulk change the value of the temporary field or Component to the new labels value
  • delete the labels completly
  • find all issues with the temporary field set-> bulk change
  • bulk change all issues to one label
  • delete the temporary field

The users still want to use labels, so they could continue with that.

Did you mean something like this?

Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 5, 2023

Hi @Benjamin Horst

As for the bulk edit : I don't see how I can copy values from one field to the other in a bulk edit.

Just to put this out there, this would also be trivial to do using JXL for Jira; you can easily copy/paste any number of values from one column to another, and many of our customers use JXL exactly for data clean up activities like yours. You can also bulk copy/paste between JXL and e.g. Excel or Google Sheets, if this makes things easier:

copy-paste-storypoints-from-excel-to-jxl.gif

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events