Request direct xMart DB access (one time)

In order to write a SQL view, you need a WIMS account and access to the database.

In order to request database access, you will need to fill out this form

Create the View

In order to use a custom view, it must exist on the database in the schema martcode_c where martcode is the code for the mart.

In this case, I created a simple view via SQL Server Management Studio:

CREATE VIEW training_cf_c.SiteList
AS
	SELECT
		s.Site,
		c.[NAME_SHORT_EN],
		s.WHO_VILLAGE_NAME
	FROM
		[training_cf].[REF_SITE] s
	INNER JOIN
		[training_cf].[REF_COUNTRY] c
	ON
		s.COUNTRY_FK__Sys_ID = c.Sys_ID

Register the View

To do this, navigate to the Mart.

Select Admin and then Catalog and then the blue + next to Custom Views.

image-20210218015212345

A properties box will appear.

image-20210218015312345

The name of the schema you need to add the views to is in the pop up.

Select a view from the dropdown at the top and then close the dropdown.

image-20210218015412345

Enter the name and description. There are also some dynamic description fields available.

These are [RowCount], [ColumnCount], [FirstUpdatedDate] and [LastUpdatedDate].

image-20210218015512345

Scroll down to the bottom and press Create View.

image-20210218015612345

The view should now appear on the right-hand side.

image-20210218015712345

Add the View to a Category

This now appears on the table list when you add tables to Categories.

image-20210218015812345

Look at the Data in the View

It also now appears on the Data view.

image-20210218015912345

It is treated like any other table and the data can be viewed by clicking on it.

image-20210218016012345