home *** CD-ROM | disk | FTP | other *** search
- <<* APPGETS.INC *>>
- <<#
-
- procedure GenValidSeek( expr : string )
- begin
- #>>
- IsValid = .F.
- <<if ismultials>>
- DO VLOOKUP WITH dbfarea,{expr},IsValid
- <<else>>
- DO VLOOKUP WITH "A",{expr},IsValid
- <<endif>>
- DO WHILE .NOT. IsValid
- <<#
- pushmargin( 1 )
- GenColorAtr
- gen( rtrim( getFIELD( AutoMem ) ) )
- if fldran
- gen( ' RANGE ',fldran )
- endif
- genln
- popmargin
- #>>
- READ
- <<if ismultials>>
- DO VLOOKUP WITH dbfarea,{expr},IsValid
- <<else>>
- DO VLOOKUP WITH "A",{expr},IsValid
- <<endif>>
- ENDDO
- <<end GenValidSeek>>
-
-
- <<procedure GenValidLoop( expr : string )>>
- <<string rowstr>>
- <<begin>>
- <<rowstr := '@ PromptRow,0'>>
- DO WHILE .NOT. ({expr})
- <<GenColor( 1,'PROMPT' )>>
- {rowstr} CLEAR
- <<if fldusr>>
- {rowstr} SAY [{fldusr}]
- <<else>>
- {rowstr} SAY "INVALID DATA. Please re-enter."
- <<endif>>
- <<#
- pushmargin( 1 )
- GenColorAtr
- gen( rtrim( getFIELD( AutoMem ) ) )
- if fldran
- gen( ' RANGE ',fldran )
- endif
- genln
- popmargin
- #>>
- READ
- <<GenColor( 1,'PROMPT' )>>
- {rowstr} CLEAR
- ENDDO
- <<end GenValidLoop>>
-
-
- <<#
- procedure GenValidCheck <<* VALID() loop for versions *>>
- string expr,token
- integer pos
- begin
- expr := fldval
- token := "VLU(" <<*VLOOKUP keyword*>>
- pos := at( token,upper(expr) )
- if pos > 0
- expr := substr( expr,pos,255 )
- if expr[ len(expr) ] = ")"
- expr := rtrim( left( expr,len(expr) - 1 ) ) <<*delete rparen*>>
- endif
- expr := stuff( expr,1,len(token),"" ) <<*delete keyword*>>
- pos := at( ',',expr )
- expr := left( expr,pos ) + fixautomem( substr( expr,pos+1,255 ) )
- GenValidSeek( expr )
- else <<*Normal VALID expression*>>
- GenValidLoop( fixautomem(expr) ) <<*Insert fldprefix*>>
- endif
- end GenValidCheck
-
-
- procedure WriteGetFlds
- logical IsSomeValid,IsReadNeeded
- begin
- forecolor := 32000 <<*For GenColorAtr() procedure*>>
- backcolor := 32000
- IsReadNeeded := false
- IsSomeValid := false
- forall (fldcal = '')
- IsReadNeeded := true
- GenColorAtr
- genFIELD
- endfor
- if IsReadNeeded
- genln( 'READ' ) <<*Read the last alias selected*>>
- endif
- if IsSomeValid
- forecolor := 32000
- backcolor := 32000
- forall fldval
- GenValidCheck
- endfor
- endif
- end WriteGetFlds
-
-
- procedure GenGetsBody
- begin
- select on databases,fields,pages
- select fields on fldget and (fldtyp $ 'CDLMN')
- if ndxtotal > 0
- select index 1 <<*---Use the first index as MASTER index---*>>
- select fields on not (upper(fldnam) $ upper(ndxkey))
- endif
- genln( '?? SYS(2002,1) && TURN CURSOR ON' )
- if ismultipage
- if fldtotal > 0
- genln( 'DO CASE' )
- forall pages
- if fldtotal > 0
- genln( 'CASE pageno=',pagcount )
- pushmargin( 1 )
- WriteGetFlds
- popmargin
- endif
- endfor
- genln( 'ENDCASE' )
- endif
- else <<*Single page format*>>
- select page 1
- if fldtotal > 0
- WriteGetFlds
- endif
- endif
- select all fields
- genln( '?? SYS(2002) && TURN CURSOR OFF' )
-
- end <<*GenGetsBody*>>
-
- <<* EOF: APPGETS.INC *>>
- #>>