Data Lists


Adding New Data Lists

A new Data List can be added to a model by selecting Data List from the New Item Menu.

Screenshot

Create a new field and manually entering data:

On creating a datalist, the model will be placed in 'edit' mode, where you can change the structure of the model. By default, your new Data List is empty, in that it has no fields. We can add a new field by selecting Create new field while editing a Data List.

Fields

Fields are containers for data in our model. They allow us to define how our data should be formated, how it should be represented, and any types of calculations or transformations we would like to make. For people familiar with spreadsheets a field most closely resembles a spreadsheet column, where each column represents a particular attribute.

Standard Parameters

Parameter Purpose
Name Descriptive name of our field.
Description A verbose description of what the field represents in order to give model users (non-authors) information.
Data Type How the data is to be represented by the computer. More information on Data Types, go here.
Data Item Used when creating a link between Data Lists. More information on linking Data Lists, go here.
Link Field Also used when creating a link between Data Lists. More information on linking Data Lists, go here.
Key
Indexed
Default Value
Format Used to alter how the data is displayed to the user. Common uses are rounding and displaying percentages. more [here}(data-lists.md#formatting).
Arguments
Calculated Value (Expression) Used to create custom calculations within our Data List and model as a whole. Can use the full power and logic of a robust programming language as well as a library of built-in functions. More on syntax and built-in functions here.

Custom Expressions

Modelshop has the ability to build fields based on custom expressions using both a robust programming language and extensive built-in functions.

Once again, we can add a new field by selecting Create new field while editing a Data List. To create a custom expression, select to edit the Calculated Value (expression) parameter for your field. We can access the value in any other field in our Data List by simply typing the name of that field. This gives us the power to use these values in calculations, logical expressions, and anything else we may want to do with our data. More on syntax and built-in functions here.

Examples:

We can add the value of two fields, to return the sum.

sampleFieldOne + sampleFieldTwo

We can access as many other fields as we want, and do more complex calculations:

(sampleFieldOne + sampleFieldTwo) / sampleFieldTwo

We can compare the value of two fields to return a boolean (true or false) as to their likeness:

sampleFieldOne == sampleFieldTwo

Or use an if statement:

if (sampleFieldOne == sampleFieldTwo) {
    “They are the same!”
}

This is just scratching the surface on what we can do in Modelshop. For a more comprehensive guide to accessing data, performing calculations, and introducing logic, see the syntax guide.

Linking Data Lists

Accessing data from various sources is a major pain point for spreadsheet users. Modelshop has the ability to easily link Data Lists, allowing the use of data from anywhere in the model.

To create a link between Data Lists, first determine the field to be used to create the link. The field should be common to each Data Lists you would like to link. These fields are often a unique identifier or an index field.

Once the field that will be used to link has been determined, create the link by entering Edit Mode and selecting DATAITEM in the Data Type column.
Screenshot

Once the Data Type has been set to DATAITEM, we have the ability to select another Data List from the Data Item column dropdown menu. Select the Data List that you would like to create a link with.
Screenshot

Finally, select the field you would like to link to and save the edits to the model.
Screenshot

Linked fields can be determined because they will display in bold in our views. Since the Data Lists are now linked, you can now access data from our linked list. For example, in our illustration above:

We can access the Name field in our S&P 500 Data list by using:

symbol.name

Alternatively, from our S&P 500 Data list, we can access the Stock Rating field in our Stock Rankings list using:

stockRankingsList.stockRating

Formatting

Modelshop supports a variety of formatting options. The format specification syntax is similar to that of format specifiers typically found in popular spreadsheet programs. Following is a table of common format specifiers for each data type:

Integer

Specifier Input Output
0 123 123
0 -123 -123
0000 123 0123
0000 -123 -0123
(0) 123 123
(0) -123 (123)
0% 12 12%

Float

Specifier Input Output
0.00 123 123.00
0.00 -123 -123.00
0.00% 1.23 1.23%
#,##0.00 1234 1,234.00
#,##0.00 -1234 -1,234.00
(#,##0.00) 1234 1,234.00
(#,##0.00) -1234 (1,234.00)

Currency

Specifier Input Output
$0.00 123 $123.00
$0.00 -123 -$123.00
$#,##0.00 1234 $1,234.00
$#,##0.00 -1234 -$1,234.00
($#,##0.00) 1234 $1,234.00
($#,##0.00) -1234 ($1,234.00)

Date

Specifier Input Output
M/d/yy 12/25/2015 12/25/15
M/d/yyyy 12/25/2015 12/25/2015
MMM d, yyyy 12/25/2015 Dec 25, 2015
yyyy-MM-dd 12/25/2015 2015-12-25
MMM-yy 12/25/2015 DEC-15
MMM-yyyy 12/25/2015 DEC-2015

DateTime

Specifier Input Output
M/d/yyyy HH:mm:ssX 12/25/2015 6:00 12/25/2015 06:00:00-0500
M/d/yyyy h:mm:ss a 12/25/2015 6:00 12/25/2015 6:00:00 AM
M/d/yyyy HH:mm:ss 12/25/2015 6:00 12/25/2015 06:00:00
MMM d, yyyy HH:mm:ssX 12/25/2015 6:00 Dec 25, 2015 06:00:00-0500
MMM d, yyyy h:mm:ss a 12/25/2015 6:00 Dec 25, 2015 6:00:00 AM
MMM d, yyyy HH:mm:ss 12/25/2015 6:00 Dec 25, 2015 06:00:00
yyyy-MM-dd HH:mm:ssX 12/25/2015 6:00 2015-12-25 06:00:00-0500
yyyy-MM-dd h:mm:ss a 12/25/2015 6:00 2015-12-25 6:00:00 AM
yyyy-MM-dd HH:mm:ss 12/25/2015 6:00 2015-12-25 06:00:00

Dynamic Data Series

Data Lists can be populated dynamically. To do so, enter Edit Mode, select the Data Series tab and then check the box next to Automatic Series

Create Data from a Range

Sometimes, it is necessary to dynamically build a Data List using a range of numbers or dates.
Screenshot

In order to automatically populate a field from a range, we must first have a field to populate. If you have not yet done so, create a new field by selecting Create new field under the fields tab.

Next, enter the name of the field to be populated into the Sequence Field and select the appropriate for the step type per the table below:

Step Type Purpose
LINEAR A numeric linear range, such as 0-100, incremented by 1.
GROWTH
DAY A range of dates, sequenced by the day
WEEK A range of dates, sequenced by the week
MONTH A range of dates, sequenced by the month
YEAR A range of dates, sequenced by the year

Retrieve Data from a Query

In order to automatically populate a field from a query, we must first have a field to populate. If you have not yet done so, create a new field by selecting Create new field under the fields tab.

Next, enter the name of the field to be populated into the Sequence Field and select VALUE for the Step Type.

Finally, enter a query that will return the collection you would like to use in order to populate the new field.