Count Multi-user Field & Remove specific users
Asked by Denver Thomas:

____Counting

I have a multi-user field I need to the "length" of (the number of users)- field name "multiuser".

I've tried multiuser.asLength, asCount, AsSize, asArray.asLength, \[entry.multiuser.asLength\], \[entry.multiuser.asArray.asLength, asArrayMultiUserPicker.asLength, etc etc.

____Removing

I also want an action button that allows users to freely remove themselves from the multiuser field.

I've tried the following according to: [Virtual functions - Vertuna WIKI - ConfiForms](https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions)

multiuser=\[entry.multiuser\].remove(dthomas)

multiuser=\[entry.multiuser.remove(dthomas)\]


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Denver Thomas](/t5/user/viewprofilepage/user-id/5339478)

Simple example, hope it helps

Form configuration and the CardView as an example

![Screenshot 2023-10-12 at 18.29.29.png](https://community.atlassian.com/t5/image/serverpage/image-id/285991iB2F2FB8D94959AEE/image-size/large?v=v2&px=999 "Screenshot 2023-10-12 at 18.29.29.png")

Config for action button with action to perform set to

```
multiuser=[entry.multiuser.remove([entry._user]).asList]
```

![Screenshot 2023-10-12 at 18.29.42.png](https://community.atlassian.com/t5/image/serverpage/image-id/285990i094E192EB75CD3E3/image-size/large?v=v2&px=999 "Screenshot 2023-10-12 at 18.29.42.png")

Configuration to get number of multi-users in a field

![Screenshot 2023-10-12 at 18.29.49.png](https://community.atlassian.com/t5/image/serverpage/image-id/285989iA13A3B4551EE62F5/image-size/large?v=v2&px=999 "Screenshot 2023-10-12 at 18.29.49.png")

Complete configuration

```
<ac:structured-macro ac:macro-id="acea6f74-e9e8-4ffb-b5d6-4907d521be72" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="5502bbd7-50ce-45a3-8d87-7b03696cd06f" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="32b58ba7-2149-49c8-9914-d9678271b277" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">multiuser</ac:parameter>
<ac:parameter ac:name="fieldLabel">Multi user</ac:parameter>
<ac:parameter ac:name="type">multiuser</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="b9cc945b-203f-481f-919c-92697be42206" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">removeme</ac:parameter>
<ac:parameter ac:name="fieldLabel">Remove me</ac:parameter>
<ac:parameter ac:name="extras">multiuser=[entry.multiuser.remove([entry._user]).asList]</ac:parameter>
<ac:parameter ac:name="type">action_button</ac:parameter>
<ac:parameter ac:name="separator">OK, removed</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="04122f97-a5a2-4d39-adf6-8a5c4a6401e3" ac:name="confiform-card" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="6a06b0ce-26fa-4983-97a5-26c9d1532853" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">multiuser</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="2c7c1d4e-22ff-420c-a790-4bdb65996b83" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">multiuser.asCount</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="4fce2d4c-1bf1-4f2e-867c-93f4056bdc70" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">removeme</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
```

Alex

comments: author: Denver Thomas
body: Perfect. I could have sworn I'd tried multiuser.asCount, but perhaps not . . .   

Thank you, Alex!


Tags: confiforms

unknown-hosting-type