Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 13th, 2015, 02:23 PM
eliggins eliggins is offline
Forum n00b
 
Join Date: Jul 2015
Posts: 5
Default user driven list

I'm trying to recreate a product (see attachment below), the way it works is, there is a total of 14 fields that can be filled. The user is prompted to choose a number of services (1 to 14) they can then fill out the title description and rate. I initially thought I could possibly accomplish this by using the FPTables scripts to create a dynamic table that would populate the rows...dynamically based on the selected amount of services, but not really sure where to start. Could anyone tell me if this would be the best way to accomplish this and how, or is there some built ins. As a side note I'm using the Marcomcentral platform. Any help is greatly appreciated
Attached Images
File Type: jpg servicesList.JPG (23.2 KB, 36 views)

Last edited by Dan Korn; October 13th, 2015 at 02:27 PM.. Reason: Might as well actually show the picture in the post.
Reply With Quote
  #2  
Old October 13th, 2015, 03:15 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: user driven list

Quote:
Originally Posted by eliggins View Post
I'm trying to recreate a product (see attachment below), the way it works is, there is a total of 14 fields that can be filled. The user is prompted to choose a number of services (1 to 14) they can then fill out the title description and rate. I initially thought I could possibly accomplish this by using the FPTables scripts to create a dynamic table that would populate the rows...dynamically based on the selected amount of services, but not really sure where to start.
You can definitely do this with tables. In fact a simple search of the forums would point you to several threads of people doing exactly what you're asking (http://forums.pti.com/showthread.php?t=3179 or even http://forums.pti.com/showthread.php?t=2087) but I digress.

You say there are (up to) 14 fields but the example you posted looks more like there will be 3 fields per service. Here's a generic way to get you where you're trying to go:
Code:
var fields = [
    Field('Service1'),
    Field('Service2'),
].filter(String);

var table = new FPTable;
table.AddColumns(7200); // 7200 = 1 inch column
table.ShadingColor1 = "White";
table.ShadingPct1 = 100;
table.ShadingColor2 = "Khaki";
table.ShadingPct2 = 100;
table.ShadingType = "ByRow";

for (var i in fields) {
    var row = table.AddRow();
    row.SetContents(fields[i]);
}

return table.MakeTags();
Wherein you can add as many fields as you'd like to that "fields" array. If all of the fields are named "Service" followed by a sequential number, you could populate that array using a for loop:
Code:
var fields = [];
for (var i=1; i<=14; i++)
    fields.push(Field('Service' + i));
fields = fields.filter(String);
If each service has it's own corresponding "Title," "Description," and "Rate" field, the code would look more like this:
Code:
var fields = [];
for (var i=1; i<=14; i++)
    fields.push([Field('Title' + i), Field('Description' + i), Field('Rate' + i)]);
fields = fields.filter(function(s){ return s.join(''); });

var table = new FPTable;
table.AddColumns(7200, 7200); // 7200 = 1 inch column
table.ShadingColor1 = "White";
table.ShadingPct1 = 100;
table.ShadingColor2 = "Khaki";
table.ShadingPct2 = 100;
table.ShadingType = "ByRow";

for (var i in fields) {
    var row = table.AddRow();
    var col = row.Cells[0];
    col.CopyCells(0,1);
    var [title, description, rate] = fields[i];
    row.SetContents(title + '<br>' + description, rate);
}

return table.MakeTags();
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #3  
Old October 14th, 2015, 05:19 PM
eliggins eliggins is offline
Forum n00b
 
Join Date: Jul 2015
Posts: 5
Default Re: user driven list

Thanks for getting back to me, this looks pretty straight-forward, however, I'm still having a problem. How should I setup my template, do I create one big text frame and apply the script name to it?
Reply With Quote
Reply

Tags
dynamic, tables, user input

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 10:45 PM.


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