hub.eb?material_id=73

Seven Summits Table


Before doing this tutorial, you need to create a new table in the database. To do this follow the instructions below.

Download the content from the Downloads on this page. This includes:

  • A form called summitData
  • A JavaScript script called databaseManagement
  • A JavaScript script called dataDefinition

Import these into your Studio.

Open the summitData form and go to the Events tab in the Form properties 

You'll see the databaseManagement script in the Shared Functions. This script contains a series of functions that, when executed, will create a new database table with data.

The dataDefinition script has been added to the Before Form event. When executed this script creates the new database table and inserts its data.

Run the summitData form. Nothing will happen in the browser, but check the Server logs  and you'll see that a new table called sevenSummits has been created in the VerjSamples database.

Steps


1

Create a new database resource using the Database Resource Wizard under Tools/Resource Wizards.

Select the VerjSamples database, the VERJSAMPLES schema and choose the SEVENSUMMITS database table. 

2

Check Tables Only and uncheck the Columns For Where Clause.

3

Create a new project called sevenSummits, and in it create a new form called 7S.

4

Open your form and add  your SEVENSUMMITS resource to the Resources tab.

5

In the Tables tab next to it, add a new table  

Select your SEVENSUMMITS resource, and import all the columns using the Import columns from resource button.

6

Drag and drop your table onto your page and run your form 

Your table will render with no data, but that's ok. 

7

Right-click the table and go to Events

Create a new script  on the Before Table event and call it 7S_Data

Add the following code:

tables.SEVENSUMMITS.fetchTable();

Run the form, and the table will render with data.

8

Let's tidy up a bit:

  • Remove the ID column from the table in the Outline view
  • Rearrange the columns
  • Make the table Display Only

Related