Confiforms field definition rules - condition date syntax

JN
Contributor
February 15, 2022

Hi Alex,

I have an existing filter in my confluence calendar that limits the number entries on any given day

What I'd like to do is allow an additional entry (go from 2 to 3) for a given month or period, say Mar and Apr (but only during this time) - how do I go about specifying that in the condition filter? 

 

Thanks
Jonathan

2 answers

1 accepted

1 vote
Answer accepted
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2022

Hi

What filtering condition do you have at the moment?

Alex

JN
Contributor
February 15, 2022

Hi Alex,

It's a condition you helped me with previously:

(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))

 

J

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2022

Cannot remember, sorry - too many conversations :-)

The idea would be to add use of formatDate with specific pattern  from https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

Basically checking the "month" in addition

Date.formatDate(M):3

(3 goes for March, 4 for April, according to docs)

 

Alex

JN
Contributor
February 15, 2022

fantastic - thanks for that, i'll give it a go and let you know if I get it working

JN
Contributor
February 16, 2022

sorry Alex I'm struggling here; I can't work out who to add the (

Date.formatDate(M):3

) so that it checks the month being selected is "3" and then allows 3 entries as opposed to 2.

Any help or examples would be appreciated

Thanks

Jonathan

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 16, 2022

You add where you need to check that - I mean, you know the requirement better

I am not sure I remember you exact requirements.. but basically 

(Date:[entry.Date] AND Date.formatDate(M):3 AND _count:>3) OR (Date:[entry.Date] AND !Date.formatDate(M):3 AND _count:>2)
JN
Contributor
February 16, 2022

That looks great - do I add that as a new rules for field definition with its own condition filter or just append it onto the current filter?

Thanks again

Jonathan

JN
Contributor
February 16, 2022

Thanks Alex, got it to work - it's a combination of editing the two different condition filters and adding the relevant values from your example above where necessary.

 

Appreciate the support as always.

J

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 16, 2022

Sorry, I have not provided an exact filtering condition (lack of time) - but I am glad you have figured it out yourself.

I would also do it in a way that I have multiple validation rules that validate the record for certain conditions. Easier to understand and maintain later

JN
Contributor
February 16, 2022

No problem at all - you provided enough information for me to work it out.

Have a good day.

JN
Contributor
February 17, 2022

Hi Alex,

 

Could you help me with the syntax in this filter please. I want to extend the option to multiple months. The query that works for one month looks like this:

(Date:[entry.Date] AND Date.formatDate(M):3 AND _count:>3) OR (Date:[entry.Date] AND !Date.formatDate(M):3 AND _count:>2)

I tried creating a separate rule field definition for each month and specifying the relevant number (M):x but that doesn't work.

I also tried adding an additional 

AND Date.formatDate(M):x  

but I'm not sure I have the syntax correct so it's not working either.

Any help would be appreciated.

 

Thanks

Jonathan

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 17, 2022

I came up with something like this

(to allow 3 records per day in March/April) and only 2 per day on other months

((Date.formatDate(M):3 OR Date.formatDate(M):4) AND (Date:[entry.Date] AND _count:>3)) OR (Date:[entry.Date] AND !Date.formatDate(M):3 AND !Date.formatDate(M):4 AND _count:>2)
JN
Contributor
February 17, 2022

works perfectly - I was able to adapt the other rule definition to follow the same syntax too.

 

Thanks again

J

0 votes
Andrzej December 3, 2024

Hello @Alex Medved _ConfiForms_ 

Could you help to add condition which will accept only dates which are from the current and upcoming years? The past years shloud be not allowed 

 

I tried a lot of rules :/ 

[formatDate(entry.AllocationStart, "yyyy")] < [formatDate(today, "yyyy")] OR [entry.endDate] < [entry._today]

 

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2024

Condition for the validation rule would be something like this (assuming your field to check is named "date")

date.formatDate(yyyy):<[entry._now.formatDate(yyyy)]

 

Andrzej December 4, 2024

I need to validate the field that is added while filling the form (from the dropdown).

And then, if someone decides to select an option from a dropdown, I'm adding a new field, but this field cannot be empty. It must be filled whenever someone chooses the option 'No' from my dropdown and is trying to submit the form...

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2024

Sorry, I dont understand your comment/requirements

What you want to validate and when?

Andrzej December 4, 2024

 

 

 

 

 

Przechwytywanie2.PNGPrzechwytywanie1.PNG

 

 

 

 

 

I updated the description

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2024
mydropdown:somevalue AND myfield:[empty]

Meaning when the mydropdown has somevalue the field should NOT be empty

For the validation rule you describe the "error condition", in other words - when the validation should trigger (when something is "wrong" and you describe that with a condition)

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2024

With added screenshots, changing the condition for the validation rule to be

FTEAdjustment:2 AND FTEFlat:[empty]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events