PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] - Best way to test empty date field
[WD20] - Best way to test empty date field
Iniciado por guest, 18,abr. 2016 18:22 - 5 respuestas
Publicado el 18,abril 2016 - 18:22
Hi Al

What is the best-practice way to test for an empty date field i.e. a date field which contains nothing?

TIA
Publicado el 18,abril 2016 - 18:36
if your_date="" then
...
end
Publicado el 18,abril 2016 - 18:44
Paulo

Yes, I was doing that but it seemed counter-intuitive to compare a date field to a string and so thought I would ask to be sure. But, OK, if that's the WD way :)
Publicado el 18,abril 2016 - 21:46
Hello JP

The test for date = "" is the test for a date being empty but you can also use the DateValid() function which will test for empty and if the value in the field represents a valid date
I use both tests depending on the situation.

Regards
Al
Publicado el 18,abril 2016 - 22:38
date = null
Publicado el 19,abril 2016 - 07:37
Al,

Thanks, DateValid() is what I like best. Will use that.