TemporalSection

One section of a time series or a spatio-temporal analysis sheet. A section is a run of tables that share a date period, and the class carries three things: the two formulas that give the period its bounds, the list of table headers its navigation dropdown offers, and the identifiers of its first and last table. StartSection opens a section, AddTable adds one table to it and EndSection closes it. IsOpen, SectionId, LastTableId and TableCount say where the section stands, and MinFormula, MaxFormula and Headers answer what the caller writes onto the sheet.

THE SECTION IS STATED BY THE CALLER

The loop that draws the tables tells this class when a section starts and when it ends. Nothing here reads the row below to work out where a section stops, and nothing walks backwards. Every table is added exactly once.

NO WORKSHEET REACHES THIS CLASS

The state is strings and a list. The caller reads MinFormula, MaxFormula and Headers when it closes a section, and writes them where they belong. The whole class runs with no workbook, no linelist and no dictionary.

Depends on: BetterArray

Version: 2026-07-30

Instantiation

Create #

create

Create a holder with no section started

Signature:

Public Function Create() As TemporalSection

StartSection begins the first section.

Returns: TemporalSection. A holder holding nothing.


Section lifecycle

StartSection #

start-section

Begin a section on its first table

Signature:

Public Sub StartSection(ByVal secId As String)

Clears the bounds and the headers of the section that came before, so nothing of it can reach the next dropdown. The identifier is the table identifier of the row that starts the section, which is what names every range the section owns on the sheet.

Parameters:

  • secId: String. Table identifier of the first table of the section.

Throws:

  • ProjectError.ErrorUnexpectedState When a section is already open.
  • ProjectError.InvalidArgument When the identifier is empty.

AddTable #

add-table

Add one table to the open section

Signature:

Public Sub AddTable(ByVal tabId As String, ByVal tableName As String, _
                    ByVal rowVar As String, ByVal header As String)

Appends the table's date column to both bounds and pushes its header onto the dropdown list. Every table of the section comes through here exactly once, the first and the last included.

Parameters:

  • tabId: String. Table identifier of the table being added.
  • tableName: String. Name of the linelist table the dates come from.
  • rowVar: String. Name of the date column inside that table.
  • header: String. Display string for the navigation dropdown.

Throws:

  • ProjectError.ErrorUnexpectedState When no section is open.

EndSection #

end-section

End the open section

Signature:

Public Sub EndSection()

The bounds, the headers and the two identifiers stay readable after this, so the caller ends the section and then writes what it held. Starting the next section is what clears them.

Throws:

  • ProjectError.ErrorUnexpectedState When no section is open.

Section values

IsOpen #

is-open

Whether a section is open

Signature:

Public Property Get IsOpen() As Boolean

Returns: Boolean. True between StartSection and EndSection.


SectionId #

section-id

Identifier of the section

Signature:

Public Property Get SectionId() As String

Returns: String. Table identifier of the first table of the section.


LastTableId #

last-table-id

Identifier of the last table added to the section

Signature:

Public Property Get LastTableId() As String

Returns: String. Empty until a table has been added.


TableCount #

table-count

How many tables the section holds

Signature:

Public Property Get TableCount() As Long

Returns: Long. Zero on a section with no table.


MinFormula #

min-formula

Worksheet formula for the earliest date of the section

Signature:

Public Property Get MinFormula() As String

Answers an empty string on a section holding no table, so a caller can tell "nothing to write" from a formula.

Returns: String. The complete formula, or an empty string.


MaxFormula #

max-formula

Worksheet formula for the latest date of the section

Signature:

Public Property Get MaxFormula() As String

Returns: String. The complete formula, or an empty string.


Headers #

headers

Dropdown entries of the section

Signature:

Public Property Get Headers() As BetterArray

A copy, so a caller holding on to it cannot grow the section's own list.

Returns: BetterArray. One entry per table, in the order the tables were added.


Internal members (not exported)

Error handling

ThrowError #

throw-error

Raise a project error naming this class

Signature:

Private Sub ThrowError(ByVal errNumber As Long, ByVal message As String)

Parameters:

Throws:


Used in (3 file(s))