kristina3909 Posted June 9, 2020 Share Posted June 9, 2020 I am working on a table and am new to formatting and alignment etc. What I would like to do is format my date (MM/dd/yyyy), amounts (add $) and keep the first 2 column left aligned but right align the last 3 columns. Any help would be appreciated! var table = new FPTable(); table.AddColumns(8000,29500,7000,7000,5700); var data = FusionPro.GetMultiLineRecords(); for (var rec = 1; rec <= data.recordCount; rec++) { function ExField(str) { return '<p br=false linespacing=0.8>' + TaggedTextFromRaw(data.GetFieldValue(rec, str)); } var content = ["Trx_Date_From","Description","ApprovedAmt", "Payments","Balance"].map(ExField); var row = table.AddRow(); var [cell] = row.Cells; cell.Margins = { 'Top': 1, 'Bottom': 1, 'Left': 0, 'Right': 0 }; cell.VAlign = 'Bottom'; row.CopyCells(0, 1, 2, 3, 4); row.minHeight = 15 * 100; // 15 pt row height. row.SetContents.apply(row, content); } return table.MakeTags(); Quote Link to comment Share on other sites More sharing options...
kristina3909 Posted June 9, 2020 Author Share Posted June 9, 2020 Ok I have figured out the alignment now I just need to figure out how to format each field within the table. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 11, 2020 Share Posted June 11, 2020 First, if you're using FusionPro 11.1, then you can make this table, formatting and all, without writing a single line of JavaScript. In older versions, you can just break out that call to row.SetContents() with multiple parameters, just like in this post: http://forums.pti.com/showpost.php?p=23869&postcount=12 In your case, I don't have your data, so I can't validate the code, but I think you want to do this: row.SetContents( FormatDate(ExField("Trx_Date_From"), "MM/dd/yyyy"), ExField("Description"), "$" + ExField("ApprovedAmt"), "$" + ExField("Payments"), "$" + ExField("Balance") ); 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.