#1
|
|||
|
|||
![]()
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
Last edited by Dan Korn; October 13th, 2015 at 02:27 PM.. Reason: Might as well actually show the picture in the post. |
#2
|
||||
|
||||
![]() Quote:
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(); Code:
var fields = []; for (var i=1; i<=14; i++) fields.push(Field('Service' + i)); fields = fields.filter(String); 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 |
#3
|
|||
|
|||
![]()
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?
|
![]() |
Tags |
dynamic, tables, user input |
Thread Tools | Search this Thread |
Display Modes | |
|
|