home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!think.com!spool.mu.edu!umn.edu!dell32.ortta.umn.edu!durai
- From: durai@ortta.umn.edu (Durai Venkatasubramanian)
- Subject: Re: two foxpro questions
- Message-ID: <durai.103.725744384@ortta.umn.edu>
- Lines: 39
- Sender: news@news2.cis.umn.edu (Usenet News Administration)
- Nntp-Posting-Host: dell32.ortta.umn.edu
- Organization: U of Mn
- References: <9212301852.AA11765@chimi.engr.ucdavis.edu>
- Date: Wed, 30 Dec 1992 19:39:44 GMT
- Lines: 39
-
- In article <9212301852.AA11765@chimi.engr.ucdavis.edu> mahadeva@chimi.engr.ucdavis.edu (Vimalan Mahadevan) writes:
- >From: mahadeva@chimi.engr.ucdavis.edu (Vimalan Mahadevan)
- >Subject: two foxpro questions
- >Date: 30 Dec 1992 12:59:07 -0600
- >I am writing a data entry program program uising FoxPro and plan on writing
- >aWindows based retrieval program in C. I have been told that when doing
- >this I must make sure that all my fields are of type character; using the date
- >or numeric field types will just add to job when writing the C retrieval
- >program.
- >
- >But I want to be able to filter the data entries being entered using numeric
- >fields and the >,< operations. This leads me to my questions.
- >
- >1) If I have a character field five chars long and the user enters 235. I want
- >the program to automatically make that 00235 so I can sort. But I don't want
- >to display the leading zeroes unless I have to.
- >
- Use a function that displays (or adjusts the value in the database)
- with leading zeros. The function can be part of the valid clause
- for the object (field). Eg: @ 2,3 get charfield valid addzeros(charfield)
-
- function addzeros
- parameters fldval
- replace charfield with "00"+fldval && if you are not using memvars
- m.charfield = "00"+fldval && if you are using memvar
-
- If you are using the screen generator, just insert the function code in the
- valid snippet.
-
- >2) Supposing you have a field which contains the middle initial of a person.
- >I don't want the user to have to enter the period after the initial. How
- >can the program be instructed to automatically enter a period after the user
- >enters the letter?
- >
- Either you can use formatted input (@R) to show the "." on screen, or you
- can use a validation function, as mentioned above. Formatted input,
- however, will not add the "." to data.
-
- Hope it helps.
-