Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > Getting Started


Thread Tools Search this Thread Display Modes
Old October 25th, 2019, 05:27 PM
lasdoog lasdoog is offline
Forum n00b
Join Date: Sep 2016
Posts: 9
Default Make a table with formatted text that flows below


I"m new to working with tables in FusionPro and I have a problem I can't resolve. Part of the job I'm working on has a table with anywhere from 1 to 8 possible rows, then 4 rows of totals flush right. There is also formatted text below this that must move with the table size (1 to 8 rows).

I've been able to handle the first 8 rows by altering a SteP script from the forum which surpresses a row based on a field, but I can't get past these 8 rows.

Here's where my script is at:

var fields = [[Field("Plan/Item 1 Name"), Field("Plan/Item 1 QTY"), Field("Plan/Item 1 Sec"), Field("Plan/Item 1 Row"), Field("Plan/Item 1 Block"), "$"+ Field("Plan/Item 1 Per"), "$"+ Field("Plan/Item 1 Total")],
[Field("Plan/Item 2 Name"), Field("Plan/Item 2 QTY"), Field("Plan/Item 2 Sec"), Field("Plan/Item 2 Row"), Field("Plan/Item 2 Block"), "$"+ Field("Plan/Item 2 Per"), "$"+ Field("Plan/Item 2 Total")],
[Field("Plan/Item 3 Name"), Field("Plan/Item 3 QTY"), Field("Plan/Item 3 Sec"), Field("Plan/Item 3 Row"), Field("Plan/Item 3 Block"), "$"+ Field("Plan/Item 3 Per"), "$"+ Field("Plan/Item 3 Total")],
[Field("Plan/Item 4 Name"), Field("Plan/Item 4 QTY"), Field("Plan/Item 4 Sec"), Field("Plan/Item 4 Row"), Field("Plan/Item 4 Block"), "$"+ Field("Plan/Item 4 Per"), "$"+ Field("Plan/Item 4 Total")],
[Field("Plan/Item 5 Name"), Field("Plan/Item 5 QTY"), Field("Plan/Item 5 Sec"), Field("Plan/Item 5 Row"), Field("Plan/Item 5 Block"), "$"+ Field("Plan/Item 5 Per"), "$"+ Field("Plan/Item 5 Total")],
[Field("Plan/Item 6 Name"), Field("Plan/Item 6 QTY"), Field("Plan/Item 6 Sec"), Field("Plan/Item 6 Row"), Field("Plan/Item 6 Block"), "$"+ Field("Plan/Item 6 Per"), "$"+ Field("Plan/Item 6 Total")],
[Field("Plan/Item 7 Name"), Field("Plan/Item 7 QTY"), Field("Plan/Item 7 Sec"), Field("Plan/Item 7 Row"), Field("Plan/Item 7 Block"), "$"+ Field("Plan/Item 7 Per"), "$"+ Field("Plan/Item 7 Total")],
[Field("Plan/Item 8 Name"), Field("Plan/Item 8 QTY"), Field("Plan/Item 8 Sec"), Field("Plan/Item 8 Row"), Field("Plan/Item 8 Block"), "$"+ Field("Plan/Item 8 Per"), "$"+ Field("Plan/Item 8 Total")],

var myTable = new FPTable;
myTable.AddColumns(19400, 4300, 4500, 4500, 8200, 7200, 6000);

for (var i=0; i<9; i++) {
if (fields[i][2] != "NULL") {
//myTable.Rows[i].Cells[0].SetBorders("Thin","Black","Top","Bottom","Right", "Left");
myTable.Rows[i].Cells[0].HAlign = "Left";
myTable.Rows[i].SetContents(fields[i][0], fields[i][1], fields[i][2], fields[i][3], fields[i][4], fields[i][5], fields[i][6]);

return myTable.MakeTags();

__________________________________________________ ___________

I've made a formatted text resource and added it after the table, but it still sees the table as 8 rows even if they aren't visible.

Please see attached screenshot for clarity

Any suggestions are greatly appreciated!

MAC OS 10.13.6, FusionPro 10.1.11, Acrobat 11.0.23
Attached Images
File Type: png Variable Table with text below.png (33.8 KB, 10 views)
Reply With Quote
Old October 28th, 2019, 11:49 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,694
Default Re: Make a table with formatted text that flows below

Well, you're unconditionally adding 9 rows to the table with "myTable.AddRows(9)". You're not actually suppressing any rows at all; you're just inserting empty rows. So yeah, you'll always get 9 rows with that code.

The solution is to call AddRow() once per row, as needed (i.e. only when you actually need a new row). Also, the first part of your rule, which is very repetitive, screams out for a "for" loop, though I would just use the same "for" loop you already have.

I don't have the rest of your template to try, but I think this will work:
var myTable = new FPTable;
myTable.AddColumns(19400, 4300, 4500, 4500, 8200, 7200, 6000);

for (var i = 1; i <= 8; i++)
    if (Field("Plan/Item " + i + " Sec") == "NULL")
        continue; // skip this row

    var row = myTable.AddRow();
    //row.Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Right", "Left");
    row.Cells[0].HAlign = "Left";
    row.SetContents(Field("Plan/Item " + i + " Name"),
                    Field("Plan/Item " + i + " QTY"),
                    Field("Plan/Item " + i + " Sec"),
                    Field("Plan/Item " + i + " Row"),
                    Field("Plan/Item " + i + " Block"),
                    "$"+ Field("Plan/Item " + i + " Per"),
                    "$"+ Field("Plan/Item " + i + " Total"));

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

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
Old October 28th, 2019, 04:33 PM
lasdoog lasdoog is offline
Forum n00b
Join Date: Sep 2016
Posts: 9
Default Re: Make a table with formatted text that flows below

Thanks Dan!
Reply With Quote

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 03:09 AM.

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