Consultor Eletrônico



Kbase 13637: Example code - character string field contains only digits
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Example code - character string field contains only digits


The example below shows one way of checking whether a value entered
into a character field contains only digits.

----------------------------------------------------------------------

def var c as char label "Enter a numeric only".
def var t as integer.

repeat:
update c with side-labels.
do while length(c) > 0:

t = integer(substring(c,1,1)) no-error.
if error-status:error then do:
message "Invalid entry." skip
"Alphabetical characters not allowed." view-as alert-box.

leave.
end.
if length(c) > 1 then c = substring(c,2,length(c)).
else c = "".
end.
end.

Progress Software Technical Support Note # 13637