# Auto-Complete Examples

> [HTML Version](auto-completeexamples.htm)

The following two examples illustrate valid _setdef_ formats which sent back to INFLD in response to _exitcode_ 30 or 31. Note that for the initial call to INFLD, you would normally set _setdef_ to ""(unless you wanted the list displayed immediately).

Simple example:

SETDEF = "1~7~x~S~~~,ACME   ,Adams  ,Affleck,Azure  ,,"

The above _setdef_ string does not contain an optional \[widthspec\] and instead starts with a simple column definition ([Coldef](coldef.md)) string defining a single column of seven characters. The _coldef_ string is normally (in standard XTREE usage) terminated by two tildes (~~), but in the context of INFLD auto-complete, a third tilde (~~~) is required to act as a delimiter between the _coldef_ and the actual list items. Also note the trailing spaces on the list elements to give them each 7 characters. Finally, following the _coldef_ string and the three tildes, we show four entries in the list, each delimited by a comma and space-padded to seven characters. Note that as with a standard _setdef_ [List of Valid Inputs](listofvalidinputs.md), the first character of the list specifies the list item delimiter (comma in this example), and two delimiters mark the end of the list.

More complex example:

SETDEF = "\[+3\]0~0~x~H~RGBbg=220,230,240,A~~1~10~x~S~~11~1~x~bH~~~" \&

\+ ",Apples    A,Bananas    ,Peaches   A,Watermelon ,,"

In the above list, we started with a \[widthspec\] of "\[+3\]" so that the dropdown list would be 3 grid-columns wider than the field. Then we used a more complex [Coldef](coldef.md) string to define an RGBbg value associated with a pseudo-column, plus 2 real columns - the first ten characters long (the primary column) and the last one character to contain the color code. The list then specifies the color code "A" for Apples and Peaches, so those two items would appear in the auto-complete list with the specified background color. Note that each item in the list (as measured by the space between the delimiters) must match the total length of all the real columns (11 in this example):

(./images/ashref_img173.png)

See the sample programs INFAC1 and INFAC2 in [EXLIB:\[908,41\]](https://bitbucket.org/microsabio/exlib/src/master/908041/) for more complete examples.