Class: Twb::Analysis::SheetFiltersAnalyzerA

Inherits:
Object
  • Object
show all
Includes:
TabTool
Defined in:
lib/twb/analysis/sheets/sheetfiltersanalyzera.rb

Instance Attribute Summary collapse

Attributes included from TabTool

#alerts, #docDir, #docfiles, #funcdoc, #id, #licensed, #logfilename, #logger, #loglevel, #properties, #ttdocdir, #type, #uuid

Instance Method Summary collapse

Methods included from TabTool

#addDocFile, #alert, #closeDocFiles, #config, #docFile, #docFileMaxNameLen, #docfilesdoc, #docfilesdocto_s, #emit, #emitCSV, #finis, #hasConfig, #init, #initCSV, #initDocDir, #initLogger, #license=, #licensed?, #loadConfig

Constructor Details

#initializeSheetFiltersAnalyzerA

Returns a new instance of SheetFiltersAnalyzerA.


28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/twb/analysis/sheets/sheetfiltersanalyzera.rb', line 28

def initialize
  init
  @funcdoc     = {:class=>self.class, :blurb=>'Analyze Worksheet filters.', :description=>'Documents Quick Filters and the values they employ, if any. Work in progess.',}
  #--
  docFileName  = docFile('WorksheetFiltersA.csv')
  $sheetFieldsCSV  = CSV.open( docFileName  ,'w')
  $sheetFieldsCSV  << ['Workbook','Worksheet','Filter Type','Operation','Data Source','Field','Value','Alias', 'Alias?']
  addDocFile docFileName, "Workbooks, Worksheets and the sheets' Quick Filters"
  #--
  @sheetCount  = 0
  @filterCount = 0
end

Instance Attribute Details

#localEmitObject

Returns the value of attribute localEmit


26
27
28
# File 'lib/twb/analysis/sheets/sheetfiltersanalyzera.rb', line 26

def localEmit
  @localEmit
end

Instance Method Details

#metricsObject


41
42
43
44
45
46
# File 'lib/twb/analysis/sheets/sheetfiltersanalyzera.rb', line 41

def metrics
  {
    '# of Worksheets'        => @sheetCount,
    '# of Worksheet Filters' => @filterCount
  }
end

#parseFiltersObject


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/twb/analysis/sheets/sheetfiltersanalyzera.rb', line 56

def parseFilters
  @worksheets  = @twb.worksheets
  @worksheets.each do |sheet|
    emit "\n\nSHEET: #{sheet.name}"
    filters = sheet.filters
    filters.each do |filter|
      filter.emit "-----------------------------\nWORKSHEET:: #{sheet.name}\n-----------------------------"
      if filter.values.empty?
      # $sheetFieldsCSV  << ['Workbook','Worksheet','Filter Type','Operation'     ,'Data Source','Field','Value','Alias', 'Alias?']
        $sheetFieldsCSV  << [@twbName  ,sheet.name, filter.type  ,filter.inexclude, filter.dataSource.uiname, filter.uiname,nil,nil,nil]
      end
      filter.values.each do |valueMap|
        value  = valueMap[:value]
        valias = valueMap[:alias]
        same   = value.eql? valias
        # puts "RECORDING FILTER VALUES:  %-25s  --  %-25s  same? %s " % [value,valias,same]
        $sheetFieldsCSV  << [@twbName  ,sheet.name, filter.type  ,filter.inexclude, filter.dataSource.uiname, filter.uiname, value, valias, same]
      end
    end
  end
end

#processTWB(twb) ⇒ Object


48
49
50
51
52
53
54
# File 'lib/twb/analysis/sheets/sheetfiltersanalyzera.rb', line 48

def processTWB twb
   @twb     = twb
   @twbName = @twb.name
   emit "   -- #{@twbName}"
   @twbDomainsLoaded = false
   parseFilters
end