NOZDIV() Prevents divide-by-zero NBR2STR() Correctly orders numerics where negative TRUEVAL() Returns val of ALL numerics in a string AT2CHAR() Returns the String color equivalent of a color attribute
Daily Archives: December 6, 2013
SP__WILDCARD
_WILDCARD() Short: ------ _WILDCARD() Wild Card String Compare Returns: -------- <lMatched> => match Syntax: ------- _wildcard(<cPattern>,<cTarget>) Description: ------------ <cPattern> is a model/wildcard pattern to search for and <cTarget> is a string to compare with model/pattern in <cPattern>. Like DOS wildcards, but for a string. <cPattern> is a string of wild cards interspersed with literal text to compare against the contents of <cTarget>. The following conventions for wild cards are followed: 1. "*" stands for any group of characters. W*r gives fields beginning with "W", ending with "r". *w*r gives fields having "w" before last character "r". 2. "?" stands for any single character. J?n?s gives Janes, Janus, Jones, and so on. Examples: --------- _wildcard("Pr?fon*e", "Prefontaine" ) // returns -> True _wildcard("Pr?on*e", "Prefontaine" ) // returns -> False _wildcard("Stei*er","Prefontaine") // returns -> False Notes: ------- This was a C function in previous SuperLibs. Now 5.01 Clipper source code, and more reliable. Source: ------- S_WILD.PRG
SP_YNREADER
YNREADER() Short: ------ YNREADER() Creates specialized Yes/No get reader block Returns: -------- <bReader> => get reader block for logical GET Syntax: ------- YNREADER() Description: ------------ Creates a reader block that pops up a Yes/No window to get the logical value for the current get. Implement by using the SEND keyword for your @Say..Get.. statements. i.e. @10,10 say blah get blahblah SEND reader:=YNREADER() Use this on a LOGICAL get only. Examples: --------- // while in the get V1, a Yes/No window pops up for logical selection v1 := .f. @10,10 get v1 send reader := ynreader() READ Source: ------- S_READRS.PRG
SP_XBXX
XBXX() Short: ------ XBXX() Draws an exploding box on the screen of a given color Returns: -------- Nothing Syntax: ------- XBxx(nTop,nLeft,nBottom,nRight,[nColor],[nShadow]; [nShadowColor],[cFrame]) Description: ------------ <nTop > - top row <nLeft> - left col <nBottom> - bottom row <nRight> - right column [nColor] - attribute to box default setcolor() [nShadow] - numeric shadow type (default 0) follow numeric keypad 7 = upper left 1 = lower left 3 = lower right 9 = upper right 0 = no shadow [nShadowColor] - shadow attribute (default 7 - grey on black) [cFrame ] - frame string - MUST be 9 characters - default single line Examples: --------- XBXX(10,10,20,20,47,9,8) Notes: ------- Previously a 'C' function, now Clipper 5.01. Source: ------- S_XBXX.PRG
SP_WRITEFILE
WRITEFILE() Short: ------ WRITEFILE() Writes a line or lines to a text file Returns: -------- nothing Syntax: ------- Writefile(cFileName|n|FileHandle,cText|aText) Description: ------------ Writes line(s) of text with CR LF to a file referenced either as a file handle <nFileHandle> or a file name <cFileName>. Writes either a single line contained in <cText> or all of the contents of array <aText> to the file. Examples: --------- 1. WRITEFILE('ERROR.TXT','THERE WAS AN ERROR') 2. aErrors := array(3) aErrors[1] = 'There was an error' aErrors[2] = 'Error # 61765 ' aErrors[3] = dtoc(date) writefile('ERROR.TXT',aErrors) 3. nHandle := fopen("error.txt",1) aErrors := array(3) aErrors[1] = 'There was an error' aErrors[2] = 'Error # 61765 ' aErrors[3] = dtoc(date) writefile(nHandle,aErrors) Notes: ------- If a filename is passed, the file is opened and closed by the function. If a file handle is passed, the file is left open. If the file does not exist, it is created. PREVIOUSLY AN ARRAY NAME WAS PASSED. THIS MUST NOW BE AN ARRAY. Source: ------- S_WRITEF.PRG
SP_WOYEAR
WOYEAR() Short: ------ WOYEAR() Calculates week of the year (# of 7 day periods) Returns: -------- <nWeek> => week of the year of date Syntax: ------- WOYEAR(dDate) Description: ------------ Calculates number of 7 day periods passed for the year from <dDate> Examples: --------- dDate := ctod("10/15/90") nWoYear := WOYEAR(dDate) // (returns 40) Source: ------- S_WOYEAR.PRG
SP_WORKBLOCK
WORKBLOCK() Short: ------ WORKBLOCK() Returns a set-get block for field named in an expression Returns: -------- <bBlock> => a set-get block Syntax: ------- WORKBLOCK(cExpress) Description: ------------ Determines the work area and field name in <cExpress> and returns a FIELDWBLOCK() created block for it. Examples: --------- cExpr := "CUSTOMER->LNAME" bExpr := WORKBLOCK(cExpr) ?eval(bExpr) // displays value ?eval(bExpr,"SMITH") // sets new value Source: ------- S_FIELDS.PRG
SP_WOMONTH
WOMONTH() Short: ------ WOMONTH() Calculates week of the month (# of 7 day periods) Returns: -------- <nWeek> => week of the month Syntax: ------- WOMONTH(dDate) Description: ------------ Calculates current number of 7 day periods for the month from <dDate> Examples: --------- dDate := ctod("10/15/90") nDom := WOMONTH(dDate) // (returns 3) Source: ------- S_WOMON.PRG
SP_WGT_MEAS
WGT_MEAS() Short: ------ WGT_MEAS() A Weights and Measures conversion metafunction Returns: -------- Nothing Syntax: ------- WGT_MEAS() Description: ------------ WGT_MEAS() is a menu driven Weights and Measure conversion utility, which supports many types of conversions. Examples: --------- WGT_MEAS() Source: ------- S_MEAS.PRG
SP_VIEWPORT
VIEWPORT() Short: ------ VIEWPORT() Multi-optional data entry engine Returns: -------- Nothing Syntax: ------- VIEWPORT([lModify],[aFields,aDesc],[aPict],[aVal],[aLook],; [aOther],[aEdit],[lCarry],[cTitle]) Description: ------------ Presents a generic data entry screen with multiple movement, search, view and editing capabilities. [lModify] Logical - this is (.T.) if you want to give the user Add,Edit,Delete, and (.F.) if not. Defaults to (.T.) Arrays 1-5 and array 7 must have the same # of elements. (default is # of fields in DBF). You may pass a nil to bypass and activate the default for any of these arrays. [aFields] An array of field names. Defaults to all fields in DBF. [aDesc] An array of field descriptions. Defaults to field names. You must pass [aFields] if you wish to pass [aDesc] [aPict] is an array of PICTURES as Character expressions to correspond with the [aFields] array. Default is pictures as derived by ED_G_PIC(). If you pass this array, each element must contain at least a "". [aVal] is an array of VALID clauses and messages to correspond with the [aFields] array. Each is in the form "{valid clause};{valid message}" The FIELD is represented as a token "@@" in the valid clause which is replaced with the current edited value at edit time. Note: Field values are loaded into an array when editing, so field names in the valid are not meaningful. Field name FIRST might be aValues[12]. At edit time, the "@@ " will be replaced with "aValues[12]". i.e. "!empty(@@);Must not be empty" If you pass this array, each element must contain at least a "". [aLook] is an array of Lookup definitions corresponding to the [aFields] array. These are delimited strings with 1-4 component parts matching the first four parameters of SMALLS(). Delimiter is a semicolon (;). As an example, to make a lookup definition corresponding to the COMPANY field in the [aFields] array, which will lookup on the field CORPNAME in the database INSTIT, titling the box "Company" and KEYBOARDing the contents of CORPNAME if CR pressed "CORPNAME;Company;%INSTIT;CORPNAME". If you realize that these 4 components are parsed and sent as parameters to SMALLS(), you will get the idea. If you pass this array, each element must contain at least a "". [aOther] [1-9 elements] Each of elements 1-9 is a delimited string in the format "{option};{action}" where option is a displayed menu option and action is a proc to be executed. i.e.: "Form Letters;FORMLETR()" "List Myfile;FILEREAD(2,2,22,78,'FMYFILE.TXT')" Pass 1-9 option/proc combinations. These will be presented as an 'Other' menu. THESE PROCS MUST BE DECLARED EXTERNAL!!! [aEdit] an array of logicals matches the FIELDS array and defines which fields may be edited (.t.) and which are display only (.f.) If you pass this array, each element must be of TYPE Logical. [lCarry] Pop up 'Carry Forward' message when adding? True/False. Default is True. [cTitle] Optional title. Default is " V.I.E.W P.O.R.T for file: "+TRIM(ALIAS())+' ' Examples: --------- local aFlds[fcount()] local aFdes[fcount()] local aFval[fcount()] local aFloo[fcount()] local aFedit[fcount()] afields(aFlds) afields(aFdes) afill(aFval,"") afill(aFloo,"") afill(aFedit,.t.) // valids for fields 5 and 6 aFval[5]:="!empty(@@);Cannot be empty" aFval[6]:="!empty(@@);Cannot be empty" // lookups for fields 5 and 6 aFloo[5] := "First;First Name;%user%;trim(first)" aFloo[6] := "Last;Last Name;%user%;trim(Last)" // 'other' menu array aOther := { "Read PRG;FILEREAD(1,1,23,79,'s_viewp.prg')",; "Do Form Letters ;FORMLETR()",; "Frequency Analysis;FREQANAL()" } VIEWPORT(.t.,aFlds,aFdes,nil,aFval,aFloo,aOther) Source: ------- S_VIEWP.PRG