Difference between revisions of "Autosuggestions"

From Lianjapedia
Jump to: navigation, search
Line 1: Line 1:
''Under construction''
 
 
 
==See Also==
 
==See Also==
 
[[Advanced Canvas Control Attributes]], [[Data Attributes]], [[Data Mapping]], [[Field Attributes]], [[SQL SELECT]], [[Working with the Lianja Object Model]]
 
[[Advanced Canvas Control Attributes]], [[Data Attributes]], [[Data Mapping]], [[Field Attributes]], [[SQL SELECT]], [[Working with the Lianja Object Model]]
Line 16: Line 14:
 
* User defined function based list  
 
* User defined function based list  
  
Autosuggestions are defined by the following field attributes (Data sub-section):
+
Autosuggestions are defined by the following field attributes found in the '''Data''' sub-section of the attributes dialog:
  
 
{| class="wikitable" width="100%"
 
{| class="wikitable" width="100%"
Line 66: Line 64:
 
<pre>@<table-name>,<expression></pre>
 
<pre>@<table-name>,<expression></pre>
  
Here the list is based on the current values of the lastname field from the employees table.
+
Here the list is based on the current values of the '''lastname''' field from the employees table.
  
 
<pre>Autosuggestions: @employees,lastname</pre>
 
<pre>Autosuggestions: @employees,lastname</pre>
Line 83: Line 81:
 
SQL Select lists are generated by the resultset from a SQL Select statement.
 
SQL Select lists are generated by the resultset from a SQL Select statement.
  
Here the list is based on the current values of the lastname field from the employees table.
+
Here the list is based on the current values of the '''lastname''' field from the employees table.
  
 
<pre>Autosuggestions: select lastname from employees</pre>
 
<pre>Autosuggestions: select lastname from employees</pre>
Line 107: Line 105:
  
  
By default, the first column is the search column.
+
By default, the first column, '''lastname''', is the search column.
  
  
Line 131: Line 129:
 
For multi-column SQL Select lists, the '''Autosuggestion column to search''' attribute can be used to specify the column to search.
 
For multi-column SQL Select lists, the '''Autosuggestion column to search''' attribute can be used to specify the column to search.
  
Columns are numbered from 0.  Here the lastname column is the search column.
+
Columns are numbered from 0.  Here the '''lastname''' column is the search column.
  
 
<pre>Autosuggestions: select firstname, lastname from employees</pre>
 
<pre>Autosuggestions: select firstname, lastname from employees</pre>
Line 149: Line 147:
  
 
<br clear=all>
 
<br clear=all>
 +
 +
==User Defined Function==
 +
The Autosuggestions list can be based on the return value from a user defined function or procedure (Lianja/VFP scripting).
 +
 +
<pre>"{UserDefinedFunction()}"</pre>
 +
 +
The return value should be a comma-separated list.  Here the list is based on the return value from the 'getempname' procedure defined in the App's custom library.
 +
 +
<pre>Autosuggestions: "{getempname()}"</pre>
 +
 +
As in the other examples, it returns the lastname field values from the employees table.
 +
 +
<pre>proc getempname()
 +
sqlvalues("select lastname from employees order by lastname")
 +
creturn = astring(_sqlvalues)
 +
return creturn
 +
endproc</pre>
  
 
[[{{ns:file}}:autosuggestions8.png|450px|thumb|left|link={{filepath:autosuggestions8.png}}|User defined function]]
 
[[{{ns:file}}:autosuggestions8.png|450px|thumb|left|link={{filepath:autosuggestions8.png}}|User defined function]]
 +
 +
 +
 +
 +
 +
The dropdown displays filtered values from the list returned by the procedcure.
  
 
<br clear=all>
 
<br clear=all>
 +
 +
 +
==Notes on Client Support==
 +
Autosuggestions functionality is currently supported on the Desktop client only.
 +
 +
{| class="wikitable" width="100%"
 +
!width="20%"|Attribute
 +
!width="80%"|Notes
 +
|-
 +
|valign="top"|Autosuggestions||Currently supported on the Desktop client only.
 +
|-
 +
|valign="top"|Autosuggestion headers||Currently supported on the Desktop client only.
 +
|-
 +
|valign="top"|Autosuggestion column to search||Currently supported on the Desktop client only.
 +
|-
 +
|}
 +
 +
==Notes on Scripting Support==
 +
* The '''Autosuggestions''' attribute can be queried or changed programmatically in Lianja/VFP scripting using [[Working with the Lianja Object Model|Lianja.getElementByID("page.section.field").autosuggest]].
 +
* The '''Autosuggestion Headers''' attribute can be queried or changed programmatically in Lianja/VFP scripting using [[Working with the Lianja Object Model|Lianja.getElementByID("page.section.field").autosuggestheaders]].
 +
* Autosuggestions functionality is also available in the [[Textbox]] framework class control for VFP Custom Sections.
  
 
[[Category:Attribute Categories]]
 
[[Category:Attribute Categories]]

Revision as of 10:01, 29 April 2016

See Also

Advanced Canvas Control Attributes, Data Attributes, Data Mapping, Field Attributes, SQL SELECT, Working with the Lianja Object Model

Overview

Autosuggestions provide filtered choices as the user types in a Form or Canvas Section field.

The choices are displayed in a dropdown under the control. Clicking on a choice loads its value into the field.

Autosuggestions can be:

  • Static list with or without a dropdown (autocomplete)
  • Dynamic table-based list
  • SQL Select based list
  • User defined function based list

Autosuggestions are defined by the following field attributes found in the Data sub-section of the attributes dialog:

Attribute Description
Autosuggestions The list of Autosuggestions values to display as the user types
Autosuggestion headers A comma separated list of column headers to display for the Autosuggestions
Autosuggestion column to search The column to search for Autosuggestions

Static Lists

Static lists are based on a comma-separated list of choices specified in the Autosuggestions attribute.

Autosuggestions: Buchanan,Callahan,Davolio,Dodsworth,Fuller,King,Leverling,Peacock,Suyama
Static list



With a standard static list, the dropdown is displayed as the user types, showing filtered values based on the input.

Typing 'd' displays all the values from the list starting with 'd' or 'D'.


Prefixing the list with '-' does not display the dropdown. Instead, it operates as an autocomplete.

Autosuggestions: -Buchanan,Callahan,Davolio,Dodsworth,Fuller,King,Leverling,Peacock,Suyama
Static list: autocomplete



Typing 'd' autocompletes with the first value in the list starting with 'd' or 'D'.


Dynamic List

A dynamic list is based on the evaluation of an expression from a specified table.

@<table-name>,<expression>

Here the list is based on the current values of the lastname field from the employees table.

Autosuggestions: @employees,lastname
Dynamic list



The dropdown displays filtered values from the table.


SQL Select Lists

SQL Select lists are generated by the resultset from a SQL Select statement.

Here the list is based on the current values of the lastname field from the employees table.

Autosuggestions: select lastname from employees
SQL Select



The dropdown displays filtered values from the resultset.


The SQL Select statement can reference more than one column.

Autosuggestions: select lastname, firstname from employees
Multi-column SQL Select



By default, the first column, lastname, is the search column.


Clicking on a choice will load the value of the search column into the field.


For multi-column SQL Select lists, the Autosuggestion headers attribute can be used to specify a comma separated list of column headers for the dropdown.

Autosuggestions: select lastname, firstname from employees
Autosuggestion headers: Surname,Firstname
Multi-column SQL Select with headers



The dropdown is displayed with column headers.


For multi-column SQL Select lists, the Autosuggestion column to search attribute can be used to specify the column to search.

Columns are numbered from 0. Here the lastname column is the search column.

Autosuggestions: select firstname, lastname from employees
Autosuggestion headers: Firstname,Surname
Autosuggestion column to search: 1
Multi-column SQL Select with headers and specified search column



The second column is the search column.


Clicking on a choice will load the value of the search column into the field.


User Defined Function

The Autosuggestions list can be based on the return value from a user defined function or procedure (Lianja/VFP scripting).

"{UserDefinedFunction()}"

The return value should be a comma-separated list. Here the list is based on the return value from the 'getempname' procedure defined in the App's custom library.

Autosuggestions: "{getempname()}"

As in the other examples, it returns the lastname field values from the employees table.

proc getempname()
	sqlvalues("select lastname from employees order by lastname")
	creturn = astring(_sqlvalues)
	return creturn
endproc
User defined function



The dropdown displays filtered values from the list returned by the procedcure.



Notes on Client Support

Autosuggestions functionality is currently supported on the Desktop client only.

Attribute Notes
Autosuggestions Currently supported on the Desktop client only.
Autosuggestion headers Currently supported on the Desktop client only.
Autosuggestion column to search Currently supported on the Desktop client only.

Notes on Scripting Support