Thursday, May 10, 2007

validasi time (Powerbuilder)

//////////////////////////////////////////////////////////////////////////////////
//
// Purpose : validasi time (hh:mm:ss:ff)
// Scope : Public
// Arguments : as_time - strring
// Returns : long
//
//////////////////////////////////////////////////////////////////////////////////

//*****************Start of Code****************//


if isnull(as_time) then
return true
end if

if len(as_time) = 8 then
else
return false
end if

if isnumber(as_time) then
else
return false
end if

if mid(as_time,3,2) > '59' then return false // cek menit
if mid(as_time,5,2) > '59' then return false // cek detik
if mid(as_time,7,2) > '24' then return false // cek frame

if mid(as_time,3,2) < '00' then return false // cek menit if mid(as_time,5,2) < '00' then return false // cek detik if mid(as_time,7,2) < '00' then return false // cek frame return true //*****************End of Code****************// Cara Pake nya masukan syntak dibawah kedalam datawindow - Validation Expression di kolom yang akan di validasi f_time_valid( gettext())

No comments: