Room booking system with ConfiForms - Prevent to create duplicate entries
Asked by Christian Englbrecht:

Hello everybody,

I try to create a room booking system with ConfiForms.

Everything works fine so far. But 2 Problems remain:

1. How can i prevent to create a entry in a timezone where a enties already exists?

2. Some rooms have 2 Workspaces, other rooms 4 or more Workspaces. How can I filter the dropdown automatically when the room is chosen? I know theres the option to create another Workspace Field with 4 places, but thats not optimal...

That's the current code:

```
<p><ac:structured-macro ac:name="deny_comment" ac:schema-version="1" ac:macro-id="1f1350c4-7ff4-45b8-869f-6db75945fcc0" /></p><ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="695cb8b9-b326-46ea-af4d-c1a3306feed3"><ac:parameter ac:name="hideAdminUI">true</ac:parameter><ac:parameter ac:name="formName">reservation</ac:parameter><ac:parameter ac:name="saveButtonLabel">Raum buchen</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="2602a9fa-730a-49cc-90a8-3e8d6a18d93b"><ac:parameter ac:name="fieldName">abteilung</ac:parameter><ac:parameter ac:name="fieldLabel">Abteilung</ac:parameter><ac:parameter ac:name="values">false[1=IT|2=Verwaltung|3=Technik|]</ac:parameter><ac:parameter ac:name="type">select</ac:parameter><ac:parameter ac:name="required">true</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="c4a5299a-7af4-4845-bb5d-651b0c682861"><ac:parameter ac:name="fieldName">time</ac:parameter><ac:parameter ac:name="fieldLabel">Datum:</ac:parameter><ac:parameter ac:name="type">datetimeinterval</ac:parameter><ac:parameter ac:name="required">true</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="70b72747-1a76-4176-bcc5-c9897853b459"><ac:parameter ac:name="fieldName">room</ac:parameter><ac:parameter ac:name="fieldLabel">Raum</ac:parameter><ac:parameter ac:name="values">false[1=B.4007|2=B.4008|3=B.4010|4=B.4011|5=B.4012|6=B.4013|7=B.4014|8=B.4015|9=B.4016|10=B.4017|11=B.4018|12=B.4021|13=B.4022|14=B.4023|15=B.4024|16=B.4025|17=B.4026|18=B.4026A|19=B.4027|20=B.4028|]</ac:parameter><ac:parameter ac:name="type">select</ac:parameter><ac:parameter ac:name="required">true</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="7ee361b6-a722-478c-92c7-800cae45dbd0"><ac:parameter ac:name="fieldName">arbeitsplatz</ac:parameter><ac:parameter ac:name="fieldLabel">Arbeitsplatz</ac:parameter><ac:parameter ac:name="values">false[1=AP-01|2=AP-02|]</ac:parameter><ac:parameter ac:name="type">select</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="2dfdd772-037f-43ec-8865-f6b6a1400e70"><ac:parameter ac:name="condition">!abteilung:[empty]</ac:parameter><ac:parameter ac:name="action">Validate uniqueness</ac:parameter><ac:parameter ac:name="actionFieldName">uniquecheck</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><p><br /></p><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" ac:macro-id="562380a7-5fa1-451c-9293-6f430d7b443d"><ac:parameter ac:name="hideMetadata">true</ac:parameter><ac:parameter ac:name="formName">reservation</ac:parameter><ac:parameter ac:name="type">Embedded</ac:parameter><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="ui-expand" ac:schema-version="1" ac:macro-id="c852288e-0915-46ff-ae3e-6a6f3d9dfb9c"><ac:parameter ac:name="title">Meine Buchungen</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" ac:macro-id="e2f987c9-69c9-48e6-9258-c2bd28e0ba3d"><ac:parameter ac:name="formName">reservation</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-edit" ac:schema-version="1" ac:macro-id="d9a16d99-a5e6-4f76-b4d6-9fcd4a130bfd"><ac:rich-text-body><br /></ac:rich-text-body></ac:structured-macro><p><br /></p></ac:rich-text-body></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-filter" ac:schema-version="1" ac:macro-id="44ded50e-9a3f-4fe1-a661-dc989d699cf7"><ac:parameter ac:name="filterFor">calendar</ac:parameter><ac:parameter ac:name="formName">reservation</ac:parameter><ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:macro-id="8906b3b0-3297-463c-94a1-85b42cb13b0d"><ac:parameter ac:name="fieldName">room</ac:parameter><ac:parameter ac:name="withLabel">true</ac:parameter></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-calendar" ac:schema-version="1" ac:macro-id="ba6b64f1-5d94-4104-8801-90d179a06281"><ac:parameter ac:name="eventTitleFieldName">[entry.room.room] [entry.arbeitsplatz.arbeitsplatz]</ac:parameter><ac:parameter ac:name="groupingFieldName">time</ac:parameter><ac:parameter ac:name="readonlyViewOnClick">true</ac:parameter><ac:parameter ac:name="formName">reservation</ac:parameter><ac:parameter ac:name="placement">Calendar only</ac:parameter><ac:parameter ac:name="viewMode">Week view</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-edit" ac:schema-version="1" ac:macro-id="81b2a287-6edc-4949-9d0c-46db4fad9360"><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro></ac:rich-text-body></ac:structured-macro><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p>


```


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Christian Englbrecht](/t5/user/viewprofilepage/user-id/5297366)

So basically, you want to ensure the date intervals dont overlap per room, right?

We do have an example on how to achieve that - <https://wiki.vertuna.com/display/CONFIFORMS/Using+CalendarView+with+date+time+intervals+with+custom+validation+for+intervals>

All you need to do is to add the "room" into the expression

```
(room:[entry.room] AND time.startDate:<[entry.time.endDate] AND time.endDate:>[entry.time.startDate] AND !id:[entry.id])
```

Regarding the #2 - where do you have that "knowledge"? I mean, how to understand which room has 2 and which has 4 workspaces?

Alex

comments: author: Christian Englbrecht
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ,

I don't know in which Macro i have to put the code in. Can you please tell me?

Regarding #2: Thats the problem. I know, which room hast 2 or 3 or 4 workspaces. But how can i let confiforms know that?

thank you!


author: Alex Medved _ConfiForms_
body: Validation rule <https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validationrule>


author: Valerie Knapp
body: Hi [@Christian Englbrecht](/t5/user/viewprofilepage/user-id/5297366) , thanks for your question.

Have you checked the documentation or reached out to the vendor directly? They are normally best placed to help with questions like this.

<https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+app+for+creating+forms+in+Confluence>

[https://marketplace.atlassian.com/apps/1211860/confiforms-data-forms-workflows-for-confluence?hosting=datacenter\&tab=support](https://marketplace.atlassian.com/apps/1211860/confiforms-data-forms-workflows-for-confluence?hosting=datacenter&tab=support)


Tags: confiforms

confluence-data-center

data-center