Developing Custom Query Builders in Visual FoxPro

From Lianjapedia
Jump to: navigation, search

The Lianja App Builder provides functionality that allows you to build your own custom search and/or query builders.

The Section header has a "Search" icon and a "Custom search delegate" (configurable in the attributes dialog).

This provides the ability to popup a BROWSE grid, select an item and refresh the Section on the specified record. The delegate could show a complete query builder or whatever else you need in your UI.

Here is an example of what you can do when the "Search" icon is clicked.

Custom search


The code in the custom search delegate is simply this but it could be a modal "form" built out of the Lianja UI Framework components. Obviously this can be written in any of the supported scripting languages. This example is written in Lianja/Visual FoxPro.

////////////////////////////////////////////////////////////////
// Event delegate for 'customsearch' event
proc Customers_section1_customsearch()
	m_recno = recno()
	m_select = select()
	select customers
	browse caption "Customers" noedit ;
		fields companyname:h="Company Name" size 400,400 title "Select a Customer"
        select m_select
	if _result != 0
		Lianja.getElementByID("Customers.section1").goto(_result)
 		return
	endif
	goto m_recno
endproc