Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Olaf. I think you make an assumption which may or may not be correct, namely that the OP uses databases.
CREATE CURSOR crsTest (iid I, dDate D)
INDEX on dDate TAG xdate
ALTER TABLE crsTest DROP COLUMN dDate
CREATE CURSOR crsTest (iid I, dDate D)
INDEX on dDate TAG xDate
INDEX on Bintoc(iid)+dtos(dDATE) tag allfields
If NOT IsTag("dDate", "crsTest")
Try
ALTER TABLE crsTest DROP COLUMN dDate
Catch
? "Altering fails"
Endtry
Endif
DELETE TAG xDate
INDEX ON dDate TAG dDAte
If IsTag("dDate", "crsTest")
DELETE TAG dDate
Try
ALTER TABLE crsTest DROP COLUMN dDate
Catch
? "Altering still fails"
Endtry
Endif
FUNCTION IsTag( tcTagName, tcTable )
LOCAL ARRAY laTags[1]
LOCAL llRetVal
*** Did we get a tag name?
IF TYPE( 'tcTagName' ) # 'C'
*** Error - must pass a Tag Name
ERROR '9000: Must Pass a Tag Name when calling ISTAG()'
RETURN .F.
ENDIF
*** How about a table alias?
IF TYPE( 'tcTable' ) = 'C' AND ! EMPTY( tcTable )
*** Get all open indexes for the specified table
ATagInfo( laTags, "", tcTable )
ELSE
*** Get all open indexes for the current table
ATagInfo( laTags, "" )
ENDIF
*** Do a Case Insensitive, Exact=ON, Scan of the first column of array
*** Return Whether the Tag is Found or not
RETURN ( ASCAN( laTags, tcTagName, -1, -1, 1, 15 ) > 0 )
ENDFUNC
Function IsTag(tcTagName,tcTable)
Local lnArray, lcTable
Local Array laTags[1]
If Type('tcTagName')#"C"
* error
Return .F.
Endif
If Type('tcTable')="C" And !Empty(m.tcTable)
lcTable = Juststem(m.tcTable)
Ataginfo(laTags,"",m.lcTable)
Else
Ataginfo(laTags,"")
Endif
If Type("laTags", 1) = "A"
lnArray = Ascan(m.laTags,m.tcTagName, -1, -1,1,7)
If m.lnArray = 0
lnArray = Ascan(m.laTags,m.tcTagName,-1,-1,3,7)
Endif
Else && laTags is not built - table without any index tags
lnArray = 0
Endif
Return Iif(m.lnArray = 0 , .F., .T.)
Endfunc