Class SY_SearchData

This is a base class to be inherited by other SearchData classes; child classes must implement BuildIndex method.

Constructor

Initialize a Sage.Data.Search object.

ParameterDescription
coSession [input, object, required] Reference to the SY_Session object
bIgnoreNoData [input, boolean, optional] When set, will skip the check for data in the data index used for the search.

Inherits

SY_Constant

Properties

LOCAL cIndexFieldEntityKey$="EntityKey"  

Field used to store a value used identify groups of entries in the index for an entity; for example, Auto-Complete uses company code to group all entries together for a company

LOCAL cIndexFieldEntityName$="EntityName"  

Field used to store the name of the entity

LOCAL cIndexFieldDocKey$="DocKey"  

Field used to store the key of the current row of the table associated with the entity

LOCAL cIndexFieldDocData$="DocData"  

Field used to store a record of a subset of fields from current row of the table; this record will be included in any search of the index for the entity

LOCAL cIndexFieldDocStored$="DocStored"  

Field used to store a record of a subset of fields from current row of the table; this record will be excluded from any search of the index for the entity

LOCAL cDefaultFieldSep$=SEP  

Default field separator

LOCAL cIndexName$="Index"  

Name to use for the search index file(s); will default to "INDEX" when not set

LOCAL cIndexAlternateSep$=$FF$+SEP  

Alternate field separator to be used when writing index to ensure all results are found

PROPERTY EntityName$   * Read Only *

Name to store for the entity; must be set by child class when using Advanced Search

PROPERTY LastSearchValue$   * Read Only *

[string] Value used for the last successful search

PROPERTY RebuildMsg$   * Read Only *

[string] The message to display in progress bar when rebuilding the index

PROPERTY ResultCount   * Read Only *

[number] The number of hits found for the current active search, -1 if there is not an active search

PROPERTY SearchResultLimit  

[number] Limit for number of items returned for result of search. The default limit for the size of the result set is 1000 items.

Methods

FUNCTION AdvancedSearch(searchIndex)  

Display the Advanced search dialog to enable user to enter search value and view/select results

ParameterDescription
searchIndex [output, number] Index into the search result set of selected row
Returns [boolean] returns retSUCCESS(1)
FUNCTION BuildIndex(*)  

Build the search index

Returns [boolean] 0 - Failure, 1 - Success
Info

This method must be implemented in child class to build the search index.

Warning

The child method must use _OBJ'TranslateIndexData$() to translate field separator in data value or stored value before adding to search index.

FUNCTION CheckBuildLockFile(bClear)  
FUNCTION CheckBuildLockFile(bClear, bKeepExisting)  

A helper method to be used by BuildIndex when the creation of the search index must be restricted to a single user. This method will create a lock file if none exists and call the CreateIndex() method only if a lock can be placed on this file.

ParameterDescription
bClear [input, boolean] When set, will clear the flag used to indicate rebuild of index is required
bKeepExisting [input, boolean, optional] When set, will not initialize the existing index
Returns [boolean] retSUCCESS(1) when lock of file succeeded, retFAILURE(0) when cannot lock the file
FUNCTION CheckIndexData()  
FUNCTION CheckIndexData(company$)  

Check to see if there is any data in the search index; optionally, restrict to single entity and company

ParameterDescription
company$ [input, string, optional] Company code to use to restrict scope of data check
Returns [boolean] 0 - No Data Found, 1 - Data Found
FUNCTION CreateIndex()  
FUNCTION CreateIndex(retainData)  
FUNCTION CreateIndex(retainData, indexName$)  
FUNCTION CreateIndex(retainData, indexName$, encryptPassword$)  

Create an index for a search

ParameterDescription
retainData [input, boolean, optional] set to isTRUE to keep the existing data for the entity
indexName$ [input, string, optional] when set will be used instead of the LOCAL property cIndexName$
encryptPassword$ [input, string, optional] password to use to open encrypted index
Returns [boolean] returns retSUCCESS
FUNCTION DeleteDocument(in.Company$, in.Name$, in.KeyValue$)  

Delete document in index for specified company, entity name, and document key

ParameterDescription
in.Company$ [input, string] Company code for the document
in.Name$ [input, string] Entity Name for the document
in.KeyValue$ [input, string] Key value for the document
Returns [boolean] 0 - update failed, 1 - update successful
FUNCTION GetDataIOL$()  

Get IOList to use for separating the search data stored in the DocData field in the search index into fields.

Returns [string] IOLIST to use for DocData field in the search Index
Info

This method can be implemented in child class to define IOLIST for the data to place in the search index to be included as part of a search

FUNCTION GetIndexName$()  

Get name of Index

Returns [string] Name of Index
FUNCTION GetIndexPassword$()  

Get password to use for open of Index

Returns [string] Password value to use for open of Index
FUNCTION GetMlacExpressions(out.DisplayExpr$, out.ReturnExpr$)  

Get expressions to be override Auto-Complete defintion used in *obj/mlac for data display and returned value

ParameterDescription
out.DisplayExpr$ [output, string] Expression to be used to create data value to display in selection list
out.ReturnExpr$ [output, string] Expression to be used to set the data value to be returned for selected row in selection list
Returns [boolean] retSUCCESS(1) when override values are defined, retFAILURE(0) when no override values are defiend
Info

This method should be implemented in child class to define IOLIST for data to display to allow for greater flexibility when using Advanced Search

FUNCTION GetResultsFormat$()  
FUNCTION GetResultsFormat$(entity$)  

Get format definition to use for the display of the search results in the Report-View of the Advanced Search

ParameterDescription
entity$ [input, string, optional] A name used to identify the application entity to be associated with the data
Returns [string] Format definition used to display search results in Advanced Search dialog
Info

This method should be implemented in child class to define a format to better match search results. The default format is a single column with the heading 'Results'.

FUNCTION GetResultsIOL$()  

Get IOList to use for data to load into the Report View ListBox when using Advanced Search

Returns [string] IOLIST to use for data to load into Reort View to display the search results in Advanced Search dialog
Info

This method should be implemented in child class to define IOLIST for data to display to allow for greater flexibility when using Advanced Search

FUNCTION GetStoredIOL$()  

Get IOList to use for separating the stored data stored in the DocStored field in the search index into fields.

Returns [string] IOLIST to use for DocStored field in the search Index
Info

This method can be implemented in child class to define IOLIST for data to be stored in the search index but not included as part of a search

FUNCTION GetStoredValue$(entity$, company$, dataRec$, dataIOL$)  

Get data value (not translated) for the DocStored field in the search index

ParameterDescription
entity$ [input, string] A name used to identify the application entity to be associated with the data
company$ [input, string, optional] Company code
dataRec$ [input, string] A string containing the field data values for entity main file record
dataIOL$ [input, string] An IOLIST for entity main file
Returns [string] Stored data record to use for DocStored field in the search Index
Info

This method can be implemented in child class to define the data to be stored in the search index but not included as part of a search. This stored data can be used in the results format to show formatted data or other information.

FUNCTION IsIndexEncrypted()  

Is index encrypted?

Returns [boolean] 0 - Not Encrytped, 1 - Encrypted
Info

This method must be implemented in child class if associated index is encrypted

FUNCTION IsIndexUpdateInProgress()  

Is index update in progress? @returns[boolean] 0 - Update not in progress, 1 - Update in progress

FUNCTION MarkIndexRebuildRequired(rebuildMsg$)  
FUNCTION MarkIndexRebuildRequired()  

Mark the current index as out-of-date to force a rebuild when next accessed

ParameterDescription
rebuildMsg$ [input, string] Message to display when rebuilding the index (optional)
Returns [boolean] 0 - Failed to mark index to require a rebuild, 1 - index marked to require a rebuild
FUNCTION OpenIndex()  
FUNCTION OpenIndex(indexName$)  
FUNCTION OpenIndex(indexName$, encryptPassword$)  

Open an index for a search

ParameterDescription
indexName$ [input, string, optional] when set will be used instead of the LOCAL property cIndexName$
encryptPassword$ [input, string, optional] password to use to open encrypted index
Returns [boolean] returns retSUCCESS
FUNCTION ResetIndex()  
FUNCTION ResetIndex(bKeepIndexObject)  

Reset all index information and objects

ParameterDescription
bKeepIndexObject [input, bopolean] do not drop the current Index object (coFTS)
Returns [boolean] returns retSUCCESS
FUNCTION ReturnSearch(index, keyValue$)  
FUNCTION ReturnSearch(index, keyValue$, dataValue$)  
FUNCTION ReturnSearch(index, keyValue$, dataValue$, storedValue$)  
FUNCTION ReturnSearch(index, keyValue$, dataValue$, storedValue$, dataRec$)  

Get data returned by search

ParameterDescription
index [input / output, number] Index to returned value in the list of search results
keyValue$ [output, string, required] Key value for the selected row from result set
dataValue$ [output, string, optional] Data value for the selected row from result set
storedValue$ [output, string, optional] Stored value for the selected row from result set
dataRec$ [output, string, optional] Data record to be used by MLAC for selected index (Only returned when index is encrypted)
Returns [boolean] 0 - No Data Found, 1 - Data Found
FUNCTION SearchIndex(searchValue$)  
FUNCTION SearchIndex(searchValue$, bUseAsPassed)  

Do a search within specified entity for search value

ParameterDescription
searchValue$ [input, string] The value to use for the search
bUseAsPassed [input, boolean] If true, use search value with no changes
Returns [boolean] retSUCCESS(1) for a successful search, retFAILURE(0) when an exception is returned from the search DLL
FUNCTION SetEntityKeyValue(entityKeyValue$)  

Set value to override the default entity key value (current company code)

ParameterDescription
entityKeyValue$ [input, string] new value for entity key value
Returns [boolean] returns retSUCCESS
FUNCTION SetEntityName(in.Name$)  

Set value for the entity name

ParameterDescription
in.Name$ [input, string] new value for entity name
Returns [boolean] returns retSUCCESS
FUNCTION SetSkipProgessBar()  

Set local property to skip display of progressBar to TRUE

Returns [boolean] returns retSUCCESS
FUNCTION UpdateDocument(in.Company$, in.Name$, in.KeyValue$, in.DataValue$)  
FUNCTION UpdateDocument(in.Company$, in.Name$, in.KeyValue$, in.DataValue$, in.StoredValue$)  

Update document in index for specified company, entity name, and document key

ParameterDescription
in.Company$ [input, string] Company code for the document
in.Name$ [input, string] Entity Name for the document
in.KeyValue$ [input, string] Key value for the document
in.DataValue$ [input, string] Data value for the document
in.StoredValue$ [input, string, optional] Stored value for the document
Returns [boolean] 0 - update failed, 1 - update successful
FUNCTION LOCAL FreeIndexDocumentObjects()  

Free standard document objects defined in this class

Returns [boolean] returns retSUCCESS
FUNCTION LOCAL GetEntityKeyValue$()  

Get value for the EntityKey field used in the search index

Returns [string] A string containing the value for the EntityKey field
Info

The default value is the current company code; the child class can override this method to set a different value

FUNCTION LOCAL InitSearchObject()  

Initialize a Sage.Data.Search object.

Returns [boolean] 0 - Failure, 1 - Success
FUNCTION LOCAL IsRebBuildRequired()  
FUNCTION LOCAL IsRebBuildRequired(bClear)  

Check to see if the index has been flagged to require a rebuild

ParameterDescription
bClear [input, boolean, optional] When set, will delete the file used to indicate a rebuild of index is required
Returns [boolean] 0 - (isFALSE) No rebuild required, 1 - (isTRUE) Index requires a rebuild
FUNCTION LOCAL ShowProgressBar()  

Initialize ProgressBar

Returns [boolean] retSUCCESS (1)
FUNCTION LOCAL TranslateIndexData$(data$)  

Function to translate the default field separator to alternate field separator to store in index

ParameterDescription
data$ [input] Data value for the selected row for result set being indexed.
Returns [string] The translated data value.
FUNCTION LOCAL TranslateSearchData$(data$)  

Function to translate the index data delimiter to default field separator

ParameterDescription
data$ [input] Data value for the row to be loaded in the ALE list box.
Returns [string] The translated data value.
FUNCTION LOCAL UpdateIndex()  

Begin / End a batched update process by acquiring an IndexWriter that will be used during the update process

Returns [boolean] returns retSUCCESS
Info

This method is used by BuildIndex() to begin / end the process to add data into the search index.

FUNCTION LOCAL UpdateProgressBar(message$)  

Update Progress Bar

ParameterDescription
message [input, string] message to display in progress bar
Returns [boolean] retSUCCESS (1)
FUNCTION LOCAL WriteBuildIndexLog(message$)  

Write message to build index log file which is created in the search index folder

ParameterDescription
message [input, string] message to display in progress bar
Returns [boolean] retSUCCESS (1)

Properties inherited from: SY_Constant

retFAILURE, retSUCCESS, retNEW, retWARNING, retCANCEL, retYES, retNO, msgYES$, msgNO$, msgCANCEL$, msgOK$, msgRETRY$, msgABORT$, msgIGNORE$, msgNOTONFILE$, msgTIMEOUT$, msgDISABLE, msgACTIVE, msgLinkHELP$, msgLinkMSG$, isFALSE, isTRUE, isYES$, isNO$, isBUSY$, edtNONE, edtEXISTS, edtNEW, ctlDISABLE, ctlENABLE, ctlSHOW, ctlHIDE, ctlLOCK, ctlUNLOCK, ctlLOCKORDISABLE, ctlUNLOCKORENABLE, popHIDE, popDISABLE, popSHOW, popSHOWCHECKED, grdMODEVIEW, grdMODEMAINT, grdMODEADD, filCREATE, filLOCK, filCREATELOCK, filGLOBAL, filCREATEGLOBAL, filLOCKGLOBAL, filCREATELOCKGLOBAL, filCHANNEL, filRAW, filPURGE, filLOAD, filINPUT, filNOOBJECT, filPVX, filREFRESH, filPVX4$, filPVX5$, pthCOMPANY$, pthOTHERCOMPANY$, pthPRCOMPANY$, pthOTHERPRCOMPANY$, pthSYSTEM$, pthUSER$, pthSOA$, pthHOME$, pthROOT$, pthDICTIONARY$, pthTEXTOUT$, pthLOCK$, pthLOCKSYS$, pthPREFIX$, pthARCHIVE$, pthLOGFILES$, folderPROGRAMFILES, folderPROGRAMFILESX86, folderCOMMONAPPLICATIONDATA, folderCOMMONPROGRAMFILES, folderCOMMONPROGRAMFILESX86, errOBJECT, errSYSTEMLOCK, errCONTINUE, errEMBEDDEDIO, errSYSLOCK, extSQLCREATETABLE$, extSQLALLOWNULLDATES$, envSPP$, envDEFAULT$, dbALL$, dbNONE$, dateTOSTRINGFORMAT$, dateLONGMASK$, dateSHORTFMT, dateLONGFMT, dateYEARFIRST, dateMONTHFIRST, dateDAYFIRST, timeMINUTESMASK$, timeMINUTES24MASK$, timeSECONDSMASK$, timeSECONDS24MASK$, idxPRIMARY$, idxBATCH$, idxDISPLAY$, dirFIRST, dirLAST, dirNEXT, dirPREVIOUS, typALPHANUM, typZEROFILL, typCHARNUM, typMASTERNUM, typALPHANUMNF, typMASTERNUMC, typMASTERNUMI, typALPHA$, typNUMBERS$, typALPHANUM$, typALPHANUMNF$, typCHARNUM$, typMASTERNUM$, typMASTERNUMCLEN, modTASKOTFDISALLOW$, logALLACTIVITY$, logACTIVITY$, logERROR$, logACTNEWCUSTOMER$, logACTDATASYNC$, logACTDATAIMPORT$, logACTOPTIONCHANGED$, logACTPROGRAMLAUNCH$, logDFDM$, logSECURITY$, logTASKSCHEDULER$, logWEBERROR$, logVISUALINTEGRATOR$, logEntryIDLength, chkOFF$, chkON$, chkGRAYED$, closeTaskLAUNCHERQUIT, closeTaskSHUTDOWNALL, closeTaskMASTERCONSOLE, closeTaskAUTOLOGOFF, closeTaskDESCRIPTIONS$, secVIEWONLY, secCREATEONLY, secMODIFYONLY, secCREATEMODIFY, secDELETEONLY, secCREATEDELETE, secMODIFYDELETE, secFULLACCESS, secDEFAULTUSER$, secDEFAULTROLE$, secDEFAULTCOMPANY$, regHKEY_CLASSES_ROOT, regHKEY_CURRENT_USER, regHKEY_LOCAL_MACHINE, regHKEY_USERS, regHKEY_CURRENT_CONFIG, regODBC_PATH$, regMAS_PATH$, E3_MYHANDLE, E3_TASK, E3_QUIT, E3_COCHANGE, E3_DATECHANGE, E3_USERCHANGE, E3_SRVRPATH, E3_HELPFILE, E3_TECHSUPPORT, E3_QUERYTOQUIT, E3_SUPERVISOR, E3_CUSTOMIZE, E3_SWITCHMODULE, E3_DISABLEWIN, E3_CURSOR, E3_USERID, E3_PRIVATETASK, E3_CHAT, E3_BROADCAST, E3_RELOAD, E3_PASSTHROUGH, E3_EXECUTE, E3_EXPCOCHANGE, E3_EXPTASK, E3_EXPLAUNCH, E3_SILENT, E3_DIRECT, E3_NODELIST, E3_OCXITEM, E3_MODULEID, E3_CUSTFAV, E3_HOMEPAGE, E3_MINIMIZE, E3_UNDOCKED, E3_DOCKED, E3_PUBLICTASK, E3_LAUNCHURL, E3_BTNCHANGE, E3_STDBTNRELOAD, E3_MYBUSINESS, E3_REGLOADED, E3_LOADED, E3_V4TASK, E3_PUBMODIFY, E3_TASKRELOAD, E3_SETAUTOHIDE, E3_COCHANGE2, E3_TASK_NC, E3_V4TASK_NC, E3_TASK_ALTC, E3_V4TASK_ALTC, E3_PASSWORD, E3_LAUNCHVIEW, E3_LAUNCHBIETASK, E3_CLEANUPBIE, E3_STARTVIEW, E3_BIE_ADMIN, E3_HELPPATH, E3_CUSTOMERID, E3_MASVERSION, E3_LAUNCHEMBEDDED, E3_LAUNCHERMENU, E3_APP_POINTSIZE, E3_LAUNCHERVERSION, E3_DISABLE, E3_ENABLE, E3_SHOW, E3_HIDE, E3_REFRESH, E3_LIBMASTER, WM_COPY, usrDspLOGON$, usrDspNAME$, usrDspCODE$, usrDspEMAIL$, wtsINITIALPROGRAM, wtsAPPLICATIONNAME, wtsWORKINGDIRECTORY, wtsOEMID, wtsSESSIONID, wtsUSERNAME, wtsWINSTATIONNAME, wtsDOMAINNAME, wtsCONNECTSTATE, wtsCLIENTBUILDNUMBER, wtsCLIENTNAME, wtsCLIENTDIRECTORY, wtsCLIENTPRODUCTID, wtsCLIENTHARDWAREID, wtsCLIENTADDRESS, wtsCLIENTDISPLAY, wtsCLIENTPROTOCOLTYPE, thmNORMAL, thmMETAL, thmOLIVE, rptREPORTTYPESTD, rptREPORTTYPELABEL, rptREPORTTYPEMULTCOL, rptISTRUE, rptISFALSE, rptISDEFAULT, rptPORTRAIT, rptLANDSCAPE, rptASCENDING, rptDESCENDING, rptRIGHTALIGN, rptLEFTALIGN, rptHORCENTERALIGN, rptLSSINGLELINE, rptSTSUM, rptSTAVERAGE, rptSTCOUNT, rptDFLTHSPACING, rptDFLTVSPACING, rptDFLTFONTSIZE, rptDFLTLEFT, rptDFLTTOP, rptTWIPSPERCHARW, rptTWIPSPERCHARH, rptSVTREPORTTITLE, rptEDTDISKFILE, rptGCANYVALUE, rptGCDAILY, rptCRDATEFIELD, rptCRDATETIMEFIELD, crEFTCrystalReport, crEFTRichText, crEFTWordForWindows, crEFTExcel, crEFTPortableDocFormat, crEFTHTML32, crEFTHTML40, crEFTExcelRecord, crEFTText, crEFTCharacterSeparatedValues, crEFTTabSeparatedText, crEFTEditableRTF, crEFTXml, crEFTRPTR, crEFTExcelWorkbook, cContextKeyLen1, cContextKeyLen2, cContextKeyLen3, adCmdText, adCmdStoredProc, adClipString, adExecuteNoRecords, adVarChar, adInteger, adParamInput, adParamOutput, adParamInputOutput, adParamReturnValue, adTextNoRecords, adOpenForwardOnly, adOpenStatic, adLockReadOnly, adUseServer, adUseClient, dbTMP$, dbTEMPDB$, dbSYSDB$, dbPVXDDF, dbPVXDB, dbMYSQL, dbADO, dbSQL, sqlSQLOLEDB$, LastErrorMsg$, LastErrorNum$, RoleTypes$, SageCloudAppDesc$, IolNomads$

Methods inherited from: SY_Constant

GetNOMADSIolist$(), GetRoleTypes$(), MaskString(), RawString(), ClassValidateEMailAddress(), dateTODAY$(), Element$(), fmtMODCODE$(), fmtMODPREFIX$(), PERFORM FunctionBreak(), GetExceptionMsg$(), GetFileName(), GetJobTitle$(), GetJobTitles(), GetPrinterProps(), GetRecordCount(), isALPHA(), isDATE(), isNUMERIC(), MsgPath$(), ParseString(), ParseTagField(), Position(), QUO$(), ValidateFormatType(), ZeroFill$()