Web Application Repository

Description

An overview of functions relating to Web Application Repositories, tables where web applications read and write data.

Overview

A repository is a table (either .dbf or SQL) where a web application can read or write data. The data are typically items such as email templates, saved searches, or other settings.

Before you can use the repository, it must first be configured. The details of the repository (e.g, connection string, table name, and field map) are defined in the Web Project Properties dialog. The repository is primarily used by components, but developers can also make use of it.

Setting up the Repository Table

  1. Go to the Web Projects Control Panel.

  2. Click the Project Properties button in the toolbar to open the Web Project Properties.

  3. In the Repository Settings section, define the Table type and connection properties for the database where the repository table will be created and stored:

    images/repositorySettings.png
    See Repository Settings for more information.
  4. Click OK to save your settings when you are done.

Working with the Repository Using Xbasic

To support your use of the repository, the following Xbasic functions can be used in your applications:

a5w_SaveToWebAppRepository()

Saves some data to the repository. Returns .t. if the data was saved or .f. if it was not saved.

a5w_GetFromWebAppRepository()

Retrieves a piece of data from the repository.

a5w_EnumerateWebAppRepository()

Enumerates the key values of the objects stores in the repository and returns them in a CR/LF-delimited list. You can optionally filter the objects by objectType, componentGuid, and/or userId.

a5w_DeleteFromWebAppRepository()

Deletes data from the Web Application Repository. Returns .t. if the data was deleted or .f. if it was not deleted.

Working with the Repository Using JavaScript

In addition to Xbasic, you can also use JavaScript to save and load data from the repository. The UX component has the following methods that can be used to save and restore the component's state to the repostiory table:

{dialog.object}.saveDataInRepository()

Saves the data that the user has entered in the component to the repository. The afterSaveToRepository client-side event is triggered after the data has been saved.

{dialog.object}.loadDataFromRepository()

Loads data that was previously saved to the repository and populates the controls in the UX component. The afterLoadFromRepository client-side event is triggered after the data has been loaded.

Sample Applications that use the Repository

UX_Ad_Hoc_SQL_QueryBuilder

A template UX component that allows users to execute ad-hoc SQL SELECT statements against any table in a database. Queries can be saved for future use and query results can be exported to Excel.

Videos

Repository Table - Managing Records in the Repository

This video is aimed at advanced used who use the Repository feature in Alpha Anywhere.

The video shows how you can create a Grid to manage the records in the Repository that 'belong' to the current component.

For example, when you save search criteria from the Search Part of a Grid to the Repository, the search is saved with the GUID of the current component. This is important because when you load a saved search, you only want the user to see the saved searches that 'belong' to the current component. If you want to manage the records in the Repository, (by creating a Grid that is based on the Repository table), you might want to filter the records in the Repository based on the Guid of a particular component.

Say you have a Grid called 'Customers' and you want to put a button on this Grid to show the Repository entries that belong to this Grid. You can do this by setting the filter on the target Grid to:

componentGuid = ComponentGuid()

Using the AdvancedListSearch Control to Search in a List Based on a SQL Database

For UX Components that contain List controls that are based on SQL databases, the Advanced Search control exposes powerful features for users to search for specific records in a List. The Advanced Search Control allows users to define complex queries and to save these queries to a repository for future reuse.

In this video we show how the Advanced Search Control is added to a UX component and how it is configured.

2018-09-08

Save and Load Search Criteria in a Grid Component

You can use the Repository feature to save search criteria to the repository and load searches from the repository for a Grid Component. Watch this video to learn how to save and load searches in the Grid Component.

Server-side Action Scripting - Send E-mail - Get Email Settings at Runtime

This video shows how email account settings for the 'Send e-mail' action can by dynamically set a run-time by reading the values from the Repository.

The video also shows how a UX component can be configured to edit the e-mail settings in the Repository.

See Also