Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confiforms filter compare two text fields

fbunting
Contributor
July 29, 2020

In Confiforms, I want to create a filter (in the TableView macro) to show all records where two text fields (text1 and text2) do not match.   

I've tried

  • !text1:text2
  • !text1:[text2]
  • !text1:[entry.text2]

This works when comparing numbers and dates ... but not strings.

2 answers

1 accepted

1 vote
Answer accepted
Alex Medved _ConfiForms_
Community Champion
July 30, 2020

The filtering expression would need to be something like this

!text1:[entry._func.asEntryRef(entry.text2)]
fbunting
Contributor
July 30, 2020

Wow.  I never would have found that ... but it works!

Thanks Alex!

fbunting
Contributor
July 30, 2020

Side note:  I notice that this comparison is case-independent.  If text1 is Foobar, and text2 is FooBar, it apparently sees them as the same.

3 votes
Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
July 30, 2020

Hi @fbunting

You can filter rows not equal to selected values with the help of the Table Filter macro of the Table Filter and Charts for Confluence app.

Wrap your table with Table Filter,
 switch to the Filters tab, select the dropdown filter column and add values (text1, text2) to it, then switch to the Filtration tab, click Select reversed filters, define the filter to operate in the reverse mode.

2020-07-30_18h45_01.png

Best regards,
Katerina

Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
July 30, 2020

 @fbunting,

I think I've got what you need, please try our Table Transformer macro in your case.

Wrap you rable with it and use the SQL query like this:

SELECT * FROM T1
WHERE T1.'COLUMN 1' <> T1.'COLUMN 2'

2020-07-30_19h04_23.png2020-07-30_19h04_35.png2020-07-30_19h04_42.png

Best regards,
Katerina

fbunting
Contributor
July 30, 2020

Thank you Katerina for your detailed answer! I was about to try the Table Filter macro ... because we have it, and it's great.  (I use it constantly.)

But in this case, I knew there was some magic filter incantation that I could throw right in the Confiforms TableView macro.

But I didn't know about the Table Transformer macro.  I'll have to check it out!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events