HOW TO: Copy field contents for a foundset

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

HOW TO: Copy field contents for a foundset

Postby mattman » Wed Apr 21, 2004 8:16 am

Better known as "Copy a foundset column"

If you're working on a project that needs to take data from the database into another program, such as a spreadsheet, then using the copyAllRecords() method may not do the trick (Unless you know how to use the string.split function and loop through an array or two).

Instead, use the databaseManager. Here is the code you need to get the contents of a single field (column), from a foundset, onto the clipboard.

Code: Select all
var x = databaseManager.getFoundSetDataProviderAsArray(foundset, 'field_name_here');
var y = ''; //initialize a string variable
for (i = 0; i < x.length; i++) {
   y = y + '\n' + x[i];
}
application.setClipboardContent(y);
Matt Petrowsky
mattman
 
Posts: 160
Joined: Wed Aug 06, 2003 8:23 am
Location: Murrieta, CA

Return to How To

Who is online

Users browsing this forum: No registered users and 10 guests