Does it need to be a date field? It not have a day so it will create some
problems. You can make it a string field
Field('A0514_DT_FIN',requires=IS_EMPTY_OR(IS_MATCH('\d{6}')))
On Tuesday, 27 March 2012 10:05:11 UTC-5, Adriano Almeida wrote:
>
> Hi,
>
> I want a field (may be string,date or number, no prob) to have a
> format of YYYYMM (valid year and month) or if it is left null, to be
> 999999. How Could I accomplished that?
>
> I have tried :
> Field('A0514_DT_FIN','date',notnull=True, label= 'Dt Fim (YYYYMM)',
> default= '999999')
>
> and then the check:
> db.tb0514_bihc_consultor_nivel.A0514_DT_FIN.requires =
> IS_EMPTY_OR(IS_DATE(format=T('%Y%m'), error_message='formato deve ser
> YYYYMM! ou vazio'))
>
> It does not work as 99 is not a valid month and 9999 is not a valid
> year.
>
> Any ideas?
>
>