How to add a validation on all date fields?

Author: nelleke.rietvink@capgemini.com (mcbash)

Hi, I'm using Uniface 9.3.02 but unfortunately have never any proper Uniface training which sometimes means that I ask questions about the most basic of things that I just haven't come across yet. Google also didn't help much this time. The client has requested that a validation on the minimum and maximum value is added on all the date fields in all forms. I am looking to see if this can be added in just one place instead of adding the validation to every date field on the forms.   It does look like all the date fields have the same syntax/interface/layout template but I don't see how I can add a trigger on those templates. I did see there is a field-template where I can add a new template with a trigger to validate, but how do I then connect the field-template to all the date-fields?   Thanks&Regards, Nelleke

4 Comments

  1. hi Nelleke , Why don't you simply add a trigger in the global update module ? go to > administration > global updtates > fields The global update menu must be activated previously with the preferences in the IDF utilities> preferences > general Hope that will help you  Daniel


    Author: cabero (daniel.cabero@euralis.com)
  2. As you're indicating that you are a novice on Uniface, please be careful in using the Global Updates function, as this is a very powerful function and changes made with it are sometimes hard to reverse. Please first try whatever you want to do on one date field and test it thourougly, before implementing this change throughout your application by use of Global Updates. Also having some way of Version Control and/or backup could be useful.


    Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
  3. Thanks for the quick replies!   I will look into the Global Updates function and be very careful. 


    Author: mcbash (nelleke.rietvink@capgemini.com)
  4. Dates are often difficult object to play with... Some questions you should ask yourself before anything else: 1) Is your application/system an international one having to deal with multiple date format? 2) Is your application/system default format for date field including century? 3) Is your application/system already putting in place some standard about dates definition, control and verification? In other words: date fields are always defined as "Date" or "Datetime" datatype? 4) Could you write a date control routine to be put in place as a generic call? Something like: call myDateControlRoutine(@$fieldname) if ($status < 0) return($status) If questions #3 and #4 could have a positive answer it is possible to think to inject codelines into application model and/or components using date or datetime fields... In any case not the simplest task... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)