Comparing Current Date with another Date and Restriction the LOV choice Value
I have a Skybow Form in edit option for my end user. There is choice field (Teknik Bölüm Termin Talep) as the values selectable(LOV) like ;
Evet 1.Termin
Evet 2.Termin
Evet 3.Termin
Gerçekleşti
Tamamlanamadı
As you see There are also 3 date fields which are not editable (I have calculated and set it from my nintext Worklow)
Teknik Bolum 1.Termin
Teknik Bolum 2.Termin
Teknik Bolum 3.Termin
Now What I want is that my user must not select from LOV (TeknikBolum Termin Talep) as the values;
"Evet 2.Termin" OR "Evet.3.Termin" While my user editing the FORM if the current time earlier then the date of "Teknik Bolum.1Termin" I need a warning message apperaring onto screen like that
"You are not allowed to choose "Evet 2.Termin" because current date is earlier then
So how can I write a condition behind the field of my (Teknik Bölüm Termin Talep) and according the selection compares
CurrenDate and 3 date fields?
-
any suggestion?
0 -
You could apply a custom-validation to the field "Teknik Bölüm Termin Talep". This would trigger the field-value to be invalid and an according text will be displayed.
0 -
Hello Henning,
Thank's so much for your reply but I do not know how to get the current_date for custom validation. I need a syntax that gives me the current_date THEN I can compare. So my example as above.
Let's say If my user edits the form today so today is 6/1/2019 and the "Teknik bolum1.Termin" date is : 21/1/2020
My user can not select from(LOV) value as "Evet 2.Termin" because "Tekink Bolum 2.Termin" date is is 21/3/2020
and too earlier then TODAY.
Actually my user must not select LOV values IF the current date early then my calculated dates as below fields
Teknik Bolum 1.Termin
Teknik Bolum 2.Termin
Teknik Bolum 3.Termin
That's why I need a custom field for my Rich Form and calculates and sets the current date on every editing operation
Then I will compare with my 3 date fields. BUT How :-)
0 -
Well, you will need to open the expression builder for the validation
and write something like this:
var today = new Date();
if ([[Teknik Bölüm Termin Talep]] == "Evet 1.Termin" && [[Teknik Bolum 1.Termin]] < today)
return false;
if ([[Teknik Bölüm Termin Talep]] == "Evet 2.Termin" && [[Teknik Bolum 2.Termin]] < today)
return false;
if ([[Teknik Bölüm Termin Talep]] == "Evet 3.Termin" && [[Teknik Bolum 3.Termin]] < today)
return false;
return true;Make sure, that you set the expression to "Function code"
0 -
Hello Henning;
I have done as your description instead of using "&&"
So your code became ;
var today = new Date();
if ([[Teknik_x0020_B_x00f6_l_x00fc_m_x4]] == "Evet 1.Termin" || [[Teknik_x0020_B_x00f6_l_x00fc_m_x0]] < today)
return false;
if ([[Teknik_x0020_B_x00f6_l_x00fc_m_x4]] == "Evet 2.Termin" || [[Teknik_x0020_B_x00f6_l_x00fc_m_x2]] < today)
return false;
if ([[Teknik_x0020_B_x00f6_l_x00fc_m_x4]] == "Evet 3.Termin" || [[Teknik_x0020_B_x00f6_l_x00fc_m_x3]] < today)
return false;
return true;Then it works:-))
0
Please sign in to leave a comment.
Comments
5 comments