jwarz
-
Posts
4 -
Joined
-
Last visited
Posts posted by jwarz
-
-
sure not a problem!
below is the rule for the Table:
var DataSource = "Multi-line records"; // "Data Source:" (Required): DataSourceList var Columns = // "Column": MultiGroup with fields: [ { "Field": "name", "Heading": "Biomarker", "Width": HundredthsOfPointsFromText("2 in"), "HAlign": "Left", "VAlign": "Middle", "Format": { }, }, { "Field": "observation", "Heading": "Result", "Width": HundredthsOfPointsFromText("1 in"), "HAlign": "Left", "VAlign": "Middle", "Format": { }, }, { "Field": "interpretation", "Heading": "Finding", "Width": HundredthsOfPointsFromText("1.5 in"), "HAlign": "Left", "VAlign": "Middle", "Format": { }, }, ]; var Style = "Biomarker Results Table Format"; var StretchColumnsToFrameWidth = true; var table = new FPTable; if (Style) table = Rule(Style); for (var i in Columns) table.AddColumn(Columns[i].Width); var header = table.AddRow(); header.Type = "header"; for (var c in Columns) { var column = Columns[c]; var cell = header.Cells[c]; cell.Content = TaggedTextFromRaw(column.Heading || column.Field); cell.HAlign = column.HAlign; cell.VAlign = column.VAlign; if (table.style && table.style.headerStyle) { var HeaderStyle = table.style.headerStyle; cell.Font = HeaderStyle.family; cell.Bold = HeaderStyle.bold; cell.Italics = HeaderStyle.italic; cell.PointSize = HeaderStyle.pointsize; cell.TextColor = HeaderStyle.color; } if (table.style && table.style.each_cell.Rulings) cell.Rulings = table.style.each_cell.Rulings; if (table.style && table.style.each_cell.Margins) cell.Margins = table.style.each_cell.Margins; } // Create the main body from the data. var data; if (DataSource == "Multi-line records") data = FusionPro.GetMultiLineRecords(); else data = FusionPro.GetDataSource(DataSource); for (var r = 1; r <= data.recordCount; r++) { var row = table.AddRow(); for (var c in Columns) { var column = Columns[c]; var cell = row.Cells[c]; cell.Content = FormatGenericTagged(column.Format, data.GetFieldValue(r, column.Field)); cell.HAlign = column.HAlign; cell.VAlign = column.VAlign; if (table.style && table.style.bodyStyle) { var BodyStyle = table.style.bodyStyle; cell.Font = BodyStyle.family; cell.Bold = BodyStyle.bold; cell.Italics = BodyStyle.italic; cell.PointSize = BodyStyle.pointsize; cell.TextColor = BodyStyle.color; } if (table.style && table.style.each_cell.Rulings) cell.Rulings = table.style.each_cell.Rulings; if (table.style && table.style.each_cell.Margins) cell.Margins = table.style.each_cell.Margins; } } if (StretchColumnsToFrameWidth) table.StretchColumnsToFrameWidth(); return table;
and we also have a Table Format Rule:
Quote// Rule converted from XML Template "Biomarker Results Table Format": // Begin XML Template selections // var HasGrid = false; // "Grid": CheckGroup var GridStyle = "All"; // "Style:" (Required): PickList ["Inside" (Inside), "Outside" (Outside), "All" (All)] var Color = "Black"; // "Color:" (Required): ColorList var Thickness = "Thin"; // "Thickness:" (Required): PickList ["Thin" (Thin), "Medium" (Medium), "Thick" (Thick)] var HasHeaderShading = false; // "Header Shading": CheckGroup var HeaderColor = "Black"; // "Color:" (Required): ColorList var HeaderTint = Int("30"); // "Tint (%):" (Required): SingleLine (Integer) var HasRowShading = false; // "Row Shading": CheckGroup var RowColor1 = "Black"; // "First Color:" (Required): ColorList var RowTint1 = Int("30"); // "Tint (%):" (Required): SingleLine (Integer) var RowColor2 = "White"; // "Second Color:": ColorList var RowTint2 = Int("30"); // "Tint (%):" (Required): SingleLine (Integer) // Section "Margins": var MarginLeft = HundredthsOfPointsFromText("6 pt"); // "Left:": Space (SmallUnits) var MarginRight = HundredthsOfPointsFromText("6 pt"); // "Right:": Space (SmallUnits) var MarginTop = HundredthsOfPointsFromText("0 pt"); // "Top:": Space (SmallUnits) var MarginBottom = HundredthsOfPointsFromText("0 pt"); // "Bottom:": Space (SmallUnits) // Section "Fonts": var HeaderStyle = { "bold": "0", "color": "Black", "family": "Arial Black", "italic": "0", "pointsize": "11 pt", }; // "Header Font:": CharStyle var BodyStyle = { "bold": "0", "color": "Black", "family": "Arial", "italic": "0", "pointsize": "11 pt", }; // "Body Font:": CharStyle // End XML Template selections // var table = new FPTable; table.style = { each_cell: {}, headerStyle: HeaderStyle, bodyStyle: BodyStyle }; if (HasGrid) { if (GridStyle != "Inside") table.SetBorders(Thickness, Color, "Top", "Bottom", "Left", "Right"); if (GridStyle != "Outside") { var eachCellRuling = { Color: Color, Thickness: Thickness }; // These need to be copied to each cell after the table is populated with data: table.style.each_cell.Rulings = { Left: eachCellRuling, Right: eachCellRuling, Top: eachCellRuling, Bottom: eachCellRuling }; } } if (HasHeaderShading) { table.HeaderShadingColor = HeaderColor; table.HeaderShadingPct = HeaderTint; } if (HasRowShading) { table.ShadingColor1 = RowColor1; table.ShadingPct1 = RowTint1; table.ShadingColor2 = RowColor2; table.ShadingPct2 = RowTint2; } // These need to be copied to each cell after the table is populated with data: table.style.each_cell.Margins = { Left: MarginLeft, Right: MarginRight, Top: MarginTop / 10, Bottom: MarginBottom / 10 }; return table;
-
Your are a life saver. So it is validating correctly on the multi line record rule, but its still displaying blanks in the table?
-
Hello,
We are very new the MultiLine record thing and were having through getting our data to display "N/A" if one of the cells are blank within the table.
var result = ""; var data = FusionPro.GetMultiLineRecords(); for (var r = 1; r <= data.recordCount; r++) result += data.GetFieldValue(r, "name") + " " + data.GetFieldValue(r, "observation") + " " + data.GetFieldValue(r, "interpretation") + "\n"; return result;
I have another rule that says...
if (Field("observation") == "") { return "N/A"; } else { return Field("observation"); }
So I was thinking maybe we could tell the data.GetFieldValue(r, "observation") to somehow read a rule rather than field. But then I also got the idea of putting something in the table format that if it finds a blank, return N/A, but again I couldn't seem to figure that one out either. Either way would be fine, as long as we can get any cell in the table thats blank to display N/A??
MultiLine Record, return "N/A" if Blank content
in FusionPro® VDP Creator
Posted
that did the trick!!! Thank you so much you are a life saver! 😃❤️