MasterSetupVariables
Internal members (not exported)
Factory helpers
Create #
Create a configured variables table manager instance.
Signature:
Public Function Create(ByVal listTable As ListObject) As MasterSetupVariables
Parameters:
listTable: ListObject representing the Master Setup Variables worksheet table.
Returns: MasterSetupVariables ready to manage the associated ListObject.
Public API
Initialise #
Initialise validation, hidden names, and duplicate detection.
Signature:
Public Sub Initialise(ByVal dropdowns As DropdownLists)
Parameters:
dropdowns: DropdownLists provider used to configure the Default Status validation.
RefreshDuplicateFormatting #
Re-apply the duplicate rule of the Variable Name column.
Signature:
Public Sub RefreshDuplicateFormatting()
Runs on every preparation, outside the Initialised guard, so a table prepared before the rule existed gets it, and a table that grew rows gets a rule over the rows it has today.
RefreshChoiceValidation #
Put the choices dropdown on the Default Choice column.
Signature:
Public Sub RefreshChoiceValidation(ByVal dropdowns As DropdownLists)
Runs on every preparation, outside the Initialised guard, so a table initialised while the Choices sheet was empty gets the dropdown once the list exists. A dropdown manager without the choices list leaves the column as it stands.
Parameters:
dropdowns: DropdownLists provider carrying the choices list.
WriteChoiceValuesFormula #
Put the ChoiceValues formula on the Choices Values column.
Signature:
Public Sub WriteChoiceValuesFormula()
Runs on every preparation, outside the Initialised guard, the way the disease sheets carry their line formulas: every line reads its own Default Choice cell through the ChoiceValues worksheet function. The master setup is in English, so the language is left out and the function answers the labels of the choice. The column is set to General first: a text cell stores a formula as its own text. A value a user typed in the column takes the formula.
RefreshChoices #
Refresh the concatenated choices values for the supplied variable.
Signature:
Public Sub RefreshChoices(ByVal variableName As String, ByVal choices As LLChoices)
Parameters:
variableName: String identifier of the variable row to update.choices: LLChoices providing category listings.
HasVariable #
Whether the table carries a line for the variable.
Signature:
Public Function HasVariable(ByVal variableName As String) As Boolean
Parameters:
variableName: String identifier of the variable, matched without regard to case.
AddVariable #
Add a variable on the first free line of the table.
Signature:
Public Sub AddVariable(ByVal variableName As String, _
Optional ByVal section As String = vbNullString, _
Optional ByVal label As String = vbNullString, _
Optional ByVal defaultChoice As String = vbNullString, _
Optional ByVal defaultStatus As String = vbNullString)
A free line is a line with no variable name, which is what Add Rows leaves behind; with none a row is added to the table. The line takes the next order number, so a sort keeps the new variable at the end. The joined choices values stay empty: RefreshChoices fills them.
Parameters:
variableName: String identifier of the new variable.section: Optional String written in the Variable Section column.label: Optional String written in the Label column.defaultChoice: Optional String written in the Default Choice column.defaultStatus: Optional String written in the Default Status column.
LabelFor #
Retrieve the label for the supplied variable.
Signature:
Public Function LabelFor(ByVal variableName As String) As String
DefaultChoiceFor #
Retrieve the default choice for the supplied variable.
Signature:
Public Function DefaultChoiceFor(ByVal variableName As String) As String
ChoicesFor #
Retrieve the concatenated choices values for the supplied variable.
Signature:
Public Function ChoicesFor(ByVal variableName As String) As String
DefaultStatusFor #
Retrieve the default status for the supplied variable.
Signature:
Public Function DefaultStatusFor(ByVal variableName As String) As String
SectionFor #
Retrieve the section label for the supplied variable.
Signature:
Public Function SectionFor(ByVal variableName As String) As String
SetVariableValidation #
Apply workbook-scoped validation for variable names onto the supplied range.
Signature:
Public Sub SetVariableValidation(ByVal targetRange As Range)
CloneToWorkbook #
Clone the managed table into another workbook.
Signature:
Public Function CloneToWorkbook(ByVal targetWorkbook As Workbook, _
Optional ByVal sheetName As String = vbNullString, _
Optional ByVal startCell As Range = Nothing) As MasterSetupVariables
Parameters:
targetWorkbook: Workbook receiving the cloned table.sheetName: Optional sheet name; defaults to the source worksheet name.startCell: Optional starting cell; defaults to the source table anchor.
Returns: MasterSetupVariables bound to the cloned ListObject.
RestoreFrom #
Restore current table contents from a peer instance.
Signature:
Public Sub RestoreFrom(ByVal source As MasterSetupVariables)
Parameters:
source: MasterSetupVariables providing data and metadata.
ExportToWorksheet #
Export the managed table to a plain worksheet range.
Signature:
Public Sub ExportToWorksheet(ByVal targetSheet As Worksheet)
Parameters:
targetSheet: Worksheet receiving the exported values.
ImportFromWorksheet #
Import table data from a plain worksheet range.
Signature:
Public Sub ImportFromWorksheet(ByVal sourceSheet As Worksheet)
Parameters:
sourceSheet: Worksheet containing headers and rows matching the variables schema.
CopyToListObject #
Copy the managed table content into a supplied ListObject.
Signature:
Public Sub CopyToListObject(ByVal targetTable As ListObject)
Parameters:
targetTable: ListObject receiving headers, values, and formatting.
ExportMetadata #
Export the hidden metadata that records where each column sits.
Signature:
Public Sub ExportMetadata(ByVal targetSheet As Worksheet)
Parameters:
targetSheet: Worksheet receiving the hidden name definitions.
Table #
Expose the managed ListObject.
Signature:
Public Property Get Table() As ListObject
Initialised #
Indicates whether initialisation logic already executed.
Signature:
Public Property Get Initialised() As Boolean
DataRange #
Return the range for the supplied column header, optionally including headers.
Signature:
Public Function DataRange(ByVal headerName As String, _
Optional ByVal includeHeaders As Boolean = False) As Range
Internal helpers
ApplyDuplicateFormatting #
Delete and re-add the one duplicate rule over the name column.
Signature:
Private Sub ApplyDuplicateFormatting()
The column range is read fresh on every call, so the rule covers the table as it stands. Delete drops every rule of the column: the column carries this one rule, and the delete is what keeps the count at one across repeated preparations.
WriteChoicesValue #
Write the joined values of a line, or recalculate its formula.
Signature:
Private Sub WriteChoicesValue(ByVal rowIndex As Long, ByVal newValue As String)
A line carrying the ChoiceValues formula answers through the worksheet function; a write would replace the formula with text.
ChoiceValuesFormula #
The choice values formula of a line: the worksheet function over the choice cell.
Signature:
Private Function ChoiceValuesFormula(ByVal choiceCell As Range) As String
WriteCell #
Write any value on the line of the given column.
Signature:
Private Sub WriteCell(ByVal rowIndex As Long, ByVal headerName As String, ByVal newValue As Variant)
FirstFreeRow #
The first line with no variable name, or a new line at the end.
Signature:
Private Function FirstFreeRow() As Long
NextOrderNumber #
One past the highest order number of the table.
Signature:
Private Function NextOrderNumber() As Long
OrderOf #
The order number a cell carries; anything else reads as 0.
Signature:
Private Function OrderOf(ByVal cellValue As Variant) As Long
Used in (18 file(s))
- DiseaseSheet.cls
- EventMasterSetup.cls
- MasterSetupImportService.cls
- MasterSetupMigration.cls
- MasterSetupPreparation.cls
- CustomMasterSetupFunctions.bas
- MasterSetupEventsManager.bas
- MasterSetupExports.bas
- MasterSetupHelpers.bas
- TestDiseaseIntegration.bas
- TestDiseaseSheet.bas
- TestEventMasterSetup.bas
- TestMasterSetupEvents.bas
- TestMasterSetupExports.bas
- TestMasterSetupImportService.bas
- TestMasterSetupMigration.bas
- TestMasterSetupPreparation.bas
- TestMasterSetupVariables.bas