Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter and WHERE
Message
 
 
To
05/06/2008 19:07:26
Scott Malinowski
Arizona Fox Software LLC
Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01294821
Message ID:
01322008
Views:
35
>Naomi,
>
>As always, thank you for you suggestions. If you get a chance and find that code, please send it. The more real code I can review, the better the chances for success in developing the data manager classes for our application.
>
>Thanks again!
>
>Scott

Hi Scott,

You're in luck! :) I got home today and grabbed some code for you and now I'm at the place where I can use Internet (should have been working on something else, though) <g>

Here is the Search method of the form:
*---------------------- Location Section ------------------------
*   Library: 	aFormsSearch.vcx
*   Class: 		FrmSearchParent
*   Method: 	Search()
*----------------------- Usage Section --------------------------
*)  Description:
*)

*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/05/2005 - NN
*		MODIFIED    *-- CHANGE - NN - May 22, 2005
*---------------------------------------------------------------------------------------------
#undef CRLF
#define CRLF chr(13) + chr(10)
private plStop
plStop = .f.

with thisform
	.WaitMode(.t.)

	if .grdSearch.lShowSortingArrows
		.grdSearch.ClearHeaderPictures()
	endif
	.oBizObj.EmptySearchResult()
	local loWaitMessage, loMessage, lcMessage, loThermo
	lcMessage = ""
	llReturn = .ValidateUserInput()
	if m.llReturn

		loWaitMessage = createobject("cWaitMessage", "Getting data...")
		loMessage = createobject("cMessage", "Getting data...")

		loThermo = createobject("cusSQLThermo")

		.ReallyLockScreen (.t.)
		if .oSearchCollection.requery() or .oBizObj.lNoRecordsSelected
			.ReallyLockScreen (.f.)
			if not m.plStop
				.nRecords = .oBizObj.nRecords
				loMessage.show("Your search produced " + transform(.nRecords) + " records. ")
				wait clear

				lcMessage = 'Records Found: ' + NumberCommas(.nRecords)

				if not m.plStop and .nRecords > 0 and reccount('c_Search') = 0 && Too many records
					if YesNo("Your search produced " + transform(.nRecords) + " records. " + CRLF + ;
							"It may take some time to display them." + CRLF + "Do you still want to proceed?")
						loWaitMessage.show ("Creating the final result... Please wait or press ESC to cancel")
						.ReallyLockScreen (.t.)
						.nRecords = .oBizObj.CreateFinalResult()
						.ReallyLockScreen (.f.)
					else
						lcMessage = "Too many records to display " + "(" + ;
							NumberCommas(.nRecords) + ")"
					endif
				endif
				release loThermo

				if .nRecords = 0 or reccount(.grdSearch.recordsource) = 0
*------------------------------------
*--- No records found. Disable the
*--- grid and the Select button
*------------------------------------
					store .f. to .cmdSelect.enabled, .grdSearch.enabled

					if not m.plStop and .nRecords = 0
						if not .oBizObj.lError && otherwise the error was already reported
							MsgSvc('ErrorMsgDisplayValueOfVariable',.cNoRecordsMsg)
						endif

						lcMessage = 'No records to display'
					endif

					.SetFocusToFirst(thisform)
				else
*---------------------------------------
*--- Records found. Enable the grid
*--- and the Select button. Set focus
*--- to the grid
*---------------------------------------
					goto top

					store .t. to .cmdSelect.enabled, .cmdCancel.enabled, .grdSearch.enabled

					.grdSearch.setfocus()
					lcMessage = 'Records Found: ' + NumberCommas(.nRecords)
					.grdSearch.highlightstyle = 2
					.cmdCancel.caption = "\<Clear" && It's now clear, not cancel
				endif
				.ReallyLockScreen (.f.)
			endif
		else
** Something went wrong
		endif

		if m.plStop
			.ReallyLockScreen (.f.)
			=ErrorMsg ('Search was cancelled!')
			lcMessage = 'Search was cancelled '
		endif
	endif

	.WaitMode(.f.)

	if m.plStop && Search was cancelled, clear the results
		.oBizObj.EmptySearchResult()
	endif
	.grdSearch.refresh()
	release loMessage, loWaitMessage
	.ChangeFormTitle(m.lcMessage)
	set message to .caption
	.cls()
endwith
plStop = .f.

return m.llReturn
I'll send the SearchBiz object code in a separate message.

Hope this helps.
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