palmtree with sun behind it CONTACT US
Phone: (412) 835-9417
Email: sales@vss3.com

Tip # 41 - DOEDIT()


DOEDIT is a great function and allows you to modify or test data using a given edit.

MM=doedit(@td,"yymd","8")

Then MM will equal "20060802" if @td is "08/02/06"

Use this to display prompts nicely without changing the values.  For example, I want mm(8.yymd) in my processing, but I want to display this in a prompt, I might use DOEDIT() to make the prompt more understandable:

input popup yn(1,yesno,g) "About to process all data entered before"<doedit(mm,"mdyy/","10")<"  OK? (Y/N) > "

 

This would display:

About to process all data entered before 08/02/2006 OK? (Y/N) >

That is much clearer than:

About to process all data entered before 20060806 OK? (Y/N) >

Which can be confusing as to which is the month, year and day.  This eliminates the need to use dummy variables just to modify the edit of the data.

DOEDIT(field,edit,length)  where field represents any data representation, edit is an expression indicating the edit, length is an expression for the length.  An expression means that the value can be a variable but if it is literal it must be enclosed in quotes.

If the edit fails the value would be blank, so use this to test data for validity.


Written by Nancy Palmquist

Copyright, 1997 by Virtual Software Systems.  All rights reserved.

Contact Us by: Email to Virtual Software Systems or Phone: (412) 835-9417