Picklist Lookup


Why does my keylookup returns false?

I want to connect my company_code [vt_employee] to the company_code[vt_company] to get the company name.

Here is my scenario:
1. I am using virtual tables from a mysql engine and successfully created a db in Lianja. The MySQL db itself had indexes.
2. Since the keylookup deals with indexes, I was thinking that perhaps my indexes were not incorporated to the virtual tables so I added the indexes in the console.

ALTER TABLE vt_employee ADD FOREIGN KEY (company_code) TAG company_code;

3. Added keylookup code :

(Get Data Map)
keylookup(“vt_company”, “company_code”, “{}”, name)

(Set Data Map)
keylookup(“vt_company”, “name”, “{}”, company_code)

Did I misunderstand the process or did I miss something? It doesnt work on the grid and on the form


This usage of data mapping against virtual tables using KEYLOOKUP() is not supported.

Index lookups in Lianja are only relevant to the embedded database engine.

With external SQL databases you need to perform a SQL SELECT in the get/set data mapping. You can accomplish this using a Lianja function in a custom library.

Be sure to create native indexes on the columns you want to lookup so that the query optimizer will use them for high speed row selections.

There have been several requests to provide the ability to drop down pick lists and custom forms beneath a UI control when editing a desktop form section.

I have added in some new functionality to enable this.

The “Form” class now has a new method called showDropDown(cControlID, nWidth, nHeight)

cCcontrolID is in the page1.section1.field1 notation and it identifies the UI control that you want to attach the DropDown Form to.

You can create the form inside a “DialogButton” delegate or in a hotkey delegate if you want to use function keys to drop down pick lists.

Hint: add a container to the form and set its layout to “grid” is the easiest way to create a responsive UI form.

// Example
myForm = createObject(“Form”)
// add a search panel, grid and command buttons
myForm.showDropDown(“page1.section1.field21”, 250, 250)

// You should have a means the close the DropDown Form such as a CommandButton click event

// closing the form will not destroy it rather it will hide it so it can be dropped down again

This mechanism opens up a lot of possibilities for pick lists with complex query forms. I will post some screenshots in due course.

I want to share with all the user some line of code to test this new feathure.

This is the result
Name:  2017-02-09 19_23_09-Lianja App Builder v3.2.1Beta4 [sampleproductsentry] - UTF-8 - southwind - L.png Views: 59 Size:  16.0 KB

when I click on the dialogbutton, I display the dropdown form
in the interacticechange of the text box I filter on real time the table, by select the row and click “OK”, the ProductId are copied to the table..

Name:  2017-02-09 19_15_38-Lianja App Builder v3.2.1Beta4 [sampleproductsentry] - UTF-8 - southwind - L.png Views: 58 Size:  25.5 KB

proc sp_close_handler()

proc sp_ok_handler()
	replace ORDER_DETAILS.PRODUCTID with myprod.productid
	lianja.get("sampleproductsentry.section3.field2").text = etos(myprod.productid)

proc sp_change()
	select * from products where etos(products.productid) like "*" + p_searchbox.text + "*" or products.productname like "*" + p_searchbox.text + "*" into cursor myprod

// Event delegate for 'dialogbutton' event
proc productiddropdownsearch()
	public p_myform, p_searchbox, p_mygrid
	p_myform = createObject("Form")
	p_myform.resize(600, 500)
	p_myform.addObject("mycont", "Container")
	mycont.layout = "Grid"
	mycont.autosize = 1
	mycont.addObject("oContTop", "container", 0, 0)
	oContTop.backcolor = "gold"
	oContTop.fixedheight = 25
	oContTop.margin = 20

// TOP
	oContTop.addObject("o_combo", "Combobox")
	o_combo.move(1, 1, 120, 20)
	oContTop.addobject("searchbox", "textbox")
	searchbox.move(130, 1, 120, 20)
	searchbox.interactivechange = sp_change
	p_searchbox = searchbox
	mycont.addObject("oContMiddle", "container", 1, 0)
	oContMiddle.backcolor = "lightgreen"
	oContMiddle.autosize = 1	
	p_oContMiddle = oContMiddle
	mycont.addObject("oContBottom", "container", 2, 0)
	oContBottom.backcolor = "lightgray"
	oContBottom.fixedheight = 25	
	oContBottom.addObject("sp_close", "commandbutton")
	sp_close.move(1, 1, 60, 20)
	sp_close.text = "Close"
	sp_close.click = sp_close_handler

	oContBottom.addObject("sp_ok", "commandbutton")
	sp_ok.move(80, 1, 60, 20)
	sp_ok.text = "Ok"
	sp_ok.click = sp_ok_handler

	select * from products into cursor myprod // This could be a parameterized multi-table join
	p_mygrid = oContMiddle.browse("browse noedit noactionbar", "myprod") // last 2 args are optional
	// note that the grid object is returned from browse() so you can set properties and call methods on it
	p_myform.showDropDown("sampleproductsentry.section3.field2", 400, 360)


I do not see the scoll bar.. 🙂


Did you try form’s attribute Scrollbars >0 ?

Scrollbars RW Numeric Scrollbars: 0 = none, 1 = horizontal, 2 = vertical, 3 = both


a few suggestions.

1. You can press escape to close the dropDownForm.

2. You can double click a grid row to call the dblclick() proc that you can specify on the browse() call. That could be set to your ok button clicked handler.

3. If the third parameter to showDropDown() is 0 then the form width will auto adjust to the width of the textbox.

scrollbars on the grid will appear if more rows than can be seen in the viewport and pagination is false.


I’ve try to set the right layout for the grid, but how can I set the pagination property for tge grid?

Name:  2017-02-10 18_16_47-Lianja App Builder v3.2.1Beta5 [sampleproductsentry] - UTF-8 - southwind - L.png Views: 49 Size:  14.6 KB

The rows displayed on the grid is greater than the row visible..
How can I set the height and width of the grid inside the container?


Because you are laying out the form using a grid layout you should remove the setting of autosize from oContMiddle. A grid layout will autosize into the grid cells automatically.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.