Best of Support

Creating a List from a DataLink

Issue

Can I dynamically produce a drop-down List from a database link?  If so how?

Solution:

This is readily achievable using GhostFill scripting.  If you look in the FillPoint Editor, under Lists you will find the following tasks that would apply:

%[MyList=Lists.New()]

%[MyList.Add("Item", "Result")]

%[MyList.SaveAs("Mapping", "Name")]

 

So as an example, the following would work with the ODBC sample that ships with GhostFill:

  1. Create the data link:

%[^ODBCSample = DataBases.Select("\GF Feature Samples", "ODBCSample")]

 

  1. Create the new list:

%[x1=Lists.New()]

 

  1. Add the first item:

%[~odbcsample.first]

%[x1.Add(odbcsample.clientname, odbcsample.clientname)]

 

  1. Add the remaining items:

%[RepeatBlockWhile(ODBCSample.Next)]

%[x1.Add(odbcsample.clientname, odbcsample.clientname)]

%[EndBlock]

 

  1. Save the list:

%[x1.SaveAs("\GF Feature Samples", "List of Clients")]

 

Do note that all of the above applies to GhostFill on the desktop.  If your application is ultimately going to be run off a web server, you would have to use standard Java/ASP code to pre-populate the GhostFill list which is in .xml format.

 

Daniel Todes