Alaska Software Inc. - Re: Doubt About Dbes
Username: Password:
AuthorTopic: Re: Doubt About Dbes
Andreas Gehrs-Pahl

View the complete thread for this message in:

Re: Doubt About Dbes
on Fri, 16 Dec 2016 12:34:24 -0500
Carlos,

>2) The DBE DBFCDX returns memo extension as 'FTP'

No, it doesn't! Your code is incorrect, as it queries the FOXDBE what it's 
Memo extension is, and it uses a DBF #define constant to this. It is very 
important that you use DbeSetDefault() before using DbeInfo(), as DbeInfo() 
always ONLY works on the current default DBE. One exception is right after 
DbeBuild(), as DbeBuild() implicitly sets the default DBE to the one that 
was just built.

To fix your code:

1) Make the DBE that was used to open the database the Default DBE using 
   DbeSetDefault().

2) Use the correct #define constant, even if they (coincidentally) have the 
   same value!

Replace line 30 with something like this:

cFileName := DbInfo(DBO_FILENAME)
cDBE_Used := DbInfo(DBO_DBENAME)
cOld_DBE  := DbeSetDefault(cDBE_Used)
cDBE_Data := DbeInfo(COMPONENT_DATA, DBE_NAME)

if cDBE_Data == 'DBFDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, DBFDBE_MEMOFILE_EXT)
elseif cDBE_Data == 'FOXDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, FOXDBE_MEMOFILE_EXT)
elseif cDBE_Data == 'ADSDBE'
   cMemoExt := DbeInfo(COMPONENT_DATA, ADSDBE_MEMOFILE_EXT)
else
   cMemo_Ext := ''
endif

DbeSetDefault(cOld_DBE)

if empty(cMemoExt)
   cReturned := cFileName + ' has no Memo File!'
else
   cReturned := left(cFileName, RAt('.', cFileName)) + cMemoExt
endif

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC