/// <summary> /// Creates a TWB file that points to the CSV file /// </summary> /// <param name="pathReportCsv"></param> private void Execute_GenerateSiteInventoryFile_Twb(string pathReportCsv) { _statusLog.AddStatusHeader("Generate site inventory TWB"); try { //Calculate the name/path for the output TWB. It will match the name/path of the CSV file string pathTwbOut = PathHelper.GetInventoryTwbPathMatchingCsvPath(pathReportCsv); this.StatusLog.AddStatusHeader("Generating Tableau Workbook " + pathTwbOut); var twbGenerateFromTemplate = new TwbReplaceCSVReference( PathHelper.GetInventoryTwbTemplatePath(), //*.twb we are using as our template pathTwbOut, //Output *.twb we are generating "siteInventory", //Datasource name in tempalte workbook pathReportCsv, //CSV file we want to associate with the datasource above _statusLog); //Transform the template into the output file bool successRemapping = twbGenerateFromTemplate.Execute(); if (!successRemapping) { this.StatusLog.AddError("Error generating site inventory TWB. No data source could be found to remap"); } //Store it as our output if (File.Exists(pathTwbOut)) { _pathGeneratedSiteInventoryReportTwb = pathTwbOut; } } catch (Exception ex) { StatusLog.AddError("Error generating Twb file: " + ex.ToString()); } }
/// <summary> /// Creates a TWB file that points to the CSV file /// </summary> /// <param name="pathReportCsv"></param> private void Execute_GenerateSiteInventoryFile_Twb(string pathReportCsv) { _statusLog.AddStatusHeader("Generate site inventory TWB"); try { //Calculate the name/path for the output TWB. It will match the name/path of the CSV file string pathTwbOut = PathHelper.GetInventoryTwbPathMatchingCsvPath(pathReportCsv); this.StatusLog.AddStatusHeader("Generating Tableau Workbook " + pathTwbOut); var twbGenerateFromTemplate = new TwbReplaceCSVReference( PathHelper.GetInventoryTwbTemplatePath(), //*.twb we are using as our template pathTwbOut, //Output *.twb we are generating "siteInventory", //Datasource name in tempalte workbook pathReportCsv, //CSV file we want to associate with the datasource above _statusLog); //Transform the template into the output file bool successRemapping = twbGenerateFromTemplate.Execute(); if (!successRemapping) { this.StatusLog.AddError("Error generating site inventory TWB. No data source could be found to remap"); } //Store it as our output if (File.Exists(pathTwbOut)) { _pathGeneratedSiteInventoryReportTwb = pathTwbOut; } } catch(Exception ex) { StatusLog.AddError("Error generating Twb file: " + ex.ToString()); } }