home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / 8728 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.3 KB  |  53 lines

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