Forums

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

Limit Confiforms form to one or two entries depending on checked check box and exiting entries

JN
Contributor
July 29, 2021

Hi,

I would appreciate some assistance with a Confiforms form, I used the below link with a slight adjustment to limit the entries to two entries per date:

https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Form+to+allow+only+one+entry+per+user+per+month

how do I go about enhancing that to limiting the entry per date to one or two entries depending on a check box being checked and if there is already an entry on the date?

Many Thanks

Jonathan

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
July 29, 2021

The easiest os to have 2 rules with slightly different conditions.. unless you can put everything into one condition

mydate:[entry._today] AND mycheckbox:true AND _count:>2

Or whatever conditions you need...

More on filters (as these are used as conditions) you can find on our wiki - https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Filters

Alex 

JN
Contributor
July 30, 2021

Hi Alex,

This works for when the user tries to enter a second entry with the check box checked but if there is already an entry with the check box check on that day I don't want to allow any further entries, how do I include that in the condition or reference it in another condition?

Thanks

J

Alex Medved _ConfiForms_
Community Champion
July 30, 2021

If I get you right then you need to check for _count:>1 instead

JN
Contributor
July 30, 2021

I have it as this:

Date:[entry._today] AND ChangeControl:true AND _count>1

This is running as the condition in a "Confiforms rules for Field Definition" where "Date" is the field name and "ChangeControl" is the check box in the form and what I want to validate against in the data already possibly specified on that date currently in the dataset.

Currently the form will not allow two entries with check boxes ticked but it will allow one ticked and one not (or two not which is fine) but I only want to allow one entry with the check box checked per day.

Thanks again

Alex Medved _ConfiForms_
Community Champion
July 31, 2021

You will need a condition like this

(Date:[entry.Date] AND ChangeControl:true AND !id:[empty] AND _count:>=1) OR (Date:[entry.Date] AND _count:>2)

Alex 

JN
Contributor
August 1, 2021

Thanks Alex, this works great in all cases except when an entry exists on a date without a checked box and you add an entry that has the check box selected - it allows it and I don't want it to!

Interestingly if I open the second entry (checked) in the calendar view (on the same date with the other saved entry not checked) and try and save it it won't allow it, the condition then fires correctly!

It's working perfectly for the other combinations.

Any further thoughts would be appreciated?

Thanks

J

Alex Medved _ConfiForms_
Community Champion
August 2, 2021

Hi

And this is exactly how it is designed and works (this is how I understood your earlier requirements)

So, what exactly is your requirement?

Alex

JN
Contributor
August 2, 2021

At the point where the user saves an entry(with the ChangeControl checked) on a date where there is already an entry without the ChangeControl Checked is the scenario where the above function isn't seeing that the date is not empty.

I only want it to allow 1 entry per day if the Change Control is checked, if an entry already exists (regardless of the checked box) then it mustn't allow it.

Alex Medved _ConfiForms_
Community Champion
August 2, 2021

I dont understand to be honest.. How many records do you want to accept (per day) when the checkbox field is unchecked?

JN
Contributor
August 2, 2021

up to 2 unchecked

only 1 if checked

Alex Medved _ConfiForms_
Community Champion
August 2, 2021

I suggest to learn a bit how the filters work and what you can do - https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Filters

I believe this filtering expression should do the trick

(Date:[entry.Date] AND ChangeControl:true AND !id:[empty] AND _count:>=1) OR (Date:[entry.Date] AND ChangeControl:false AND _count:>2) OR (Date:[entry.Date] AND _count:>2)

Alex 

JN
Contributor
August 2, 2021

Hi Alex,

Thanks again but it's still not working, it's like it's not seeing that an entry is already there and it allows the 2nd entry to be added with the check box even though the filter suggests it shouldn't be more than or equal to 1 if checkbox is true!

not to worry I'll play with it and see if I can get it working.

Appreciate all the help.

Alex Medved _ConfiForms_
Community Champion
August 2, 2021

When exactly it does not work?

Here is how I test http://recordit.co/gnvCCsmszg

JN
Contributor
August 2, 2021

delete the 2nd entry for the 2nd Aug and try adding a new entry with the checkbox ticked for the 2nd Aug. 

It's shouldn't allow it because it should only allow 1 entry with a check box per day

Alex Medved _ConfiForms_
Community Champion
August 2, 2021
(Date:[entry.Date] AND ChangeControl:true AND !id:[empty] AND _count:>=1) OR (Date:[entry.Date] AND ChangeControl:false AND _count:>2) OR (Date:[entry.Date] AND _count:>2) OR ((Date:[entry.Date] AND _count:>1) AND (ChangeControl:true AND _count:>0))
JN
Contributor
August 2, 2021

That works perfectly - appreciate all the assistance. That really helps to also understand the complexity of how the filters work

Thanks again!

J

Alex Medved _ConfiForms_
Community Champion
August 2, 2021

The complexity here brings the fact that you want to filter against the existing dataset and check for (different) counts under different conditions.

Usually the filters are much simpler :-)

JN
Contributor
August 2, 2021

That's where I was struggling - I tried a few combinations with a _count:>0 but didn't have the syntax correct. 

it's been a great learning opportunity

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events