Topdanmark

Modified on Mon, 5 Oct at 1:53 PM

This feature is a customer specific plugin that can expose "custom" Topdanmark customer database to DocumentData. So besides this plugin, the feature requires the plugin for DocumentData as well.

The purpose if this feature is to extract data from a database file and insert it into a document. The user can select which row of data that should be used from the database, and the data will be inserted using DocumentData where the text in the content control binding will be replaced to the following properties:

  • FullName
  • FirstName
  • LastName
  • StreetName
  • StreetNumber
  • PostalCode
  • City

How it works

The customer specific plugin reads data from a table in the SYTEM.db5 database file provided by Topdanmark. If the file exists, a search dialog is shown, displaying the FullName property of each entry. The search is performed on FullName, checking if it starts with the search text. Only one entry can be selected and the data of the selected entry is added to the document through DocumentData. Which table in the database that is read and its format is hard coded in the plugin. The command must receive at least one path for a database file. If none of the files exist, a message box is shown instead. It is possible to set the text in the search dialog and message box shown if no database files exists.

CMD

<Cmd case="SkabelonDesign.TopDKDocumentData:get-database-entry"/>

Parameters

DBPaths

Define all of the files which the command should try to read from before showing the message box. Each path is separated with ";". Only the first file found will be used. This parameter is required.

Prefix

Define a prefix to be used in the binding. The format Prefix.Property is expected. This parameter is optional.

SearchButton

Define the displayed text of the search button. This parameter is optional.

SearchLabel

Define the displayed text of the search box. This parameter is optional.

DescriptionLabel

Define the displayed text over the results from the search. This parameter is optional.

ErrorTitle

Define the title of the message box that will be shown when no files are found. Default is "Database not found". This parameter is optional.

ErrorText

Define the text in the message box that will be should when no files are found. Default is "The Database was not located at any of the following locations: <list of paths provided>”.

Example of usage

In the following example, the button calls the command where we first look for the file in the C:\Topdanmark DB folder and then in the current users AppData\Roaming\TopdanmarkDB folder.

XML
<Button label="Load DB">
   <Cmd case="SkabelonDesign.TopDKDocumentData:get-database-entry"
        Prefix="tdk" Searchbutton="Search" SearchLabel="Look up customer:"
        DescriptionLabel="Customers:"
        DBPaths="C:\Topdanmark DB\SYSTEM.DB5;%AppData%\Topdanmark DB\SYSTEM.DB5" 
        ErrorTitle="" 
        ErrorText=""
   />
</Button>

For the above example, the following content control tag is used for getting the first name:

{"SkabelonDesign":{"type":"Text","binding":"tdk.FirstName"}}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article