a) Take a look at demo app "example_dynamicautosuggest"
If you start typing Last Name, the autosuggestion from sql-statement fires as you type letter by letter
and dropdown list is shown dynamically using SQL:
Code:
proc page1_section1_field3_interactivechange()
m_field = Lianja.get("page1.section1.field3")
if len(m_field.value)!=0
m_sql = "select last_name from example where last_name like '" + m_field.value + "%'"
else
m_sql = ""
endif
m_field.autosuggest = m_sql
endproc
In this case formfield is used as a "standalone"
If you are not testing len(m_field.value), you could write:
Code:
m_sql = "select last_name from example where last_name like '" + Lianja.get("page1.section1.field3").value + "%'"
In your case:
Code:
m_sql = "SELECT firstname FROM userlookup WHERE userid = '"+Lianja.get("page1.section1.useridontheform").value+"'"
Note that we build the string.
b) If your form is database binded (see demo app "example_virtualtables")
you should use macro with table/column name like that in "SQL statement" attribute of section2
select * from orders where customerid='{vcust.customerid}'
Child Section2 (grid) is populated indirectly with data from the parent Section1's formfield page1.section.field1,
in fact from underlying table vcust and column customerid.
In your case:
SELECT firstname FROM userlookup WHERE userid = '{yourtable.column_under_
useridontheform}'
Note that we write into section's attribute.
Bookmarks