hideIfMatches filter in Confiforms
Asked by Aleks R:

Confiforms ***Hide controls when stored data (for given record) matches this criteria*** is not working as expected when trying to check security group combined with a check of record owners in *ownedBy*.

Using Confluence 8.5.4 and Confiforms 3.7.5.

Can you help [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ?

Setup {#toc-hId--384890542}
---------------------------

Simple table setup with two text fields:

![1.png](https://community.atlassian.com/t5/image/serverpage/image-id/306557i10848E373ABBBD75/image-size/large?v=v2&px=999 "1.png")

This is the code:

```
<ac:structured-macro ac:macro-id="0ad74c21-fb01-43df-817e-a3d58b9a9c94" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">table</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="a66db9fa-0cb3-4d60-993d-48539c1e2aea" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
<ac:parameter ac:name="fieldLabel">Name</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="12829e65-4b62-45a4-8fae-f633f0d6fc0f" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">sport</ac:parameter>
<ac:parameter ac:name="fieldLabel">Sport</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="eafa07b7-3810-41de-84ea-1021aba01401" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
```

Now add som sample data to the table:

![2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/306560iC44117D5439A77A9/image-size/large?v=v2&px=999 "2.PNG")

Now create a simple view with an *Edit Controls.*

![3.png](https://community.atlassian.com/t5/image/serverpage/image-id/306574iEAF0501572F7E549/image-size/large?v=v2&px=999 "3.png")

As you may have noticed the *edit controls* has the parameter *Hide controls when stored data (for given record) matches this criteria* set, with *Reverse criteria*checked:

![4.png](https://community.atlassian.com/t5/image/serverpage/image-id/306563i6CD72ED074FBFEF4/image-size/large?v=v2&px=999 "4.png")

These are the criteria used:

```
_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user]
```

We want the field only to be visible to members of *confluence-administrators* OR to record owners. ++This is working fine++. Only owners or administrators are able to see the edit controls. Administrators can see all edit controls. Record owners can edit their records.

This is the code for the view:

```
<ac:structured-macro ac:macro-id="fde06381-dd68-40d1-b908-af4bd531c99d" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="pageTitle">
<ac:link>
<ri:page ri:content-title="Hide controls when stored data matches... ? test"/>
</ac:link>
</ac:parameter>
<ac:parameter ac:name="formName">table</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="08818a04-2834-4a61-8fbe-90daa8b863f1" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
</ac:structured-macro>?<ac:structured-macro ac:macro-id="f80933aa-d4f7-490b-9513-8c79e0a8b1e7" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">sport</ac:parameter>
</ac:structured-macro>?</p>
<ac:structured-macro ac:macro-id="fadaf40f-b65a-41ff-bcfb-ad15039875de" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:parameter ac:name="showBoth">false</ac:parameter>
<ac:parameter ac:name="reverse">true</ac:parameter>
<ac:parameter ac:name="hideIfMatches">_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
```

So... what's not working? {#toc-hId-2102622291}
-----------------------------------------------

However, the above criteria, with *reverse criteria* checked should, the way I understand things, ++be the same as specifying the following criteria++

![5.png](https://community.atlassian.com/t5/image/serverpage/image-id/306566i1B364DBB04471E75/image-size/large?v=v2&px=999 "5.png")

Criteria:

```
!(_user.userInSecurityGroup(confluence-administrators):true OR ownedBy:[entry._user])
```

Logically, this means *if not either of these criteria are true, then hide the field in question*.

++This is not working.++

Why is this a problem? {#toc-hId-295167828}
-------------------------------------------

The above is not a problem for *edit controls* , because we an use *Reverse criteria.* However, for *EntryViewer*, there is no such option:

![6.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/306571iBBA505F853C2817B/image-size/large?v=v2&px=999 "6.PNG")

and we need to check if criteria are met using logical operators in the specified field, since we cannot negate using *Reverse criteria* when using *EntryViewer*.

Is there a way to achieve the desired check of both *owndBy* field and security group for *EntryViewer*?

Thanks for your help.


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Should not the criteria actually be something like
>
> ```
> _user.userInSecurityGroup(confluence-administrators):false AND !ownedBy:[entry._user]
> ```

meaning that when the use is not in "confluence-administrators" group and not is the owner of the record then .... hide

Alex

comments: author: Aleks R
body: That works. Thanks!


Tags: confiforms

confluence-data-center

data-center