twb 3.9.7 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a3bca661db5662df120e34443a68874a5a0d5f6
4
- data.tar.gz: 56e2f1171c7c4df1b64a6f4767070ecb9f023b76
3
+ metadata.gz: 896e3b1f94079e230c28b1f65553ac5b870c3263
4
+ data.tar.gz: 318d27a633debcdf2c3eb1c323017e6d227e569e
5
5
  SHA512:
6
- metadata.gz: 85fc520db33e97945985b457870f21f73ced2105ba7b60287ccefb09291292da2969f364a771d9d6283abd8b00b61a58f43864500dc8fd5c7e19fcfc1a73a1f4
7
- data.tar.gz: 55834df4440a51aad3c9ed05aa069c961365aafa56254aaf99a59cd64734cdbf0c8ca1aa3cd9e5d64fbce7883380ebf116d4ee9ffbd58ac414dddb6fac2f6be2
6
+ metadata.gz: af1fe8b04a2d323252026d718f64853489e80d0db24e6255e377480d51102e928215b40eda700d474d06b795aece2858759a0aaab4d87cf93b9e47c45fabd585
7
+ data.tar.gz: 0d79ef7cc04e9adfd6c075cdf776f6ffa1a1d4b4dfd7d755f3eff2dc879a4783ea580e5499d10b5bee724ebd274529fdfa46c40929d125b75cb998b06c720431
data/lib/twb.rb CHANGED
@@ -17,6 +17,7 @@ require_relative 'twb/tabclass'
17
17
  require_relative 'twb/tabtool'
18
18
  require_relative 'twb/dashboard'
19
19
  require_relative 'twb/datasource'
20
+ require_relative 'twb/connection'
20
21
  require_relative 'twb/docdashboard'
21
22
  require_relative 'twb/dbfield'
22
23
  require_relative 'twb/localfield'
@@ -56,16 +57,18 @@ require_relative 'twb/analysis/calculatedfields/markdownemitter'
56
57
  require_relative 'twb/analysis/calculatedfields/csvemitter'
57
58
  require_relative 'twb/analysis/datasources/DataSourceFieldsCSVEmitter'
58
59
  require_relative 'twb/analysis/datasources/DataSourceTableFieldsCSVEmitter'
60
+ require_relative 'twb/analysis/datasources/categoricalColorCodingAnalyzer'
59
61
  require_relative 'twb/analysis/datasources/googlesheetdatasourcesanalyzer'
60
62
  require_relative 'twb/analysis/datasources/parametersanalyzer'
63
+ require_relative 'twb/analysis/datasources/DataSourceOriginsAnalyzer'
61
64
  require_relative 'twb/analysis/Sheets/WorksheetDataStructureCSVEmitter'
62
65
  require_relative 'twb/analysis/Sheets/sheetfiltersanalyzer'
63
66
  require_relative 'twb/analysis/Sheets/sheetfieldsanalyzer'
64
67
  require_relative 'twb/analysis/Sheets/dashsheetsanalyzer'
65
68
 
66
69
 
67
- # Represents Tableau Workbooks and their contents.
70
+ # Represents Tableau Workbooks, their contents, and classes that analyze and manipulate them.
68
71
  #
69
72
  module Twb
70
- VERSION = '3.9.7'
73
+ VERSION = '4.3.1'
71
74
  end
@@ -21,7 +21,7 @@ require 'csv'
21
21
  module Twb
22
22
  module Analysis
23
23
 
24
- class CalculatedFieldsAnalyzer # < Twb::Util::Graph
24
+ class CalculatedFieldsAnalyzer
25
25
 
26
26
  include TabTool
27
27
  include Graph
@@ -83,7 +83,7 @@ DOTHEADER
83
83
 
84
84
  def initialize
85
85
  init
86
- @funcdoc = {:class=>self.class, :blurb=>'Analyze Calculated Fields from Tableau Workbooks.', :description=>'Calculated fields can be complex, this tool provides robust coverage.',}
86
+ @funcdoc = {:class=>self.class, :blurb=>'Analyze Calculated Fields', :description=>'Calculated fields can be complex, this tool provides robust coverage.',}
87
87
  #-- CSV records collectors
88
88
  @csvCalculatedFields = []
89
89
  @csvFormulaFields = []
@@ -101,6 +101,8 @@ DOTHEADER
101
101
  #--
102
102
  @localEmit = false
103
103
  @imageFiles = []
104
+ #--
105
+ @doGraph = config(:dograph)
104
106
  end
105
107
 
106
108
  def processTWB workbook
@@ -164,16 +166,21 @@ DOTHEADER
164
166
  calculatedFields = SortedSet.new
165
167
  fieldFormulaLines = []
166
168
  referencedFields = SortedSet.new
167
- dataSourceNode = Twb::Util::Graphnode.new(name: ds.uiname, id: ds.id, type: ds, properties: {workbook: @twb.name})
168
- @nodes.add dataSourceNode
169
+ # if @doGraph
170
+ dataSourceNode = Twb::Util::Graphnode.new(name: ds.uiname, id: ds.id, type: ds, properties: {workbook: @twb.name})
171
+ @nodes.add dataSourceNode
172
+ # end
169
173
  #-- process Calculatred Fields
170
174
  ds.calculatedFields.each do |calcField|
175
+ emit "Calculated Field: #{calcField}"
171
176
  calculatedFields.add calcField.id
172
177
  dsFields[calcField.uiname] = calcField
173
- calcFieldNode = Twb::Util::Graphnode.new(name: calcField.uiname, id: calcField.id, type: calcField, properties: {:DataSource => ds.uiname})
174
- @nodes.add calcFieldNode
175
- dsFieldEdge = Twb::Util::Graphedge.new(from: dataSourceNode, to: calcFieldNode, relationship: 'contains')
176
- @edges.add dsFieldEdge
178
+ # if @doGraph
179
+ calcFieldNode = Twb::Util::Graphnode.new(name: calcField.uiname, id: calcField.id, type: calcField, properties: {:DataSource => ds.uiname})
180
+ @nodes.add calcFieldNode
181
+ dsFieldEdge = Twb::Util::Graphedge.new(from: dataSourceNode, to: calcFieldNode, relationship: 'contains')
182
+ @edges.add dsFieldEdge
183
+ # end
177
184
  calculation = calcField.calculation
178
185
  if calculation.has_formula
179
186
  #-- collect field formulas as single lines
@@ -201,9 +208,9 @@ DOTHEADER
201
208
  ]
202
209
  #-- collect individual formula lines
203
210
  flnum = 0
204
- emit "@@ FL: #{calcField.uiname}"
211
+ emit "@@ calcField.uiname: #{calcField.uiname}"
205
212
  calculation.formulaResolvedLines.each do |fl|
206
- emit "@@ FL: => '#{fl}'"
213
+ emit "@@ resolved line:: => '#{fl}'"
207
214
  fieldFormulaLines << [ @calculatedFieldsCount, # 'Calc Field #',
208
215
  @twb.name, # 'Workbook',
209
216
  @twbDir, # 'Workbook Dir',
@@ -219,24 +226,32 @@ DOTHEADER
219
226
  ]
220
227
  end
221
228
  #-- collect fields referenced in formula
229
+ emit "# Calculated Fields: #{calculation.calcFields.length}"
222
230
  calculation.calcFields.each do |rf|
223
- emit " rf.name :'#{rf.name}'"
224
- emit " rf.uiname:'#{rf.uiname}'"
225
- properties = {'DataSource' => ds.uiname, 'DataSourceReference' => 'local', :source => rf}
226
- refFieldNode = Twb::Util::Graphnode.new(name: rf.uiname, id: rf.id, type: rf.type, properties: properties)
227
- @nodes.add refFieldNode
228
- fieldFieldEdge = Twb::Util::Graphedge.new(from: calcFieldNode, to: refFieldNode, relationship: 'references')
229
- @edges.add fieldFieldEdge
231
+ emit " referenced field ::'#{rf}'"
232
+ emit " referenced field.name ::'#{rf.name.nil?}' :: '#{rf.name}'"
233
+ emit " referenced field.uiname::'#{rf.uiname}'"
234
+ # if @doGraph
235
+ unless rf.uiname.nil?
236
+ properties = {'DataSource' => ds.uiname, 'DataSourceReference' => 'local', :source => rf}
237
+ refFieldNode = Twb::Util::Graphnode.new(name: rf.uiname, id: rf.id, type: rf.type, properties: properties)
238
+ @nodes.add refFieldNode
239
+ fieldFieldEdge = Twb::Util::Graphedge.new(from: calcFieldNode, to: refFieldNode, relationship: 'references')
240
+ @edges.add fieldFieldEdge
241
+ end
242
+ # end
230
243
  referencedFields.add rf.id
231
244
  refFieldTable = ds.fieldTable(rf.name)
232
245
  emit "refFieldTable.nil? : #{refFieldTable.nil?}"
233
246
  unless refFieldTable.nil?
234
247
  tableID = refFieldTable + ':::' + ds.uiname
235
248
  tableName = "||#{refFieldTable}||"
236
- tableNode = Twb::Util::Graphnode.new(name: tableName, id: tableID, type: :DBTable, properties: properties)
237
- @nodes.add tableNode
238
- fieldFieldEdge = Twb::Util::Graphedge.new(from: refFieldNode, to: tableNode, relationship: 'is a field in')
239
- @edges.add fieldFieldEdge
249
+ # if @doGraph
250
+ tableNode = Twb::Util::Graphnode.new(name: tableName, id: tableID, type: :DBTable, properties: properties)
251
+ @nodes.add tableNode
252
+ fieldFieldEdge = Twb::Util::Graphedge.new(from: refFieldNode, to: tableNode, relationship: 'is a field in')
253
+ @edges.add fieldFieldEdge
254
+ # end
240
255
  # fldToDsNode = tableNode
241
256
  end
242
257
  @csvFormulaFields << [
@@ -259,8 +274,10 @@ DOTHEADER
259
274
  dsRootFields = calculatedFields - referencedFields
260
275
  @referencedFields.merge referencedFields
261
276
  @twbRootFields.merge dsRootFields
262
- cypher @twb.name
263
- cypherPy @twb.name
277
+ if @doGraph
278
+ cypher @twb.name
279
+ cypherPy @twb.name
280
+ end
264
281
  emit "#######################"
265
282
  #-- record calculated fields
266
283
  emit "@@ record calculated fields ds: #{ds.uiname}"
@@ -333,19 +350,23 @@ DOTHEADER
333
350
  end
334
351
 
335
352
  def cypher twbName
336
- cypher = Twb::Util::Cypher.new
337
- cypher.fileName = "#{twbName}.calcFields"
338
- cypher.nodes = @nodes
339
- cypher.edges = @edges
340
- cypher.render
353
+ if @doGraph
354
+ cypher = Twb::Util::Cypher.new
355
+ cypher.fileName = "#{twbName}.calcFields"
356
+ cypher.nodes = @nodes
357
+ cypher.edges = @edges
358
+ cypher.render
359
+ end
341
360
  end
342
361
 
343
362
  def cypherPy twbName
344
- cypher = Twb::Util::CypherPython.new
345
- cypher.fileName = "#{twbName}.calcFields"
346
- cypher.nodes = @nodes
347
- cypher.edges = @edges
348
- cypher.render
363
+ if @doGraph
364
+ cypher = Twb::Util::CypherPython.new
365
+ cypher.fileName = "#{twbName}.calcFields"
366
+ cypher.nodes = @nodes
367
+ cypher.edges = @edges
368
+ cypher.render
369
+ end
349
370
  end
350
371
 
351
372
  # def graphEdges twb
@@ -424,7 +445,6 @@ DOTHEADER
424
445
  dotFile.puts " }"
425
446
  end
426
447
 
427
-
428
448
  def labelTypes dotFile
429
449
  fromTos = Set.new
430
450
  @edges.each do |edge|
@@ -13,7 +13,7 @@
13
13
  # You should have received a copy of the GNU General Public License
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
- # require 'twb'
16
+ require 'kramdown'
17
17
 
18
18
  module Twb
19
19
  module Analysis
@@ -26,15 +26,34 @@ module CalculatedFields
26
26
 
27
27
  def initialize
28
28
  init
29
- @funcdoc = {:class=>self.class, :blurb=>'Generate Markdown doc for Calculated Fields.', :description=>'Creates a Markdown file documenting the Calculated Fields for an individual Workbook.',}
29
+ @funcdoc = {:class=>self.class, :blurb=>'Create Markdown files (one per Workbook) documenting Calculated Fields', :description=>'Create Markdown files (one per Workbook) documenting Calculated Fields' }
30
30
  @metrics = {}
31
31
  end
32
32
 
33
+ def kramdownAvailable
34
+ gem_name, *gem_ver_reqs = 'kramdown', '~> 1.17.0'
35
+ gdep = Gem::Dependency.new(gem_name, *gem_ver_reqs)
36
+ # find latest that satisifies
37
+ found_gspec = gdep.matching_specs.max_by(&:version)
38
+ # instead of using Gem::Dependency, you can also do:
39
+ # Gem::Specification.find_all_by_name(gem_name, *gem_ver_reqs)
40
+ # if found_gspec
41
+ # puts "Requirement '#{gdep}' already satisfied by #{found_gspec.name}-#{found_gspec.version}"
42
+ # else
43
+ # puts "Requirement '#{gdep}' not satisfied; could be installing..."
44
+ # # reqs_string will be in the format: "> 1.0, < 1.2"
45
+ # # reqs_string = gdep.requirements_list.join(', ')
46
+ # # multi-arg is safer, to avoid injection attacks
47
+ # # system('gem', 'install', gem_name, '-v', reqs_string)
48
+ # end
49
+ end
50
+
33
51
  def processTWB twb
34
52
  # twb = File.basename(twb)
35
53
  @twb = twb #Twb::Workbook.new twb
36
54
  @docFileName = './ttdoc/' + @twb.name + '.CalculatedFields.md'
37
55
  @docFile = File.open(@docFileName,'w')
56
+ addDocFile @docFileName,"Markdown file of Calculated fields for Workbook '#{@twb.name}'"
38
57
  @docFile.puts "# #{twb.name}"
39
58
  dsNames = @twb.datasourceUINames
40
59
  @docFile.puts "#{dsNames.length} Data Sources"
@@ -78,6 +97,9 @@ module CalculatedFields
78
97
  end
79
98
  @docFile.puts "counted #{cnt} calculated fields\n "
80
99
  end # twb.datasources.each
100
+ if kramdownAvailable
101
+ emit 'processing Markdown: kramdownAvailable'
102
+ end
81
103
  finis
82
104
  end # def processTwb twb
83
105
 
@@ -0,0 +1,99 @@
1
+ # categoricalColorCodingAnalyzer.rb Copyright (C) 2018 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'twb'
17
+ require 'csv'
18
+
19
+ module Twb
20
+ module Analysis
21
+
22
+ class CategoricalColorCodingAnalyzer
23
+
24
+ include TabTool
25
+
26
+ attr_accessor :localEmit
27
+
28
+ def initialize
29
+ init
30
+ @funcdoc = {:class=>self.class, :blurb=>"Analyze Fields' values categorical color coding from Tableau Workbooks.", :description=>nil,}
31
+ #--
32
+ docFileName = docFile('CategoricalColorMappings.csv')
33
+ $csv = CSV.open(docFileName,'w')
34
+ $csv << ['Workbook', 'Workbook Dir', 'Data Source', 'Field Code', 'Field Tech', 'Field', 'Value', 'Colour']
35
+ addDocFile docFileName, "Workbooks, Data Sources, Fields, and the Fields' members' categorical color codings."
36
+ #--
37
+ @twbCnt = 0
38
+ @dscnt = 0
39
+ @fieldsCnt = 0
40
+ end
41
+
42
+ def metrics
43
+ {
44
+ '# of Workbooks' => @twbcount,
45
+ '# of data sources' => @dscnt,
46
+ '# of Worksheet Fields' => @fieldsCnt
47
+ }
48
+ end
49
+
50
+ def processTWB twb
51
+ @twb = twb
52
+ twbName = twb.name
53
+ twbDir = twb.dir
54
+ emit " -- #{twbName}"
55
+ @twbCnt += 1
56
+ @twbDomainsLoaded = false
57
+ # <style>
58
+ # <style-rule element='mark'>
59
+ # <encoding attr='color' field='[none:Calculation_267401288043974656:nk]' type='palette'>
60
+ # <map to='#1f77b4'>
61
+ # <bucket>&quot;Consistently Meets Expectations&quot;</bucket>
62
+ twb.datasources.each do |ds|
63
+ dsName = ds.uiname
64
+ puts "\t - #{dsName}"
65
+ coloredFields = ds.node.xpath('.//style/style-rule/encoding[@attr="color"]')
66
+ # puts "\t #{coloredFields.length} \t #{coloredFields.class} \t #{coloredFields.nil?}"
67
+ coloredFields.each do |cf|
68
+ puts "Attributes: #{cf.attributes}"
69
+ fieldCode = cf['field']
70
+ fieldTech = fieldCode.sub(/^\[/,'').sub(/\]$/,'').sub(/^(none|attr|usr):/,'').sub(/:nk$/,'')
71
+ fieldUI = ds.fieldUIName fieldTech
72
+ # puts "\t - #{field}"
73
+ maps = cf.xpath('./map')
74
+ maps.each do |map|
75
+ puts "MAP\n---\n#{map}\n--"
76
+ color = map['to']
77
+ value = ''
78
+ values = map.xpath('.//bucket')
79
+ unless values.nil?
80
+ if values.length == 1
81
+ value = values.first.text.gsub(/^"/,'').gsub(/"$/,'')
82
+ else
83
+ values.each do |bv|
84
+ value += "::#{bv.text}"
85
+ end
86
+ end
87
+ end
88
+ # puts "\t - #{color} -> #{value}"
89
+ $csv << [twbName, twbDir, dsName, fieldCode, fieldTech, fieldUI, value, color]
90
+ puts "VALUE: #{value}"
91
+ end
92
+ end
93
+ end
94
+ end
95
+
96
+ end #class CategoricalColorCodingAnalyzer
97
+
98
+ end # module Analysis
99
+ end # module Twb
@@ -0,0 +1,71 @@
1
+ # DataSourceOriginsAnalyzer.rb Copyright (C) 2018 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'twb'
17
+ require 'csv'
18
+
19
+ module Twb
20
+ module Analysis
21
+
22
+ class DataSourceOriginsAnalyzer
23
+
24
+ include TabTool
25
+
26
+ @@recNum = 0
27
+
28
+ attr_accessor :localEmit
29
+
30
+ def initialize
31
+ init
32
+ @funcdoc = {:class=>self.class, :blurb=>'Analyze Data Source Origins, i.e. where the data comes from', :description=>nil,}
33
+ #--
34
+ docFileName = docFile('DataSourceOrigins.csv')
35
+ @csvFile = CSV.open(docFileName,'w')
36
+ @csvFile << ['Workbook', 'Workbook Version', 'Workbook Directory', 'Data Source', 'Data Source (tech)', 'Is Published?', "Rec #"]
37
+ addDocFile docFileName, "Workbooks, Data Sources, and the Data Sources' origins"
38
+ #--
39
+ @twbCnt = 0
40
+ @dsCnt = 0
41
+ end
42
+
43
+ def metrics
44
+ {
45
+ '# of Workbooks' => @twbcount,
46
+ '# of Data Sources' => @dsCnt,
47
+ }
48
+ end
49
+
50
+ def processTWB twb
51
+ @twb = twb
52
+ emit " -- twb:: #{@twb.name}"
53
+ @twbCnt += 1
54
+ @twbDomainsLoaded = false
55
+ parseDataSources
56
+ finis
57
+ end
58
+
59
+ private
60
+
61
+ def parseDataSources
62
+ @twb.datasources.each do |ds|
63
+ @csvFile << [@twb.name, @twb.version, @twb.dir, ds.uiname, ds.name, ds.isPublished, @@recNum+=1]
64
+ @dsCnt += 1
65
+ end
66
+ end
67
+
68
+ end #class SheetFieldsAnalyzer
69
+
70
+ end # module Analysis
71
+ end # module Twb
@@ -0,0 +1,122 @@
1
+ # sheetfieldsanalyzer.rb Copyright (C) 2018 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'twb'
17
+ require 'csv'
18
+
19
+ module Twb
20
+ module Analysis
21
+
22
+ class SheetSourcesAnalyzer
23
+
24
+ include TabTool
25
+
26
+ attr_accessor :localEmit
27
+
28
+ def initialize
29
+ init
30
+ @funcdoc = {:class=>self.class, :blurb=>'Analyze Worksheet Fields', :description=>nil,}
31
+ #--
32
+ docFileName = docFile('WorksheetFields.csv')
33
+ @sheetFieldsCSV = CSV.open(docFileName,'w')
34
+ @sheetFieldsCSV << ['Workbook','Worksheet','Data Source','Data Source (tech)','Field','Field (tech)','Usage']
35
+ addDocFile docFileName, "Workbooks, Worksheets, and the Sheets' Data Sources and Fields"
36
+ #--
37
+ @twbCnt = 0
38
+ @sheetCnt = 0
39
+ @fieldsCnt = 0
40
+ end
41
+
42
+ def metrics
43
+ {
44
+ '# of Workbooks' => @twbcount,
45
+ '# of Worksheets' => @sheetCnt,
46
+ '# of Worksheet Fields' => @fieldsCnt
47
+ }
48
+ end
49
+
50
+ def processTWB twb
51
+ @twb = twb
52
+ emit " -- twb:: #{@twb.name}"
53
+ @twbCnt += 1
54
+ @twbDomainsLoaded = false
55
+ parseSheets
56
+ finis
57
+ end
58
+
59
+ private
60
+
61
+ def parseSheets
62
+ @worksheets = @twb.worksheets
63
+ @worksheets.each do |sheet|
64
+ @sheet = sheet.name
65
+ @sheetCnt += 1
66
+ emit "SHEET: #{@sheet}"
67
+ showFields sheet unless sheet.datasourceFields.nil?
68
+ end
69
+ end
70
+
71
+ def showFields sheet
72
+ showDBFields sheet
73
+ showRCFields sheet.rowFields, :row
74
+ showRCFields sheet.colFields, :column
75
+ end
76
+
77
+ def showDBFields sheet
78
+ fields = sheet.datasourceFields
79
+ emit "def showDBFields sheet: #{sheet.name} #FIELDS: #{fields.length}"
80
+ if fields.nil?
81
+ @sheetFieldsCSV << [@twb.name, @sheet, nil, nil, nil, nil, nil]
82
+ end
83
+ fields.each do |dsName, dsfields|
84
+ ds = @twb.datasource dsName
85
+ emit " ds: #{dsName}"
86
+ emit " - #{ds.uiname}"
87
+ emit " : #{ds.class}"
88
+ dsfields.each do |sheetField|
89
+ @fieldsCnt += 1
90
+ emit " f: #{sheetField}"
91
+ emit " c: #{sheetField.class}"
92
+ fuiName = ds.fieldUIName sheetField #Fields[sheetField]
93
+ @sheetFieldsCSV << [@twb.name, @sheet, ds.uiname, dsName, sheetField.uiname, sheetField.name, 'DB ref']
94
+ # emit true, " : #{dsFields[field].class}"
95
+ end
96
+ end
97
+ end
98
+
99
+ def showRCFields fields, usage
100
+ emit "def showRCFields #fields: #{fields.length} \t #{fields}"
101
+ if fields.nil?
102
+ @sheetFieldsCSV << [@twb.name, @sheet, nil, nil, nil, nil, nil]
103
+ else
104
+ fields.each do |cf|
105
+ emit "coded field: #{cf}"
106
+ fldName = cf.name
107
+ dsName = cf.dataSource
108
+ ds = @twb.datasource cf.dataSource
109
+ emit "DATASOURCE : #{ds.class} " #{ }" #{ds}"
110
+ fuiName = ds.fieldUIName cf.name
111
+ emit " ds: #{dsName}"
112
+ emit " - #{ds.uiname}"
113
+ emit " : #{ds.class}"
114
+ @sheetFieldsCSV << [@twb.name, @sheet, ds.uiname, dsName, fuiName, fldName, usage]
115
+ end
116
+ end
117
+ end
118
+
119
+ end #class SheetFieldsAnalyzer
120
+
121
+ end # module Analysis
122
+ end # module Twb