Download search results
You can configure a plugin program to allow the information from a search results page to be available for download.
The plugin, set by the SEARCH DOWNLOAD PLUGIN field, can be called to determine if a download link is available to a user on the search results page, or provide the content of a file for download.
The built-in plugin, plugin-download-csv.exe
, allows any user to download user search results and external data store tables as CSV files, given that they have permission to access those pages.
This plugin is not enabled by default.
Requirements
See Writing plugins for general requirements.
Execution points
This plugin is called by the View and update profile (IDR) module and the Manage external data store external data store (DBE) module. It is called once when the user list or the table is displayed to decide whether to display the download link. It is called again when the user clicks the download link.
Displaying the download link
When enabled by the plugin, a download link or button is displayed:
Below the user search results
Below an Manage external data store (DBE) module table
Input
The input presented to the plugin during the initial call includes the viewer information, plugin mode, module, and search type.
"" "" = { "sessionid" = "<session GUID>" # The user session "queryMode" = "displayDownloadButton" "module" = "<module>" # The module calling the plugin, such as idr. "searchType" = "<type>" # The search type such as user or which table. "viewer" "user" = { "id" = "<Profile ID>" "name" = "<Alias>" "acl" "" = { "<list of acls the user has>" } } }
Output
The plugin can provide the option to display a download link. If the option returned is true, a download link is available to the user to download the file.
"" "" = { "displayDownloadButton" = "<true|false>" }
Returning a file
When called in stream mode, the plugin will be sent a KVGroup providing the stream mode, search type and viewer. If a search query was used to limit the results being downloaded, that is also provided.
"" "" = { "queryMode" = "streamResults" "module" = "<module>" # The module calling the plugin, such as idr. "searchType" = "<type>" # The search type such as user or which table. "searchQuery" = "<query>" "viewer" "user" = { "id" = "<Profile ID>" "name" = "<Alias>" "acl" "" = { "<list of acls the user has>" } } }
The plugin must then return information on the suggested filename and content type.
"" "" = { "contentType" = "<MIME type>" # The mime type being streamed such as text/plin "filename" = "<text>" # The suggested file name being returned. }
The plugin will then recieve a KVGroup for each of the items in the search results.
Example:
"" "" = { "id" = "<Profile ID>" "name" = "<Alias>" }
Any output provided by the plugin following the KVGroup with filename and content type, will be streamed to the client directly.