Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Tables & Charts

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old January 3rd, 2013, 10:37 AM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,388
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by -Lisa- View Post
Woops! I didn't catch that when I posted the code here.
I had it corrected when I copied the rule over into FP - but thanks for catching that!

I removed the "=" but now all I see when I preview this is the black fill in Column 1, Row, 1 - no content in either Column for Row 1.
I then see the content for Column 1, rows 2-6 but nothing in Column 2.

Ugh, I knew attacking this on my own was not a smart way to start the year!
Are you sure that those data fields have values for the record you're composing or previewing? What happens if you just use hard-coded data instead? Try this rule verbatim and see what you get:
Code:
var myTable = new FPTable
myTable.AddColumns(17000, 8107);
myTable.AddRows(6);

for (var row = 0; row < 6; row++)
{
    for (var cell = 0; cell < 2; cell++)
    {
        myTable.Rows[row].Cells[cell].Font = "Times New Roman"; 
        myTable.Rows[row].Cells[cell].TextColor = "Black";
        myTable.Rows[row].Cells[cell].ShadeColor = "White"; 
        myTable.Rows[row].Cells[cell].ShadePct = 100;
    }
}

// first cell has inverted colors
myTable.Rows[0].Cells[0].TextColor = "White";
myTable.Rows[0].Cells[0].ShadeColor = "Black"; 

myTable.Rows[0].SetContents("Earnings", "Company Paid");
myTable.Rows[1].SetContents("Shift Differential Pay Overtime", "ShiftDifferenceOT");
myTable.Rows[2].SetContents("Shift Differential Pay", "ShiftDifference");
myTable.Rows[3].SetContents("Overtime Pay", "OTPay");
myTable.Rows[4].SetContents("Regular Earnings", "RegEarnings");
myTable.Rows[5].SetContents("Gross Earnings", "GrossEarnings");
return myTable.MakeTags();
This shows the whole table, with all ten cells populated, for me. (I don't have your data file.)

Also, do a full composition (not a preview) and check for any warning messages in the log (.msg) file.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #32  
Old January 3rd, 2013, 10:47 AM
-Lisa- -Lisa- is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Long Island, NY
Posts: 190
Default Re: JavaScript Table API – The Basics

You're all awesome, this worked, thank you!!!!!
Reply With Quote
  #33  
Old March 13th, 2013, 01:14 PM
INGuser INGuser is offline
Junior Community Member
 
Join Date: Feb 2010
Location: Des Moines, IA
Posts: 41
Default Re: JavaScript Table API – The Basics

I am wondering if there is a way to surpress empty rows in a table. I am working on creating a letter that contains a table listing trades that have been completed on behalf of a client. Some clients have at most 23 trades while other clients have a single trade to list.
__________________
Amber Patterson
Voya/Williams Lea
Fusion Pro Desktop 8.2.7
Windows 7
Adobe X Pro
Reply With Quote
  #34  
Old March 13th, 2013, 01:22 PM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,388
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by INGuser View Post
I am wondering if there is a way to surpress empty rows in a table. I am working on creating a letter that contains a table listing trades that have been completed on behalf of a client. Some clients have at most 23 trades while other clients have a single trade to list.
Sure. As you're going through and building up the table with calls to FPTable.AddRow(), just don't add a row if there's nothing to populate it with. You may need to change the logic to call AddRow() inside of whatever loop you're using, instead of a single call to AddRows() with a hard-coded number.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #35  
Old March 13th, 2013, 02:02 PM
INGuser INGuser is offline
Junior Community Member
 
Join Date: Feb 2010
Location: Des Moines, IA
Posts: 41
Default Re: JavaScript Table API – The Basics

Below is the code that I am trying to use to populate my table but it keeps giving me an error. I am somewhat new to this javascript thing and do not understand what I am doing wrong. i copied the code from the previous thread and modified it as needed.

Is there and easier way to do this in the newest Fusion Pro?

new FPTable;
var myTable = new FPTable;
myTable.AddColumns (7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200) ;
myTable.AddRows (24) ;

myTable.Rows [0] .SetContents (Account, Buy/Sell, Security_Description, Trade_Date, Executed_Quantity, Execution_Price, Solicited, Discretion)
myTable.Rows [1] .SetContents (Field("Account 1"), Field("Buy/ sell1"), Field("Security description1"), Field("Trade date1"), Field("Executed quantity1"), Field("Execution price1"), Field("Solicited1"), Field("Discretion1"))
myTable.Rows [2] .SetContents (Field("Account 2"), Field("Buy/ sell2"), Field("Security description2"), Field("Trade date2"), Field("Executed quantity2"), Field("Execution price2"), Field("Solicited2"), Field("Discretion2"))
myTable.Rows [3] .SetContents (Field("Account 3"), Field("Buy/ sell3"), Field("Security description3"), Field("Trade date3"), Field("Executed quantity3"), Field("Execution price3"), Field("Solicited3"), Field("Discretion3"))
myTable.Rows [4] .SetContents (Field("Account 4"), Field("Buy/ sell4"), Field("Security description4"), Field("Trade date4"), Field("Executed quantity4"), Field("Execution price4"), Field("Solicited4"), Field("Discretion4"))
myTable.Rows [5] .SetContents (Field("Account 5"), Field("Buy/ sell5"), Field("Security description5"), Field("Trade date5"), Field("Executed quantity5"), Field("Execution price5"), Field("Solicited5"), Field("Discretion5"))
myTable.Rows [6] .SetContents (Field("Account 6"), Field("Buy/ sell6"), Field("Security description6"), Field("Trade date6"), Field("Executed quantity6"), Field("Execution price6"), Field("Solicited6"), Field("Discretion6"))
myTable.Rows [7] .SetContents (Field("Account 7"), Field("Buy/ sell7"), Field("Security description7"), Field("Trade date7"), Field("Executed quantity7"), Field("Execution price7"), Field("Solicited7"), Field("Discretion7"))
myTable.Rows [8] .SetContents (Field("Account 8"), Field("Buy/ sell8"), Field("Security description8"), Field("Trade date8"), Field("Executed quantity8"), Field("Execution price8"), Field("Solicited8"), Field("Discretion8"))
myTable.Rows [9] .SetContents (Field("Account 9"), Field("Buy/ sell9"), Field("Security description9"), Field("Trade date9"), Field("Executed quantity9"), Field("Execution price9"), Field("Solicited9"), Field("Discretion9"))
myTable.Rows [10] .SetContents (Field("Account 10"), Field("Buy/ sell10"), Field("Security description10"), Field("Trade date10"), Field("Executed quantity10"), Field("Execution price10"), Field("Solicited10"), Field("Discretion10"))
myTable.Rows [11] .SetContents (Field("Account 11"), Field("Buy/ sell11"), Field("Security description11"), Field("Trade date11"), Field("Executed quantity11"), Field("Execution price11"), Field("Solicited11"), Field("Discretion11"))
myTable.Rows [12] .SetContents (Field("Account 12"), Field("Buy/ sell12"), Field("Security description12"), Field("Trade date12"), Field("Executed quantity12"), Field("Execution price12"), Field("Solicited12"), Field("Discretion12"))
myTable.Rows [13] .SetContents (Field("Account 13"), Field("Buy/ sell13"), Field("Security description13"), Field("Trade date13"), Field("Executed quantity13"), Field("Execution price13"), Field("Solicited13"), Field("Discretion13"))
myTable.Rows [14] .SetContents (Field("Account 14"), Field("Buy/ sell14"), Field("Security description14"), Field("Trade date14"), Field("Executed quantity14"), Field("Execution price14"), Field("Solicited14"), Field("Discretion14"))
myTable.Rows [15] .SetContents (Field("Account 15"), Field("Buy/ sell15"), Field("Security description15"), Field("Trade date15"), Field("Executed quantity15"), Field("Execution price15"), Field("Solicited15"), Field("Discretion15"))
myTable.Rows [16] .SetContents (Field("Account 16"), Field("Buy/ sell16"), Field("Security description16"), Field("Trade date16"), Field("Executed quantity16"), Field("Execution price16"), Field("Solicited16"), Field("Discretion16"))
myTable.Rows [17] .SetContents (Field("Account 17"), Field("Buy/ sell16"), Field("Security description17"), Field("Trade date17"), Field("Executed quantity17"), Field("Execution price17"), Field("Solicited17"), Field("Discretion17"))
myTable.Rows [18] .SetContents (Field("Account 18"), Field("Buy/ sell17"), Field("Security description18"), Field("Trade date18"), Field("Executed quantity18"), Field("Execution price18"), Field("Solicited18"), Field("Discretion18"))
myTable.Rows [19] .SetContents (Field("Account 19"), Field("Buy/ sell18"), Field("Security description19"), Field("Trade date19"), Field("Executed quantity19"), Field("Execution price19"), Field("Solicited19"), Field("Discretion19"))
myTable.Rows [20] .SetContents (Field("Account 20"), Field("Buy/ sell19"), Field("Security description20"), Field("Trade date20"), Field("Executed quantity20"), Field("Execution price20"), Field("Solicited20"), Field("Discretion20"))
myTable.Rows [21] .SetContents (Field("Account 21"), Field("Buy/ sell20"), Field("Security description21"), Field("Trade date21"), Field("Executed quantity21"), Field("Execution price21"), Field("Solicited21"), Field("Discretion21"))
myTable.Rows [22] .SetContents (Field("Account 22"), Field("Buy/ sell22"), Field("Security description22"), Field("Trade date22"), Field("Executed quantity22"), Field("Execution price22"), Field("Solicited22"), Field("Discretion22"))
myTable.Rows [23] .SetContents (Field("Account 23"), Field("Buy/ sell23"), Field("Security description23"), Field("Trade date23"), Field("Executed quantity23"), Field("Execution price23"), Field("Solicited23"), Field("Discretion23"))
mytable.Rows [0] . Type = "Header";
return myTable.MakeTags();
__________________
Amber Patterson
Voya/Williams Lea
Fusion Pro Desktop 8.2.7
Windows 7
Adobe X Pro
Reply With Quote
  #36  
Old March 13th, 2013, 02:33 PM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,388
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by INGuser View Post
Below is the code that I am trying to use to populate my table but it keeps giving me an error. I am somewhat new to this javascript thing and do not understand what I am doing wrong. i copied the code from the previous thread and modified it as needed.

Is there and easier way to do this in the newest Fusion Pro?

new FPTable;
var myTable = new FPTable;
myTable.AddColumns (7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200) ;
myTable.AddRows (24) ;

myTable.Rows [0] .SetContents (Account, Buy/Sell, Security_Description, Trade_Date, Executed_Quantity, Execution_Price, Solicited, Discretion)
myTable.Rows [1] .SetContents (Field("Account 1"), Field("Buy/ sell1"), Field("Security description1"), Field("Trade date1"), Field("Executed quantity1"), Field("Execution price1"), Field("Solicited1"), Field("Discretion1"))
// ...<snip>...
myTable.Rows [23] .SetContents (Field("Account 23"), Field("Buy/ sell23"), Field("Security description23"), Field("Trade date23"), Field("Executed quantity23"), Field("Execution price23"), Field("Solicited23"), Field("Discretion23"))
mytable.Rows [0] . Type = "Header";
return myTable.MakeTags();
Oh my goodness! Yes, there is a much easier way to do all of that, with a simple "for" loop:
Code:
var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
    var row = myTable.AddRow();
    row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
}

return myTable.MakeTags();
I also assumed that the header row was meant to be set with literal strings (in quotes).

Basically, any time you have that kind of repetitive JavaScript code, you should be able use a loop of some kind, and generally, a "for" loop is best.

Now you should be able to see how you can just skip adding a row altogether if there's nothing to populate it with. I assume that the "Account" field is empty in this case. So this should do what you want:
Code:
var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
    if (!Field("Account " + r))
        continue; // don't add empty rows
        
    var row = myTable.AddRow();
    row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
}

return myTable.MakeTags();
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #37  
Old March 14th, 2013, 08:55 AM
INGuser INGuser is offline
Junior Community Member
 
Join Date: Feb 2010
Location: Des Moines, IA
Posts: 41
Default Re: JavaScript Table API – The Basics

Thanks for the help Dan, As always it is much appreciated. I got the code you provided to work but I tried to modify so that i could set the font type and size and broke the code. Can you tell me how or where I would add this information?
__________________
Amber Patterson
Voya/Williams Lea
Fusion Pro Desktop 8.2.7
Windows 7
Adobe X Pro
Reply With Quote
  #38  
Old March 14th, 2013, 10:16 AM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,388
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by INGuser View Post
Thanks for the help Dan, As always it is much appreciated. I got the code you provided to work but I tried to modify so that i could set the font type and size and broke the code. Can you tell me how or where I would add this information?
Sure, inside the "r" loop, after the call to AddRow, you can do something like this:
Code:
    for (var c = 0; c < myTable.Columns.length; c++)
    {
        row.Cells[c].Font = "Arial";
        row.Cells[c].PointSize = 12;
    }
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #39  
Old March 14th, 2013, 11:36 AM
INGuser INGuser is offline
Junior Community Member
 
Join Date: Feb 2010
Location: Des Moines, IA
Posts: 41
Default Re: JavaScript Table API – The Basics

I have tried moving the addtional code around to everyplace i can possibly move it to and the font is staying the same size.


var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);
var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");
for (var r = 1; r < 24; r++)
{
if (!Field("Account " + r))
continue; // don't add empty rows

var row = myTable.AddRow();
row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
}
for (var c = 0; c < myTable.Columns.length; c++)
{
row.Cells[c].Font = "Arial";
row.Cells[c].PointSize = 9;
}
return myTable.MakeTags();
__________________
Amber Patterson
Voya/Williams Lea
Fusion Pro Desktop 8.2.7
Windows 7
Adobe X Pro
Reply With Quote
  #40  
Old March 14th, 2013, 04:27 PM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,388
Default Re: JavaScript Table API – The Basics

The "var c" loop has to be inside the "var r" loop, like so:
Code:
var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
    if (!Field("Account " + r))
        continue; // don't add empty rows
        
    var row = myTable.AddRow();
    row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
    
    for (var c = 0; c < myTable.Columns.length; c++)
    {
        row.Cells[c].Font = "Arial";
        row.Cells[c].PointSize = 9;
    }
}

return myTable.MakeTags();
When you validate the rule in the editor, what does it return? It should have some tags like <z newsize="9"> in it.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Reply

Tags
javascript, tables

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:55 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.