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
  #1  
Old September 27th, 2018, 06:58 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Varying number of Rows and Colums

I've got a project that the customer is wanting a table like layout. I've never have used Fusion Pro Tables so this will be a learning curve.

The issue is the amount of cells varies depending on the amount of info.

In this example 10 cells Max. ( 2 Columns 5 rows ).
I don't see an issue if they are suppling 10 names.

The issue is they are wanting to go to a single Column if their is less then 6 names. If their is more then 5 Names and an odd number of names they want the last Name to merge into a single Column.

Providing 3 screen shots of different options.

Is this even Possible? If so any help getting this done would be extremely helpful. Thanks Devin
Attached Files
File Type: zip Tables.zip (66.0 KB, 8 views)
Reply With Quote
  #2  
Old September 27th, 2018, 09: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,442
Default Re: Varying number of Rows and Colums

So is it just that a table gets resized to be narrower when there are fewer than six names, or does the whole output page get resized as well? Either is possible, but there are different approaches for those two requirements.
__________________
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
  #3  
Old September 27th, 2018, 10:25 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

Glad to here that it's possible.. I did not want to deep dive into to much info from the start if was not going to work.

So the Table needs to fit with in a certain size window. When it goes to a single column the width can stay the same.. I was thinking just merge them would work just fine.
Reply With Quote
  #4  
Old October 1st, 2018, 09:30 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

Dan,

Just checking in and see if you have any ideas. I'm still trying to read over how to make tables and come close to what were needing.

Thanks
Reply With Quote
  #5  
Old October 1st, 2018, 01:24 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,442
Default Re: Varying number of Rows and Colums

This is a pretty abstract question. There are a couple of table examples in the Frodo tutorial. You can control the number of rows and columns with a rule. If you can show what you have tried so far, or at least the data, then I, or someone else, might be able to make more specific suggestions.
__________________
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
  #6  
Old October 2nd, 2018, 08:24 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

Whats the Frodo tutorial?

Right now I've been able to write a simple table like this example below.
I still need to figure many things things like how do I even get other fields added to a cell?

But the bigger issue is how do I make this dynamic based on the fields used.
I've uploaded a sample data set that I made to for testing.

Code:
var myTable = new FPTable;
myTable.AddColumns(10800, 10800);
myTable.AddRows(3);
myTable.Rows[0].Cells[0].Content = Field("Name1");
myTable.Rows[0].Cells[1].Content = Field("Name2");
myTable.Rows[1].Cells[0].Content = Field("Name3");
myTable.Rows[1].Cells[1].Content = Field("Name4");
myTable.Rows[2].Cells[0].Content = Field("Name5");
myTable.Rows[2].Cells[1].Content = Field("Name6");
return myTable.MakeTags()
Attached Files
File Type: zip DataFile.zip (533 Bytes, 6 views)
Reply With Quote
  #7  
Old October 2nd, 2018, 04:00 PM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

So I figured out 2 ways I can place multiple fields in to my Cells.

First would be calling multiple Fileds as part as the Table Rule

Code:
myTable.Rows[0].Cells[0].Content = Field("Name1") + '<br>' + Field("Location1") + '<br>' + Field("Phone1");
Or I could call make another Rules for each cell
Code:
return [
    Field("Name1"),
    Field("Location1"),
    Field("Phone1")
].join('<p verticalstart=topofcolumn>');
Then the Table rule would be like this
Code:
myTable.Rows[0].Cells[1].Content = Rule("Cell1");
My question still stands on how to write the Table for the Varying number of Rows and Columns. Any Help in guiding me would be great. Thanks
Reply With Quote
  #8  
Old October 3rd, 2018, 10:11 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,442
Default Re: Varying number of Rows and Colums

Quote:
Originally Posted by randdevin View Post
Whats the Frodo tutorial?
From the menu in Acrobat, select FusionPro -> Documentation -> Tutorials, then open the FrodoTravel tutorial. If you haven't looked at these, or read the User Guide, I encourage you to do both.
Quote:
Originally Posted by randdevin View Post
Right now I've been able to write a simple table like this example below.
I still need to figure many things things like how do I even get other fields added to a cell?
You seem to have figured that out. The content of each cell can be whatever you want, built up from whatever data fields you want.
Quote:
Originally Posted by randdevin View Post
But the bigger issue is how do I make this dynamic based on the fields used.
I've uploaded a sample data set that I made to for testing.
Thanks, that gives me something to work with. I came up with this rule:
Code:
var maxNames = 10;

var myTable = new FPTable;
var names = [];
for (var i = 1; i <= maxNames; i++)
    names.push(Field("Name" + i));
    
names = names.filter(Trim);

var numColumns = (names.length < 6) ? 1 : 2;

for (var c = 1; c <= numColumns; c++)
    myTable.AddColumn(16000);

var fieldNum = 0;
while (fieldNum < names.length)
{
    var row = myTable.AddRow();
    for (var c = 0; c < numColumns; c++)
    {
        fieldNum++;

        var fieldNames = ["Name", "Location", "Phone"];
        var fields = fieldNames.map(function(name) { return TaggedDataField(name + fieldNum); }).filter(Trim);
        //fields.unshift(fieldNum);
        
        var cell = row.Cells[c];
        cell.Content = fields.join("<br>");
        
        cell.HAlign = "Center";
        cell.VAlign = "Middle";
        cell.SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right");
        cell.Margins = { Top:100, Bottom:100 };

        if (fieldNum > names.length)
        {
            if (numColumns > 1 && fieldNum % 2 == 0)
                row.Cells[c-1].HStraddle = 2;

            break;
        }
    }
}

return myTable.MakeTags();
I think that does pretty much what you want.
__________________
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
  #9  
Old October 3rd, 2018, 10:48 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

Dan,

Thanks so much! This is just about their in what they are wanting.

The only issue that I'm seeing right now it's not centering the table in the text box when it's a single column.
Reply With Quote
  #10  
Old October 3rd, 2018, 11:21 AM
randdevin randdevin is offline
Junior Community Member
 
Join Date: Jan 2012
Location: TX
Posts: 17
Default Re: Varying number of Rows and Colums

Dan,

Looking over what you came up with and If I understand it correctly

This code is deremiitng how many columns.

Code:
var numColumns = (names.length < 6) ? 1 : 2;
And this part is how wide to make them and how many based on numColumns
Code:
for (var c = 1; c <= numColumns; c++)
    myTable.AddColumn(16000);
If that is the case then I'm guess adding another if statement if less then 5 then make the column 32000. ( Double)?
Reply With Quote
Reply

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:12 AM.


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