Jump to content

Help Setting up a table with 1 to 6 rows


JasonW

Recommended Posts

I have been trying to fix a table all day. I have my main data and then a secondary data file that uses a LookupID number to match back between files. The secondary datafile will contain the table information. I can create the table using the FusionPro Rules for Table Style and Table- from data source. It is almost good enough to pass. The issue is I need to have a check box between each column. See below and please disregard the first column in the example as that is the LookupID number. I have tried converting my table to javascript that I created the Table-From Data Source to add the check box but all I get is the first row to show up as check boxes.

tablesamplepic.thumb.JPG.a9ca894fbc7cd306084cbdc151b115c2.JPG

I have also tried creating a table using javascript but when I get the secondary data file selected, I cannot get the first field to be seen. I also cannot get a loop command to work. I usually try to find code in the support community sites and change them to work for me but haven't had success with this one.

Please note that the second column has some long records that will need to wrap if possible. It is always fun when clients don't consider how long some fields actually are when placed into there letters. Also I am trying to get at least six rows into the table, I mention this because some will have more than six rows.

Thank you for any help, it is appreaciated. I am trying to get better with the table scripts.

unc renew letter.zip

Link to comment
Share on other sites

Good Morning,

So I have been able to make at least a little progress on this job. I have finally gotten the file to link to a secondary database and make a table pulling the fields needed. My only issue is I still cannot get the check boxes to show up in front of each column. I am including what I have been able to get to work so far. Can someone maybe give me an idea what I need to add to this to make the boxes work. The checkbox is using webdings lowercase c to create the box. I tried setting the content with the letter c since I did define the font. I have also tried just setting up fields in the data to accomplish this. Both have not worked. Any ideas or help is appreciated.

 

 

 

if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true)
{
    Rule("OnJobStart");
}


//Get a count of the total number of records in the external data file
numRecsExtDF = externalDF.recordCount;

/*=============================================================================
||  Create arrays to hold values that match the CID of the client's record
||=============================================================================*/
    var clientMatch = [];
    var box = [];
    var support = [];
    var box1 = [];
    var ask1 = [];
    var box2 = [];
    var ask2 = [];
    var box3 = [];
    var ask3 = [];
    var box4 = [];
    var ask4 = [];
    

    // Step through the external data file and push matches into their respective variables if there is a match
    for (var i=1; i <= numRecsExtDF; i++) {
        if (externalDF.GetFieldValue(i, 'LOOKUPID') == Field("LOOKUPID")) {
            clientMatch.push(externalDF.GetFieldValue(i, 'LOOKUPID'));
            box.push(externalDF.GetFieldValue(i, 'box'));
            support.push(externalDF.GetFieldValue(i, 'sup1'));
            box1.push(externalDF.GetFieldValue(i, 'box1'));
            ask1.push(externalDF.GetFieldValue(i, 'ask1'));
            box2.push(externalDF.GetFieldValue(i, 'box2'));
            ask2.push(externalDF.GetFieldValue(i, 'ask2'));
            box3.push(externalDF.GetFieldValue(i, 'box3'));
            ask3.push(externalDF.GetFieldValue(i, 'ask3'));
            box4.push(externalDF.GetFieldValue(i, 'box4'));
            ask4.push(externalDF.GetFieldValue(i, 'ask4'));
            
            
        }
    }
      
/*=============================================================================
||  Create the table
||=============================================================================*/
    new FPTable;
    var myTable = new FPTable;
    myTable.AddColumns(900, 23000, 900, 8000, 900, 8000, 900, 8000, 900, 9000);     // 1 inch = 7200 pts
 //   myTable.AddRows(clientMatch.length+2);              // add 2 additional rows (Header and summary lines)
    myTable.AddRows(clientMatch.length+1);              // acutal rows needed

    // HEADER ROW FORMATTING
            //myTable.Rows[0].Cells[0].Font = "Myriad Pro";
            //myTable.Rows[0].Cells[0].PointSize = "7";
            //myTable.Rows[0].Cells[0].TextColor = "uncdark";
            //myTable.Rows[0].Cells[0].Margins = new FPTableMargins;
            //myTable.Rows[0].Cells[0].Margins.Top = 20;
            //myTable.Rows[0].Cells[0].Margins.Bottom = 20;
            //myTable.Rows[0].Cells[0].HAlign = "Left";
            //myTable.Rows[0].Cells[0].VAlign = "Top";
            //myTable.Rows[0].CopyCells(0, 1); // Apply the same formating to each cell in this row
    // HEADER ROW CONTENT
            //myTable.Rows[0].SetContents(" ", " ");

        // interate through the length of the arrays (data matches from external data file) and create rows
        for (var i=1; i<=clientMatch.length; i++) {
            // TABLE CONTENT FORMATTING for checkbox(all even cells) and variable fields (all odd cells)
                myTable.Rows[i].Cells[0].Font = "Webdings";
                myTable.Rows[i].Cells[0].PointSize = "8";
                myTable.Rows[i].Cells[0].TextColor="uncblue";
                myTable.Rows[i].Cells[0].HAlign = "Left";
                myTable.Rows[i].Cells[0].VAlign = "Top";
                myTable.Rows[i].Cells[0].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[0].Margins.Top = 5;
                myTable.Rows[i].Cells[0].Margins.Bottom = 10;
                myTable.Rows[i].Cells[1].Font = "Myriad Pro";
                myTable.Rows[i].Cells[1].PointSize = "7";
                myTable.Rows[i].Cells[1].TextColor="uncdark";
                myTable.Rows[i].Cells[1].HAlign = "Left";
                myTable.Rows[i].Cells[1].VAlign = "Top";
                myTable.Rows[i].Cells[1].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[1].Margins.Top = 5;
                myTable.Rows[i].Cells[1].Margins.Bottom = 8;
                myTable.Rows[i].Cells[2].Font = "Webdings";
                myTable.Rows[i].Cells[2].PointSize = "10";
                myTable.Rows[i].Cells[2].TextColor="uncblue";
                myTable.Rows[i].Cells[2].HAlign = "Left";
                myTable.Rows[i].Cells[2].VAlign = "Top";
                myTable.Rows[i].Cells[2].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[2].Margins.Top = 5;
                myTable.Rows[i].Cells[2].Margins.Bottom = 10;
                myTable.Rows[i].Cells[3].Font = "Myriad Pro";
                myTable.Rows[i].Cells[3].PointSize = "7";
                myTable.Rows[i].Cells[3].TextColor="uncdark";
                myTable.Rows[i].Cells[3].HAlign = "Left";
                myTable.Rows[i].Cells[3].VAlign = "Top";
                myTable.Rows[i].Cells[3].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[3].Margins.Top = 5;
                myTable.Rows[i].Cells[3].Margins.Bottom = 10;
                myTable.Rows[i].Cells[4].Font = "Webdings";
                myTable.Rows[i].Cells[4].PointSize = "10";
                myTable.Rows[i].Cells[4].TextColor="uncblue";
                myTable.Rows[i].Cells[4].HAlign = "Left";
                myTable.Rows[i].Cells[4].VAlign = "Top";
                myTable.Rows[i].Cells[4].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[4].Margins.Top = 5;
                myTable.Rows[i].Cells[4].Margins.Bottom = 10;
                myTable.Rows[i].Cells[5].Font = "Myriad Pro";
                myTable.Rows[i].Cells[5].PointSize = "7";
                myTable.Rows[i].Cells[5].TextColor="uncdark";
                myTable.Rows[i].Cells[5].HAlign = "Left";
                myTable.Rows[i].Cells[5].VAlign = "Top";
                myTable.Rows[i].Cells[5].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[5].Margins.Top = 5;
                myTable.Rows[i].Cells[5].Margins.Bottom = 10;
                myTable.Rows[i].Cells[6].Font = "Webdings";
                myTable.Rows[i].Cells[6].TextColor="uncblue";
                myTable.Rows[i].Cells[6].PointSize = "10";
                myTable.Rows[i].Cells[6].HAlign = "Left";
                myTable.Rows[i].Cells[6].VAlign = "Top";
                myTable.Rows[i].Cells[6].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[6].Margins.Top = 5;
                myTable.Rows[i].Cells[6].Margins.Bottom = 10;
                myTable.Rows[i].Cells[7].Font = "Myriad Pro";
                myTable.Rows[i].Cells[7].PointSize = "7";
                myTable.Rows[i].Cells[7].TextColor="uncdark";
                myTable.Rows[i].Cells[7].HAlign = "Left";
                myTable.Rows[i].Cells[7].VAlign = "Top";
                myTable.Rows[i].Cells[7].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[7].Margins.Top = 5;
                myTable.Rows[i].Cells[7].Margins.Bottom = 10;
                myTable.Rows[i].Cells[8].Font = "Webdings";
                myTable.Rows[i].Cells[8].PointSize = "10";
                myTable.Rows[i].Cells[8].TextColor="uncblue";
                myTable.Rows[i].Cells[8].HAlign = "Left";
                myTable.Rows[i].Cells[8].VAlign = "Top";
                myTable.Rows[i].Cells[8].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[8].Margins.Top = 5;
                myTable.Rows[i].Cells[8].Margins.Bottom = 10;
                myTable.Rows[i].Cells[9].Font = "Myriad Pro";
                myTable.Rows[i].Cells[9].PointSize = "7";
                myTable.Rows[i].Cells[9].HAlign = "Left";
                myTable.Rows[i].Cells[9].VAlign = "Top";
                myTable.Rows[i].Cells[9].Margins = new FPTableMargins;
                myTable.Rows[i].Cells[9].Margins.Top = 5;
                myTable.Rows[i].Cells[9].Margins.Bottom = 10;
                //myTable.Rows[i].CopyCells(0,1,2,3,4,5,6,7,8,9); // Apply the same formating to each cell in this row
            // CREATE CONTENT FOR EXTERNAL DATA FILE RECORDS
                myTable.Rows[i].SetContents(box[i-1], support[i-1], box1[i-1], ask1[i-1], box2[i-1], ask2[i-1], box3[i-1], ask3[i-1], box4[i-1], ask4[i-1]);
        }
    
    return myTable.MakeTags();

 

Thanks

Jason

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...