I have a Table which is being passed to my context in the ADOBE Form. I need to be able to count the # of records in this table. I don’t have to display the actual table in this case on the form, I just need the record count. And, I need to do this using JavaScript and I don’t know anything about Java (although if FormCalc works I can use this as well). My Tablename is Customer and on my form it is in the Hierarcy data.main.customerbody.customerline. If I have to have this table data on the form then I can just put it on the form and make it invisiible. I really only need to count the # of records though and return this # to a Text Field on the form.
Does someone know how to do this and can you give me an example in either Java for FormCalc? The more specfic you can be with the scripting example the better for this newbie. thx!
Solved! Go to Solution.
Views
Replies
Total Likes
I was over complicating things and I found a simple answer to my Problem. I am doing this Form on SAP with Livecyle so here is what I did
In the Form Interface I created a global variable called gv_count. Then in the Form Interface Initialization I added this code:
describe table bookings LINES gv_count.
And then in the form I just had to add gv_count to the context and then bind this to the field I want to do the count in
Views
Replies
Total Likes
Hi,
you can put a small FormCalc script into the calculate event of the table.
textfield = $.dataNode.nodes.length
It will count all subnodes of the table object, which means the number of rows (header, rows and footers).
To count only rows with a specific name the script looks like:
count = $.dataNode.resolveNodes("dataRow[*]").length
It will count all rows named "dataRow" within the table.
Views
Replies
Total Likes
thx for the reply, I don't seem to be able to get it to work. Just to try your suggestion with a simple form I made a copy of SAP's FP_TEST_03_TABLE and here is what I did. I defined the variable vcnt in the form properties
data.Main.BookingsBody.BookingsLine.CARRID::calculate - (FormCalc, client)
var vcnt = $.data.Main.BookingsBody.ResolveNodes("BookingsLine[*]").length
I added a text field Just below the Table and before the Sum Called MyCount with this code
data.Main.MyCount::ready:form - (FormCalc, client)
MyCount.rawValue = vcnt
I'm pretty new to this as you can probably tell. It is probably something simple and I just can't see it. Can you help?
Views
Replies
Total Likes
I was over complicating things and I found a simple answer to my Problem. I am doing this Form on SAP with Livecyle so here is what I did
In the Form Interface I created a global variable called gv_count. Then in the Form Interface Initialization I added this code:
describe table bookings LINES gv_count.
And then in the form I just had to add gv_count to the context and then bind this to the field I want to do the count in
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies