gregmaze Posted September 19, 2012 Share Posted September 19, 2012 Greetings... I was wondering if there is a way to have text from 1 table to overflow into another? I have created a table that spans 3 columns. When I add the variables to the tables the text only appears in the 1st LONG column. I wanted the tables to share all the data and instead of 1 column with 12 items, I would have 3 columns with 4 items. I am including an PDF image file to show what I am looking for. Thank you Greg Maze MAC OS X 10.6.8 Fusion Pro 8.0.20columns.pdf Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 19, 2012 Share Posted September 19, 2012 From the example, it looks to me that you don't really want a table at all; you actually want a text frame with three columns. Quote Link to comment Share on other sites More sharing options...
gregmaze Posted September 20, 2012 Author Share Posted September 20, 2012 Hello Dan, Thanks for getting back with me. The reason I thought I needed a table was I did not think you could get a vertical rule to fit inside the table between the columns. The number of rows are variable. So the question now is can I get a vertical rule to print in between the columns and resize it's height? Thanks Greg Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 20, 2012 Share Posted September 20, 2012 The reason I thought I needed a table was I did not think you could get a vertical rule to fit inside the table between the columns. The number of rows are variable. Okay, well, in that case, you do need a table. All you have to do is add some simple logic to rearrange the entries so that they go three-across into table rows, instead of just all in the first column. Something like this: var table = new FPTable; table.AddColumns(10000, 10000, 10000); table.SetBorders("Thin", "Black", "Top", "Bottom"); for (var r = 1; r <= 4; r++) { var row = table.AddRow(); for (var c = 0; c < 3; c++) { row.Cells[c].SetBorders("Thin", "Black", "Left", "Right"); row.Cells[c].Content = "• widget " + (r + (c * 4)); } } return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
gregmaze Posted September 25, 2012 Author Share Posted September 25, 2012 Hello Dan, Thank you for helping with this. I am still having a problem with this. I am including a jpg file to show what I am getting. What I am looking to get is a 3 column table that will take the amount of "widgets" and break them evenly across the 3 columns. The "widgets" are variable and the number of them will vary. So if there were 12 "widgets" into 3 columns equal 4 "widgets" each column. If there were 15 "widgets" into 3 columns equal 5 "widgets each column. I would greatly appreciate any help. Thank you Greg Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 25, 2012 Share Posted September 25, 2012 Okay, change the first line for a different number of widgets: var numWidgets = 14; var numRows = Int((numWidgets + 2) / 3); var table = new FPTable; table.AddColumns(10000, 10000, 10000); table.SetBorders("Thin", "Black", "Top", "Bottom"); var widgetNum = 0; for (var r = 1; r <= numRows; r++) { var row = table.AddRow(); for (var c = 0; c < 3; c++) { widgetNum = r + (c * numRows); row.Cells[c].SetBorders("Thin", "Black", "Left", "Right"); if (widgetNum <= numWidgets) row.Cells[c].Content = "• widget " + widgetNum; } } return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
gregmaze Posted September 27, 2012 Author Share Posted September 27, 2012 Hello Dan, Thanks for getting back to me on this. I am still confused by this script. I understand how it works and how to add manually to the number of widgets. What I am having a problem with is how to get the number to be variable. As the customer will select from a list of items to put in the table. Ex. Widget1, Widget2, Widget3 etc. These are all in different fields. I am not sure how to count these selected fields. I am so close to completing this project and I am hung up on this. If you could explain this a little better for someone who is not as advanced in Javascript, I would be so grateful... Thank you Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 27, 2012 Share Posted September 27, 2012 I am still confused by this script. I understand how it works and how to add manually to the number of widgets. What I am having a problem with is how to get the number to be variable. As the customer will select from a list of items to put in the table. Ex. Widget1, Widget2, Widget3 etc. These are all in different fields. I am not sure how to count these selected fields. I am so close to completing this project and I am hung up on this. If you could explain this a little better for someone who is not as advanced in Javascript, I would be so grateful... I'm trying to generalize since I don't know all the details of your job. So you have data fields named "Widget1", "Widget2", etc., and they're either populated or empty? If so, try this: var numWidgets = 0; try { while (Field("Widget" + (numWidgets + 1))) numWidgets++; } catch (e) {} var numRows = Int((numWidgets + 2) / 3); var table = new FPTable; table.AddColumns(10000, 10000, 10000); table.SetBorders("Thin", "Black", "Top", "Bottom"); var widgetNum = 0; for (var r = 1; r <= numRows; r++) { var row = table.AddRow(); for (var c = 0; c < 3; c++) { widgetNum = r + (c * numRows); row.Cells[c].SetBorders("Thin", "Black", "Left", "Right"); if (widgetNum <= numWidgets) row.Cells[c].Content = "• " + Field("Widget" + widgetNum); } } return table.MakeTags();If that's doesn't work, then you'll need to post a more specific example of what your data file looks like, or better yet, the collected job, so that I can give a more specific answer. Quote Link to comment Share on other sites More sharing options...
gregmaze Posted September 27, 2012 Author Share Posted September 27, 2012 Well there is a reason why you have on a Superman Outfit... But... of course there is a small error. I am including the collected file. It works fine if all fields are used, but if 1 field is not used every field after does nor show up. Thank you Dan for all your help:) Quote Link to comment Share on other sites More sharing options...
gregmaze Posted September 27, 2012 Author Share Posted September 27, 2012 Here is the collected file.Excluded form for PTI.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 27, 2012 Share Posted September 27, 2012 But... of course there is a small error. I am including the collected file. I don't see any attachment. It works fine if all fields are used, but if 1 field is not used every field after does nor show up. I was assuming that the fields would be filled in sequentially. If they're not, then I need to know the maximum number which the user can fill out, so that I know how many to check for in a loop. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 27, 2012 Share Posted September 27, 2012 Okay, there are up to 15 fields, "Excluded1" through "Excluded15", so this should work: var numWidgets = 0; for (var i = 1; i <= 15; i++) { if (Field("Excluded" + i)) numWidgets++; } var numRows = Int((numWidgets + 2) / 3); var table = new FPTable; table.AddColumns(24000, 24000, 24000); table.SetBorders("Thin", "Black", "Top", "Bottom"); var widgetNum = 0; for (var r = 1; r <= numRows; r++) { var row = table.AddRow(); for (var c = 0; c < 3; c++) { widgetNum = r + (c * numRows); row.Cells[c].SetBorders("Thin", "Black", "Left", "Right"); if (widgetNum <= numWidgets) row.Cells[c].Content = "• " + Field("Excluded" + widgetNum); } } return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
gregmaze Posted October 1, 2012 Author Share Posted October 1, 2012 Hello Dan, Yes there are 15 fields at most that will be used. This last script leaves a bullet and blank if 1 or more of the 15 does not get chosen. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 2, 2012 Share Posted October 2, 2012 This last script leaves a bullet and blank if 1 or more of the 15 does not get chosen. Okay, try this instead: var widgets = []; for (var i = 1; i <= 15; i++) widgets.push(Field("Excluded" + i)) widgets = widgets.filter(Boolean); var numWidgets = widgets.length; widgets.unshift(""); var numRows = Int((numWidgets + 2) / 3); var table = new FPTable; table.AddColumns(24000, 24000, 24000); table.SetBorders("Thin", "Black", "Top", "Bottom"); var widgetNum = 0; for (var r = 1; r <= numRows; r++) { var row = table.AddRow(); for (var c = 0; c < 3; c++) { widgetNum = r + (c * numRows); row.Cells[c].SetBorders("Thin", "Black", "Left", "Right"); if (widgetNum <= numWidgets) row.Cells[c].Content = "• " + widgets[widgetNum]; } } return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
gregmaze Posted October 3, 2012 Author Share Posted October 3, 2012 Thank you very much Dan... That worked great... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.