dbentley Posted June 15, 2011 Share Posted June 15, 2011 Hi All. I'll start off by saying that I am completely new to the Table functions within Fusion Pro. With that being said... I'm trying to create a Table that includes new Rows if certain fields are populated within a record. I have been successful, I think, in having the content flow as needed, but the shading and borders continue to remain static. I only want to have the shaded/white rows and borders to appear if there is content available within those specified fields. I have tried many, many ways to fit the shading and borders into the rule, and really have come to the conclusion that I need help. Also, I would welcome any ideas on how to clean this rule up. I have attached the working test template as well as the test data file. Thanks so much in advance.Table_Test.pdfTableTest.txt Link to comment Share on other sites More sharing options...
dbentley Posted June 15, 2011 Author Share Posted June 15, 2011 I figured I could post the rule I have created as well in case it isn't necessary to go into the template for explanation. See below... FPTable.prototype.NewRow = function() { myTable.AddRows(1); return myTable.Rows[myTable.Rows.length-1]; } //DomainTable var myTable = new FPTable; myTable.AddColumns(14000, 9000, 9000, 9000, 9000, 9000, 9000); // Add rows as we go... var row = null; // FPTableRow // Domain rows; some are optional. for (var DomainNum = 1; DomainNum <= 8; DomainNum++) { var FieldValDom1 = ""; try { FieldValDom1 = Field("Domain1"); } catch (e) {} if (FieldValDom1) { row = myTable.NewRow(); row.Cells[0].Content = FieldValDom1; row.Cells[1].Content = Field("Expires1"); row.Cells[2].Content = Field("Privacy1"); row.Cells[3].Content = Field("Auto-Renew1"); row.Cells[4].Content = Field("Free Easy Email1"); row.Cells[5].Content = Field("Free InstantPage1"); row.Cells[6].Content = Field("Free InstantPage1"); for (var c = 1; c <= 5; c++) row.Cells[c+1].Content = FieldValDom1; } } myTable.Rows[0].Cells[0].ShadeColor="Green"; myTable.Rows[0].Cells[0].ShadePct=30; myTable.Rows[0].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[0].Cells[0].Font="Times New Roman"; myTable.Rows[0].Cells[0].TextColor="Black"; myTable.Rows[0].Cells[0].PointSize=8; myTable.Rows[0].Cells[0].SetBorders ("Thin", "Black", "Top", "Bottom", "Right"); myTable.Rows[0].Cells[0].VAlign = "middle"; myTable.Rows[0].Cells[0].HAlign = "Center"; myTable.Rows[0].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[0].Cells[0].Content="Domain"; myTable.Rows[0].Cells[1].Content="Expires"; myTable.Rows[0].Cells[2].Content="Privacy"; myTable.Rows[0].Cells[3].Content="Auto-Renew"; myTable.Rows[0].Cells[4].Content="FREE Easy Email"; myTable.Rows[0].Cells[5].Content="FREE InstantPage"; myTable.Rows[0].Cells[6].Content="Action Required"; myTable.Rows[1].Cells[0].SetContents=Field("NewDomainNames1"); myTable.Rows[1].Cells[1].SetContents=Field("Expires1"); myTable.Rows[1].Cells[2].SetContents=Field("Privacy1"); myTable.Rows[1].Cells[3].SetContents=Field("Auto-Renew1"); myTable.Rows[1].Cells[4].SetContents=Field("Free Easy Email1"); myTable.Rows[1].Cells[5].SetContents=Field("Free InstantPage1"); myTable.Rows[1].Cells[6].SetContents=Field("Action Required1"); //Row1 formatting myTable.Rows[1].Cells[0].Font="Arial"; myTable.Rows[1].Cells[0].TextColor="Green"; myTable.Rows[1].Cells[0].PointSize=6; myTable.Rows[1].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[1].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[1].SetContents (Field("Domain1"), Field("Expires1"), Field("Privacy1"), Field("Auto-Renew1"), Field("Free Easy Email1"), Field("Free InstantPage1"), Field("Action Required1")); //Row2 formatting myTable.Rows[2].Cells[0].Font="Arial"; myTable.Rows[2].Cells[0].TextColor="Green"; myTable.Rows[2].Cells[0].PointSize=6; myTable.Rows[2].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[2].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[2].SetContents (Field("Domain2"), Field("Expires2"), Field("Privacy2"), Field("Auto-Renew2"), Field("Free Easy Email2"), Field("Free InstantPage2"), Field("Action Required2")); //Row3 formatting myTable.Rows[3].Cells[0].Font="Arial"; myTable.Rows[3].Cells[0].TextColor="Green"; myTable.Rows[3].Cells[0].PointSize=6; myTable.Rows[3].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[3].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[3].SetContents (Field("Domain3"), Field("Expires3"), Field("Privacy3"), Field("Auto-Renew3"), Field("Free Easy Email3"), Field("Free InstantPage3"), Field("Action Required3")); //Row4 formatting myTable.Rows[4].Cells[0].Font="Arial"; myTable.Rows[4].Cells[0].TextColor="Green"; myTable.Rows[4].Cells[0].PointSize=6; myTable.Rows[4].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[4].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[4].SetContents (Field("Domain4"), Field("Expires4"), Field("Privacy4"), Field("Auto-Renew4"), Field("Free Easy Email4"), Field("Free InstantPage4"), Field("Action Required4")); //Row5 formatting myTable.Rows[5].Cells[0].Font="Arial"; myTable.Rows[5].Cells[0].TextColor="Green"; myTable.Rows[5].Cells[0].PointSize=6; myTable.Rows[5].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[5].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[5].SetContents (Field("Domain5"), Field("Expires5"), Field("Privacy5"), Field("Auto-Renew5"), Field("Free Easy Email5"), Field("Free InstantPage5"), Field("Action Required5")); //Row6 formatting myTable.Rows[6].Cells[0].Font="Arial"; myTable.Rows[6].Cells[0].TextColor="Green"; myTable.Rows[6].Cells[0].PointSize=6; myTable.Rows[6].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[6].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[6].SetContents (Field("Domain6"), Field("Expires6"), Field("Privacy6"), Field("Auto-Renew6"), Field("Free Easy Email6"), Field("Free InstantPage6"), Field("Action Required6")); //Row7 formatting myTable.Rows[7].Cells[0].Font="Arial"; myTable.Rows[7].Cells[0].TextColor="Green"; myTable.Rows[7].Cells[0].PointSize=6; myTable.Rows[7].Cells[0].SetBorders ("Thin", "Black", "Top", "Right"); myTable.Rows[7].CopyCells(0, 1,2,3,4,5,6); myTable.Rows[7].SetContents (Field("Domain7"), Field("Expires7"), Field("Privacy7"), Field("Auto-Renew7"), Field("Free Easy Email7"), Field("Free InstantPage7"), Field("Action Required7")); // Apply formatting to all the rows. for (var a = 0; a < myTable.Rows.length; a++) { myTable.Rows[a].Cells[0].Bold = "On"; for (var b = 0; b < myTable.Columns.length; b++) { myTable.Rows[a].Cells.SetBorders("Thin", "Black", "Top", "Bottom"); myTable.Rows[a].Cells.VAlign = "middle"; myTable.Rows[a].Cells.Margins = new FPTableMargins; myTable.Rows[a].Cells.Margins.Top = 60; myTable.Rows[a].Cells.Margins.Bottom = 40; myTable.Rows[a].Cells.Margins.Left = 600; myTable.Rows[a].Cells.Margins.Right = 600; myTable.ShadingColor1 = "Black"; myTable.ShadingPct1 = 1; myTable.ShadingRepeat1 = 1; myTable.ShadingColor2 = "Black"; myTable.ShadingPct2 = 20; myTable.ShadingRepeat2 = 1; myTable.ShadingType = "ByRow" } } return myTable.MakeTags(); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.