Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter and WHERE
Message
 
 
To
05/06/2008 19:25:25
Scott Malinowski
Arizona Fox Software LLC
Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01294821
Message ID:
01322009
Views:
28
>>>That may be a problem. The search form I am using has a grid on it. Calling the CursorFill() method does funky things to grids when you change requery the cursor adapter. I need to use CursorRefresh() to make the grid behave properly. So, maybe this solution may not work to solve my problem?
>>>
>>>Scott
>>
>>Don't bind your grid to the CA directly. Use a separate cursor for the grid with safe select approach.
>>
>>I need to post my Search class here based on CA.
>
>Naomi,
>
>I have a separate cursor adapter class just for the grid. Actually it's part of a business object that is based on the dataenvironment class. For the search form it has two cursor adapters, one for a drop down object that needs to populated during the form init and then the grid cursor adapter which gets populated when the user fills out the form and clicks on the Search button.
>
>I must confess that I do not know what you mean by the safe select approach. What is that?
>
>Scott

Here is my biz object for the Search (I removed some extra methods):
**************************************************
*-- Class:        searchobject (c:\mmviscollect\libs\asearchbiz.vcx)
*-- ParentClass:  abizobj (c:\mmviscollect\libs\abizness.vcx)
*-- BaseClass:    container
*-- Time Stamp:   08/02/06 12:43:08 PM
*-- Business object for the Search form.
*
#INCLUDE "c:\mmviscollect\include\appincl.h"
*
DEFINE CLASS searchobject AS abizobj


	Width = 88
	Height = 18
	*-- This property sets the limit of the number of returned records to display
	nMaxRecordsToDisplay = 500

	*-- Number of records returned by the search
	nRecords = 0

	cUniqueIDField = "cTrans_Pk"
	lConfirmOnDelete = .F.

	cBizRules = "SearchRules"
	cGroupID = ""
	cNavAlias = "c_Search"
	Name = "searchobject"
	oDELoader.oDELoader.Caption = "SearchObject"
	oDELoader.oDELoader.Name = "oDELoader"
	oDELoader.Top = 0
	oDELoader.Left = 12
	oDELoader.Width = 72
	oDELoader.Height = 16
	oDELoader.cdataenvironment = "search_env"
	oDELoader.Name = "oDELoader"

	*-- This property tells, if we want an exact match or not
	lExactMatch = .F.

	*-- If the user wanted to stop execution, but changed his/her mind, we need to requery again
	lRepeatRequery = .F.

	*-- This property is set to true if no records selected
	lNoRecordsSelected = .F.

	*-- If this property is set to true, some additional predefined criteria are used
	lPredefinedCriteria = .F.

	*-- This is an array property to hold temp aliases.
	DIMENSION aTempAliases[1]


	*-- This method  "joins"  two views together
	PROCEDURE  PopulateCursor
		*---------------------- Location Section ------------------------
		*   Library: 	ASearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	Populatecursor()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	01/05/2005 - NN
		*		MODIFIED    *-- CHANGE - NN - January 19, 2005 - 12:46:46
		**      -- CHANGE - NN - February 01, 2005 - 15:13:16
		*-- CHANGE - NN - February 09, 2005 - 11:47:23
		**-- CHANGE - NN - March 22, 2005 - 11:40:58
		*----------------------------------------------------------------
		lparameters tcClientAcctNum, tcLast, ;
			tcFirst, tcMiddle, tcAreaCode, tcExchange, tcLastFour, ;
			tcSSN, tcPolicyNumber, tcMedicaidNumber

		local llReturn, laVals[1,2], lnReccount
		this.EmptySearchResult()

		llReturn = .t.
		lnReccount = 0
		** Client Account Number
		if !empty(m.tcClientAcctNum)
			laVals[1,1] = "ClientAcctNum"
			laVals[1,2] = m.tcClientAcctNum
			llReturn = this.GetWhereExpr([hospitalacctnum], @laVals)
		endif
		* Name
		if m.llReturn and !empty(m.tcLast)
			laVals[1,1] = "LastName"
			laVals[1,2] = m.tcLast
			if !empty(m.tcFirst)
				dimension laVals[2,2]
				laVals[2,1] = "FirstName"
				laVals[2,2] = m.tcFirst
			endif
			if !empty(m.tcMiddle)
				dimension laVals[3,2]
				laVals[3,1] = "MiddleInitial"
				laVals[3,2] = m.tcMiddle
			endif
			llReturn = this.GetWhereExpr([patientname], @laVals)
		endif

		* Phone
		if m.llReturn and !empty(m.tcExchange)
			laVals[1,1] = "Exchange"
			laVals[1,2] = m.tcExchange
			if !empty(m.tcAreaCode)
				dimension laVals[2,2]
				laVals[2,1] = "AreaCode"
				laVals[2,2] = m.tcAreaCode
			endif
			if !empty(m.tcLastFour)
				dimension laVals[3,2]
				laVals[3,1] = "LastFour"
				laVals[3,2] = m.tcLastFour
			endif
			llReturn = this.GetWhereExpr([patientphone], @laVals)
		endif
		* SSN
		if m.llReturn and !empty(m.tcSSN)
			laVals[1,1] = "SSN"
			laVals[1,2] = m.tcSSN
			llReturn = this.GetWhereExpr([patientssn], @laVals)
		endif
		** Policy Number
		if m.llReturn and !empty(m.tcPolicyNumber)
			laVals[1,1] = "PolicyNumber"
			laVals[1,2] = m.tcPolicyNumber
			llReturn = this.GetWhereExpr([policynumber], @laVals)
		endif

		** Medicaid Number
		if m.llReturn and !empty(m.tcMedicaidNumber)
			laVals[1,1] = "MedicaidNumber"
			laVals[1,2] = m.tcMedicaidNumber
			llReturn = this.GetWhereExpr([medicaidnumber], @laVals)
		endif

		if m.llReturn
			lnReccount = this.RunSearch()
		endif

		return m.lnReccount
	ENDPROC


	*-- This method zaps the resulting cursor
	PROCEDURE  EmptySearchResult
		*---------------------- Location Section ------------------------
		*   Library: 	ASearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	EmptySearchResult()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	01/12/2005 - NN
		*		MODIFIED    05/18/2005 - NN
		*----------------------------------------------------------------
		local lnI
		for lnI = 1 to alen(this.aTempAliases)
			if not empty(this.aTempAliases[m.lnI])
				use in select(this.aTempAliases[m.lnI])
			endif
		next
		dimension this.aTempAliases[1] && Reset the array
		store "" to this.cWhereExpr, this.cJoinExpr
		this.oBizRules.ClearAllRules()
		this.oBizRules.ClearAllWarnings()
		this.lNoRecordsSelected = .f.
		this.nRecords = 0
		zap in c_Search
	ENDPROC


	*-- This method scans the view and inserts records into the final cursor
	PROCEDURE CreateFinalResult
		*---------------------- Location Section ------------------------
		*   Library: 	ASearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	CreateFinalResult()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	01/24/2005 - NN
		*		MODIFIED   *-- CHANGE - NN - January 25, 2005 - 14:31:02
		*-- CHANGE - NN - February 09, 2005 - 12:40:28
		**-- CHANGE - NN - February 25, 2005 - 13:26:18
		*----------------------------------------------------------------
		if vartype(m.plStop) <> "L"
			local plStop
			plStop = .f.
		endif

		local lnRequeryResult, loDE, loCursor, loCursorAdapter, lnCountRecords, lnReccount

		loDE = this.GetDataEnvironment()
		loCursor = m.loDE.GetCursorObject("ca_Search")
		loCursorAdapter = m.loCursor.oCursorAdapter
		lnCountRecords = this.nRecords && Number of records from the count
		lnRequeryResult = this.requery(.t., "ca_Search")

		do while m.loCursorAdapter.lRepeatRequery = .t. and ;
			m.lnRequeryResult <> REQUERY_SUCCESS && the user tried to stop it
			lnRequeryResult = this.requery(.t., "ca_Search")
			m.loCursorAdapter.lRepeatRequery = .f.
		enddo

		if m.plStop = .t.
			lnReccount = 0
		else
			lnReccount = reccount("ca_Search")
		endif

		wait clear

		if m.lnReccount > 0
			select c_Search
			do while not m.plStop and reccount('c_Search') < reccount("ca_Search")
				append from dbf("ca_Search") for not m.plStop
			enddo

			go top in c_Search
		endif


		if m.plStop
			this.EmptySearchResult() && Search was cancelled
		endif

		this.nRecords = reccount("c_Search")

		return this.nRecords
	ENDPROC


	*-- This method is used, if we want to execute part of the search to temp file.
	PROCEDURE GetIntermediateResult
		*---------------------- Location Section ------------------------
		*   Library: 	Asearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	Getintermediateresult()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	05/18/2005 - NN
		*		MODIFIED
		*----------------------------------------------------------------
		lparameters tcSearchType, taVals
		* Medicaid Number
		external array taVals
		local llReturn
		llReturn = .t.
		do case
		case m.tcSearchType = [medicaidnumber]
			if Insurances_Lookup_By_MedicaidNumber(taVals[1,2], "cTemp_Insurances_Medicaid") ;
					and reccount("cTemp_Insurances_Medicaid") > 0
				this.cJoinExpr = ADDJOIN + ;
					[INNER JOIN cTemp_Insurances_Medicaid ] + ;
					[on Trans.cTrans_pk = cTemp_Insurances_Medicaid.cTrans_fk]
				if empty(this.aTempAliases[1])
					this.aTempAliases[1] = "cTemp_Insurances_Medicaid"
				else
					local lnLen
					lnLen = alen(this.aTempAliases)
					dimension this.aTempAliases[m.lnLen + 1]
					this.aTempAliases[m.lnLen + 1] = "cTemp_Insurances_Medicaid"
				endif
			else
				llReturn = .f.
			endif
		** Policy Number
		case m.tcSearchType = [policynumber]
			if Insurances_Lookup_By_PolicyNumber(taVals[1,2], "cTemp_Insurances_Policy") ;
					and reccount("cTemp_Insurances_Policy") > 0
				this.cJoinExpr = ADDJOIN + ;
					[INNER JOIN cTemp_Insurances_Policy ] + ;
					[on Trans.cTrans_pk = cTemp_Insurances_Policy.cTrans_fk]
				if empty(this.aTempAliases[1])
					this.aTempAliases[1] = "cTemp_Insurances_Policy"
				else
					local lnLen
					lnLen = alen(this.aTempAliases)
					dimension this.aTempAliases[m.lnLen + 1]
					this.aTempAliases[m.lnLen + 1] = "cTemp_Insurances_Policy"
				endif
			else
				llReturn = .f.
			endif
		** Queue Date and Name
		case m.tcSearchType = [queuedate]
			local ldDateFrom, ldDateTo, lcUsGrLink_fk, lcQueue_Names_fk
			lcUsGrLink_fk = m.goApp.cUsGrLink
			store {} to ldDateFrom, ldDateTo
			for lnI = 1 to alen(taVals,1)
				if lower(taVals[m.lnI,1]) = "datefrom"
					ldDateFrom = taVals[m.lnI,2]
				endif
				if lower(taVals[m.lnI,1]) = "dateto"
					ldDateTo = taVals[m.lnI,2]
				endif
				if lower(taVals[m.lnI,1]) = "queuename"
					lcQueue_Names_fk = taVals[m.lnI,2]
				endif
			next

			if GetQueuesByDates(m.lcUsGrLink_fk, m.lcQueue_Names_fk, m.ldDateFrom, ;
					m.ldDateTo, "cTemp_QueueByDate") ;
					and reccount("cTemp_QueueByDate") > 0
				this.cJoinExpr = ADDJOIN + ;
					[INNER JOIN cTemp_QueueByDate ] + ;
					[ON Trans.cTrans_pk = cTemp_QueueByDate.cTrans_fk]
				if empty(this.aTempAliases[1])
					this.aTempAliases[1] = "cTemp_QueueByDate"
				else
					local lnLen
					lnLen = alen(this.aTempAliases)
					dimension this.aTempAliases[m.lnLen + 1]
					this.aTempAliases[m.lnLen + 1] = "cTemp_QueueByDate"
				endif
			else
				llReturn = .f.
			endif
		endcase

		return m.llReturn
	ENDPROC


	*-- This method counts records that satisfy user's defined criteria and then runs the search
	PROCEDURE RunSearch
		*---------------------- Location Section ------------------------
		*   Library: 	Asearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	RunSearch()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	05/18/2005 - NN
		*		MODIFIED
		*----------------------------------------------------------------
		local loSelect, loDE, loCursor, lcSelectCMDFilter, lcCountSelectCMD, ;
			lcBaseSelectCMD, loCursorAdapter, lnReccount, lcFields
		if this.lBatch_payments 
			lnReccount = this.PrepareData()
			if m.lnReccount = 0
				this.lNoRecordsSelected = .t.
				return 0
			endif
		endif
		loDE = this.GetDataEnvironment()
		loCursor = m.loDE.GetCursorObject("ca_Search")
		loCursorAdapter = m.loCursor.oCursorAdapter
		lnReccount = 0
		this.nRecords = 0

		text TO lcCountSelectCMD NOSHOW PRETEXT 2
			SELECT COUNT (distinct cTrans_pk) as cntRecs ;
				FROM trans INNER JOIN Patients ;
				ON Patients.cPatients_pk = Trans.cPatients_fk INNER JOIN Names ;
				ON Patients.cPatients_pk = Names.cPointer_fk
		ENDTEXT
		if this.lBatch_payments 
			lcCountSelectCMD = m.lcCountSelectCMD + " INNER JOIN curHoldData on Trans.cTrans_pk = curHoldData.cTrans_fk"
		endif
		lcCountSelectCMD = m.lcCountSelectCMD + iif(empty(this.cJoinExpr),"", " " + this.cJoinExpr)
		lcCountSelectCMD = strtran(strtran(m.lcCountSelectCMD,";",[]), chr(13) + chr(10), [])
		if this.lBatch_payments 
			text TO lcFields NOSHOW PRETEXT 2
				Trans.cTrans_pk, Trans.cClient_account_number, Patients.cPatients_pk, ;
				Patients.dDob, Trans.tAdmit_date, Trans.yCurrent_Balance_Amount, ;
				Names.cPointer_fk, Names.cAlias_name_fk, ;
				PADR(NVL(ALLTRIM(Names.cl_name)+", ", "") + ;
				NVL(ALLTRIM(Names.cf_name)+" ", "") + ;
				NVL(Names.cm_initial, ""), 50) AS cName, ;
				Trans.cCommissioned_Owner as cUserID,  ;
		        ttod(Trans.tResolution_Date) as dClose_Date, ;
		        curHoldData.iBatch_Number, curHoldData.cFile_Type, ;
		        curHoldData.cError as cReason, curHoldData.cDeptCode, ;
		        curHoldData.dPaid_Date, curHoldData.yAmt_Paid
			ENDTEXT
		else
		text TO lcFields NOSHOW PRETEXT 2
				Trans.cTrans_pk, Trans.cClient_account_number, Patients.cPatients_pk, ;
				Patients.dDob, Trans.tAdmit_date, Trans.yCurrent_Balance_Amount, ;
				Names.cPointer_fk, Names.cAlias_name_fk, ;
				PADR(NVL(ALLTRIM(Names.cl_name)+", ", "") + ;
				NVL(ALLTRIM(Names.cf_name)+" ", "") + ;
				NVL(Names.cm_initial, ""), 50) AS cName, ;
				Client_Product_lines.cProduct_line, ;
				Trans.cCommissioned_Owner as cUserID,  ;
		        IIF(ISNULL(Trans.cResolution_Codes_fk), ;
		        VisC.cCode_Description, VisCo.cCode_Description) as cStatus, ;
		        VisC.cCode_Description as cReal_Status, ;
		        VisCo.cCode_Description as cReal_Resolution
		ENDTEXT
		endif
		if this.lPredefinedCriteria
			lcFields = m.lcFields + ", Employee_Queue_Schedules.tScheduled_Time, " + ;
				"Employee_Queue_Schedules.cEmployee_queue_schedules_pk, " + ;
				"Trans_Employees_queues.cTrans_Employees_queues_pk, " + ;
				"Trans_Employees_queues.cQueue_Names_fk"
		endif
		if this.lBatch_payments 
		text TO lcBaseSelectCMD NOSHOW PRETEXT 2
			SELECT DISTINCT ##FIELDS## ;
				FROM trans INNER JOIN Patients ;
				ON Patients.cpatients_pk = Trans.cPatients_fk INNER JOIN names ;
				ON Patients.cpatients_pk = Names.cPointer_fk ;
				inner join curHoldData on Trans.cTrans_pk = curHoldData.cTrans_fk
		ENDTEXT

		else
		text TO lcBaseSelectCMD NOSHOW PRETEXT 2
			SELECT DISTINCT ##FIELDS## ;
				FROM trans INNER JOIN Patients ;
				ON Patients.cpatients_pk = Trans.cPatients_fk INNER JOIN names ;
				ON Patients.cpatients_pk = Names.cPointer_fk ;
				INNER JOIN Client_Product_lines ;
				ON Client_Product_lines.cClient_Product_lines_pk = Trans.cClient_Product_lines_fk ;
				LEFT JOIN VisCodes VisC ON Trans.cStatus_codes_fk = VisC.cVisCodes_pk ;
				LEFT JOIN VisCodes VisCo ON Trans.cResolution_codes_fk = VisCo.cVisCodes_pk
		ENDTEXT
		endif
		lcBaseSelectCMD = m.lcBaseSelectCMD + iif(empty(this.cJoinExpr),"", " " + this.cJoinExpr)
		lcBaseSelectCMD = strtran(strtran(strtran(m.lcBaseSelectCMD,"##FIELDS##",m.lcFields),";",[]), chr(13) + chr(10), [])

		if not 'cl_name' $ lower(this.cWhereExpr)
			this.cWhereExpr = this.cWhereExpr + ' AND Names.iAlias_Flag = 0'
		endif

		lcSelectCMDFilter = this.cWhereExpr

		with this
			.lRepeatRequery = .f.

		** These commands should change CursorAdapter's SelectCMD
			loCursorAdapter.cBaseSelectCmd = m.lcCountSelectCMD
			loCursorAdapter.cSelectCmdFilter = m.lcSelectCMDFilter

		*	_cliptext = loCursorAdapter.selectcmd && Don't need it anymore

			local lnRequeryResult
			lnRequeryResult = .requery(.t., "ca_Search")

			do while m.loCursorAdapter.lRepeatRequery = .t. and m.lnRequeryResult <> REQUERY_SUCCESS && the user tried to stop it
				lnRequeryResult = .requery(.t., "ca_Search")
				loCursorAdapter.lRepeatRequery = .f.
			enddo
			if m.lnRequeryResult <> REQUERY_SUCCESS && Something went wrong
				lnReccount = 0
		** we don't want to proceed with the code
				.lError = .t.
			else
				if vartype(m.plStop) = "L" and m.plStop = .t.
					lnReccount = 0
				else
					lnReccount = ca_Search.cntRecs
					.nRecords = m.lnReccount
					if .nRecords = 0
						.lNoRecordsSelected = .t.
					endif
				endif
				loCursorAdapter.cBaseSelectCmd = m.lcBaseSelectCMD
				if  .nRecords > 0 and .nRecords <= .nMaxRecordsToDisplay
					lnReccount = .CreateFinalResult()
				endif
			endif
		endwith

		return m.lnReccount
	ENDPROC


	*-- This method sets based CMD for CA
	PROCEDURE SetBaseCmd
		*---------------------- Location Section ------------------------
		*   Library: 	Asearchbiz.vcx
		*   Class: 		Searchobject  
		*   Method: 	Setbasecmd() 
		*----------------------- Usage Section --------------------------
		*)  Description: 
		*)

		*   Scope:      Public
		*   Parameters: 
		*$  Usage:      
		*$              
		*   Returns:  
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	12/21/2005 - NN 
		*		MODIFIED
		*----------------------------------------------------------------
		local loSelect, loDE, loCursor, ;
			lcBaseSelectCMD, loCursorAdapter, lnReccount, lcFields

		loDE = this.GetDataEnvironment()
		loCursor = loDE.GetCursorObject("ca_Search")
		loCursorAdapter = m.loCursor.oCursorAdapter
		lnReccount = 0
		this.nRecords = 0

		text TO lcFields NOSHOW PRETEXT 2
				Trans.cTrans_pk, Trans.cClient_account_number, Patients.cPatients_pk, ;
				Patients.dDob, Trans.tAdmit_date, Trans.yCurrent_Balance_Amount, ;
				Names.cPointer_fk, Names.cAlias_name_fk, ;
				PADR(NVL(ALLTRIM(Names.cl_name)+", ", "") + ;
				NVL(ALLTRIM(Names.cf_name)+" ", "") + ;
				NVL(Names.cm_Initial, ""), 50) AS cName, ;
				Client_Product_lines.cProduct_line, ;
				Trans.cCommissioned_Owner as cUserID,  ;
		        VisC.cCode_Description as cStatus, ;
		        VisC.cCode_Description as cReal_Status, ;
		        SPACE(100) as cReal_Resolution
		ENDTEXT

		text TO lcBaseSelectCMD NOSHOW PRETEXT 2
			SELECT DISTINCT ##FIELDS## ;
				FROM trans INNER JOIN Patients ;
				ON Patients.cPatients_pk = Trans.cPatients_fk INNER JOIN Names ;
				ON Patients.cPatients_pk = Names.cPointer_fk ;
				LEFT JOIN VisCodes VisC ON Trans.cStatus_codes_fk = VisC.cVisCodes_pk 
		ENDTEXT

		lcBaseSelectCMD = m.lcBaseSelectCMD + iif(empty(this.cJoinExpr),"", " " + this.cJoinExpr)
		lcBaseSelectCMD = strtran(strtran(strtran(m.lcBaseSelectCMD,"##FIELDS##",m.lcFields),";",[]), chr(13) + chr(10), [])

		loCursorAdapter.cBaseSelectCmd = m.lcBaseSelectCMD
		loCursorAdapter.cSelectCmdFilter = this.cWhereExpr
	ENDPROC


	PROCEDURE postinithook
		*---------------------- Location Section ------------------------
		*   Library: 	aSearchbiz.vcx
		*   Class: 		SearchObject
		*   Method: 	Postinithook()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	01/05/2005 - NN
		*		MODIFIED *-- CHANGE - NN - January 11, 2005 - 15:19:53
		*   *-- CHANGE - NN - February 09, 2005 - 11:36:07
		*----------------------------------------------------------------
		select 0
		if not this.lBatch_payments
			create cursor c_Search ;
				(cClient_Account_Number C(20) null, ;
				cName C(50) null, ;
				dDOB D null, ;
				tAdmit_date t null, ;
				tScheduled_Time t null, ;
				cProduct_Line C(60) null, ;
				yCurrent_Balance_Amount y null, ;
				cUserID C(10) null, ;
				cStatus C(230) null, ;
				cReal_Status C(230) null, ;
				cReal_Resolution C(230) null, ;
				cTrans_Pk C(16) not null, ;
				cPatients_pk C(16) not null, ;
				cTrans_Employees_Queues_Pk C(16) null, ;
				cEmployee_Queue_Schedules_pk C(16) null, ;
				cQueue_Names_fk C(16) null)
		* We're using these indexes in the grid's sorting
			index on cClient_Account_Number tag cClient
			index on cName tag cName
			index on dDOB tag dDOB
			index on tAdmit_date tag tAdmit
			index on cStatus tag cStatus
			index on cProduct_Line tag cProduct
			index on cUserID tag cUserID
			index on yCurrent_Balance_Amount tag yAmount
		else
			create cursor c_Search ;
				(cClient_Account_Number C(20) null, ;
				cName C(50) null, ;
				cFile_Type C(20) null, ;
				iBatch_Number I, ;
				tAdmit_date t null, ;
				tScheduled_Time t null, ;
				cReason C(50) null, ;
				dPaid_date D null, ;
				dClose_Date D null, ;
				yAmt_paid y null, ;
				cDeptCode C(1) null, ;
				cTrans_Pk C(16) not null, ;
				cPatients_pk C(16) not null, ;
				cTrans_Employees_Queues_Pk C(16) null, ;
				cEmployee_Queue_Schedules_pk C(16) null, ;
				cQueue_Names_fk C(16) null)

		* We're using these indexes in the grid's sorting
			index on cClient_Account_Number tag cClient
			index on iBatch_Number tag iBatch additive
			index on cName tag cName additive
			index on dClose_Date tag dCloseD additive
			index on tAdmit_date tag tAdmit additive
			index on cReason tag cReason additive
			index on dPaid_date tag dPaidD additive
			index on yAmt_paid tag yAmt_paid additive
			index on cFile_Type tag cFile_Type additive
		endif
		set order to
		*!*	* Add view parameter for ca_TransEmployeeSchedules
		this.AddViewParameter("vp_cTrans_FK","this.cTrans_FK","ca_TransEmployeeSchedules")
	ENDPROC


	PROCEDURE Error
		*---------------------- Location Section ------------------------
		*   Library: 	Asearchbiz.vcx
		*   Class: 		Searchobject
		*   Method: 	Error()
		*----------------------- Usage Section --------------------------
		*)  Description:
		*)

		*   Scope:      Public
		*   Parameters:
		*$  Usage:
		*$
		*   Returns:
		*--------------------- Maintenance Section ----------------------
		*   Change Log:
		*       CREATED 	05/15/2005 - NN
		*		MODIFIED
		*----------------------------------------------------------------
		lparameters tnError, tcMethod, tnLine, tcSys16, toErrObj, tcMessage
		if m.tnError = 1839 && SQL-Select was cancelled

			if vartype(m.plStop) = "L" and m.plStop
		* Have we stopped already?
				this.lRepeatRequery = .f.
			else
		* RETRY  - doesn't work
				this.lRepeatRequery = .t.
			endif
		else
			dodefault(m.tnError, m.tcMethod, m.tnLine, m.tcSys16, m.toErrObj, m.tcMessage)
		endif
	ENDPROC
ENDDEFINE
*
*-- EndDefine: searchobject
**************************************************
Note where I change the BaseSelectCMD.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform