Database Values Plugin and Two Dimensional Filter Statistics

When using Database Values Plugin custom fields in the Two Dimensional Filter Statistics portlet, the link for "None" doesn't take to the correct query but to the las one used by the user.

Please see https://jira.atlassian.com/browse/JRA-13024

1 answer

This widget could not be displayed.

I just tested it and I can confirm it is an issue. Support for this is done through implementing the CustomFieldStattable interface. I have it currently like this:

public StatisticsMapper getStatisticsMapper(CustomField customField)
	{
		return new AbstractCustomFieldStatisticsMapper(customField)
		{
			@Override
			protected String getSearchValue(Object o)
			{
				if( o == null )
				{
					return null;
				}
				else
				{
					return ((IdAndString) o).getId();
				}
			}

			public Object getValueFromLuceneField(String id)
			{
				// Convert the primary key into something nice
				if( id != null )
				{
					String text = DatabaseValuesViewHelper.getViewHelper(customField).getTextForStatistics(id, getDescriptor().getI18nBean());
					return new IdAndString(id, text);
				}
				else
				{
					return null;
				}
			}

			@Override
			public Comparator getComparator()
			{
				return new Comparator()
				{
					public int compare(Object o1, Object o2)
					{
						if (o1 == null && o2 == null)
						{
							return 0;
						}
						else if (o1 == null)
						{
							return 1;
						}
						else if (o2 == null)
						{
							return -1;
						}
						return ((IdAndString) o1).getText().compareTo(((IdAndString) o2).getText());

					}
				};
			}
		};
	}

I don't know what I do wrong to support the 'none' hyperlink case?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

564 views 25 15
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you