<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Expandable Table with Totals</title>
	<atom:link href="http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/feed/" rel="self" type="application/rss+xml" />
	<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/</link>
	<description>Building intelligent forms using Adobe LiveCycle Designer</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:32:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6986</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sun, 24 Oct 2010 01:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6986</guid>
		<description>@Jennifer Hawkes,

If all you were doing is calculating the sum of a field that occurs in all instances of a repeatable subform (table row), then you could simply write:

&lt;pre&gt;&lt;code&gt;// FormCalc:
TotalField = Sum(Table1.RepeatableRow[*].TheField)&lt;/code&gt;&lt;/pre&gt;

In the example you gave me, however, you need to make string comparisons to know which rows to sum and I don&#039;t know if it&#039;s possible to express that in a &quot;one-liner&quot; in FormCalc. If it were me, I would do this:

&lt;pre&gt;&lt;code&gt;// FormCalc:
var allItems = form1.#subform[3].General_Expense.Item.all // get all instances of the Item row

GrandTotal = 0 // reset &quot;GrandTotal&quot; field

// loop through all item rows and add only those that matter to the GrandTotal field
for i = 0 upto allItems.length - 1 do
    var item = allItems.item(i)
    if (item.expense_type == &quot;51807 – Membership Dues/Fees&quot; and item.payment_type &lt;&gt; &quot;BMC Credit Card&quot;) then
        GrandTotal = GrandTotal + item.total
    endif
endfor&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Jennifer Hawkes,</p>
<p>If all you were doing is calculating the sum of a field that occurs in all instances of a repeatable subform (table row), then you could simply write:</p>
<pre><code>// FormCalc:
TotalField = Sum(Table1.RepeatableRow[*].TheField)</code></pre>
<p>In the example you gave me, however, you need to make string comparisons to know which rows to sum and I don&#8217;t know if it&#8217;s possible to express that in a &#8220;one-liner&#8221; in FormCalc. If it were me, I would do this:</p>
<pre><code>// FormCalc:
var allItems = form1.#subform[3].General_Expense.Item.all // get all instances of the Item row

GrandTotal = 0 // reset "GrandTotal" field

// loop through all item rows and add only those that matter to the GrandTotal field
for i = 0 upto allItems.length - 1 do
    var item = allItems.item(i)
    if (item.expense_type == "51807 – Membership Dues/Fees" and item.payment_type <> "BMC Credit Card") then
        GrandTotal = GrandTotal + item.total
    endif
endfor</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6985</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sun, 24 Oct 2010 00:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6985</guid>
		<description>@Kerry,

If I understand you question correctly, you basically want to know how to access specific rows and columns in a table.

In XFA, a table consists of subforms that form the table itself and the rows that it contains. Cells are made of fields or subforms inside each row.

A dynamic table typically has a repeatable row, in which case you&#039;re dealing with a repeatable subform with multiple instances.

When a subform has multiple instances, each instance can be accessed using the &quot;[n]&quot; notation where &quot;n&quot; is the index of the instance you&#039;re looking for.

To access the 5th row in a table with the name &quot;Table1&quot; which has a repeatable row &quot;Item&quot; in it, you would do this:

&lt;pre&gt;&lt;code&gt;// JavaScript:
// note that subform instances are zero-based
var row = Table1.resolveNode(&quot;Item[4]&quot;);&lt;/code&gt;&lt;/pre&gt;

Say each Item row has 3 columns which are fields named &quot;Description&quot;, &quot;Quantity&quot; and &quot;UnitPrice&quot;. To access the Quantity column (field) in the 3rd instance of the repeatable Item row in Table1, you would do this:

&lt;pre&gt;&lt;code&gt;// JavaScript:
var row = Table1.resolveNode(&quot;Item[2]&quot;);
row.Quantity.rawValue; // get the quantity column&#039;s value from the 3rd row&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Kerry,</p>
<p>If I understand you question correctly, you basically want to know how to access specific rows and columns in a table.</p>
<p>In XFA, a table consists of subforms that form the table itself and the rows that it contains. Cells are made of fields or subforms inside each row.</p>
<p>A dynamic table typically has a repeatable row, in which case you&#8217;re dealing with a repeatable subform with multiple instances.</p>
<p>When a subform has multiple instances, each instance can be accessed using the &#8220;[n]&#8221; notation where &#8220;n&#8221; is the index of the instance you&#8217;re looking for.</p>
<p>To access the 5th row in a table with the name &#8220;Table1&#8243; which has a repeatable row &#8220;Item&#8221; in it, you would do this:</p>
<pre><code>// JavaScript:
// note that subform instances are zero-based
var row = Table1.resolveNode("Item[4]");</code></pre>
<p>Say each Item row has 3 columns which are fields named &#8220;Description&#8221;, &#8220;Quantity&#8221; and &#8220;UnitPrice&#8221;. To access the Quantity column (field) in the 3rd instance of the repeatable Item row in Table1, you would do this:</p>
<pre><code>// JavaScript:
var row = Table1.resolveNode("Item[2]");
row.Quantity.rawValue; // get the quantity column's value from the 3rd row</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer Hawkes</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6984</link>
		<dc:creator>Jennifer Hawkes</dc:creator>
		<pubDate>Thu, 21 Oct 2010 20:44:49 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6984</guid>
		<description>I have created a travel expense tracking form.  I have used your dynamic table to give users the ability to enter all their travel reimbursements.  There are many fields, but the important ones for this questions are: expense type, payment type, total (which calculates a total based on the original charge * conversion rates).

I also have a summary sheet (which is used by the controller&#039;s office to process the reimbursement).  The sheet needs to use IF statements to SUM values based on the their answers below.  My current script works to conditionally sum the first row of the tracking expense chart; however, if I add additional rows, it will not evaluate those.  I think I need some sort of array formula but I don&#039;t know what that looks like.  I have been using FormCalc because I know no JavaScript.

if (form1.#subform[3].General_Expense.Item[*].expense_type == &quot;51807 - Membership Dues/Fees&quot; and form1.#subform[3].General_Expense.Item[*].payment_type &lt;&gt; &quot;BMC Credit Card&quot;) then Sum(form1.#subform[3].General_Expense.Item.total) endif</description>
		<content:encoded><![CDATA[<p>I have created a travel expense tracking form.  I have used your dynamic table to give users the ability to enter all their travel reimbursements.  There are many fields, but the important ones for this questions are: expense type, payment type, total (which calculates a total based on the original charge * conversion rates).</p>
<p>I also have a summary sheet (which is used by the controller&#8217;s office to process the reimbursement).  The sheet needs to use IF statements to SUM values based on the their answers below.  My current script works to conditionally sum the first row of the tracking expense chart; however, if I add additional rows, it will not evaluate those.  I think I need some sort of array formula but I don&#8217;t know what that looks like.  I have been using FormCalc because I know no JavaScript.</p>
<p>if (form1.#subform[3].General_Expense.Item[*].expense_type == &#8220;51807 &#8211; Membership Dues/Fees&#8221; and form1.#subform[3].General_Expense.Item[*].payment_type &lt;&gt; &#8220;BMC Credit Card&#8221;) then Sum(form1.#subform[3].General_Expense.Item.total) endif</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6983</link>
		<dc:creator>Kerry</dc:creator>
		<pubDate>Fri, 15 Oct 2010 19:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6983</guid>
		<description>Good afternoon,
I have an issue I was hoping you could help me with.  I have set up a form with two dynamic tables, the first table is always visible and based on a particular selection in a drop down box which resides in the 5th column of the first table, the second table presence is set to &quot;visible&quot;.  The problem I am having is prefilling the data from column 1 of the first table.  If the user selects the appropriate choice in lets say rows 1 and 5 of the first table, how do I prefill the data from column1 of rows 1 and 5 into column 1 of rows 1 and 2 of the second table.  I&#039;m trying not to be too wordy so I hope my explanation is sufficient.
Thanks so much for running such a wonderful site!
Kerry</description>
		<content:encoded><![CDATA[<p>Good afternoon,<br />
I have an issue I was hoping you could help me with.  I have set up a form with two dynamic tables, the first table is always visible and based on a particular selection in a drop down box which resides in the 5th column of the first table, the second table presence is set to &#8220;visible&#8221;.  The problem I am having is prefilling the data from column 1 of the first table.  If the user selects the appropriate choice in lets say rows 1 and 5 of the first table, how do I prefill the data from column1 of rows 1 and 5 into column 1 of rows 1 and 2 of the second table.  I&#8217;m trying not to be too wordy so I hope my explanation is sufficient.<br />
Thanks so much for running such a wonderful site!<br />
Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6982</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Fri, 01 Oct 2010 14:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6982</guid>
		<description>@Leon,

Wonderful! I&#039;m always happy to hear my blog is helping people out there make better forms!

Yes, that&#039;s correct: You need a script that will loop through all records available via the connection and add instances of table rows with pertaining data. I have a sample of that in my tutorial on &lt;a href=&quot;http://forms.stefcameron.com/2006/10/12/displaying-all-records-from-an-odbc-data-connection/&quot; rel=&quot;nofollow&quot;&gt;displaying all records from an ODBC connection&lt;/a&gt;.

If that doesn&#039;t work, then I should ask whether you&#039;re previewing your form with Acrobat or Reader. Seeing only the first record is often a sign that you’re using Reader instead of Acrobat and therefore you can’t use data connections unless you extend the PDF to allow &lt;a href=&quot;http://forms.stefcameron.com/2006/08/12/importing-data-in-acrobat/&quot; rel=&quot;nofollow&quot;&gt;data import&lt;/a&gt; in Reader.</description>
		<content:encoded><![CDATA[<p>@Leon,</p>
<p>Wonderful! I&#8217;m always happy to hear my blog is helping people out there make better forms!</p>
<p>Yes, that&#8217;s correct: You need a script that will loop through all records available via the connection and add instances of table rows with pertaining data. I have a sample of that in my tutorial on <a href="http://forms.stefcameron.com/2006/10/12/displaying-all-records-from-an-odbc-data-connection/" rel="nofollow">displaying all records from an ODBC connection</a>.</p>
<p>If that doesn&#8217;t work, then I should ask whether you&#8217;re previewing your form with Acrobat or Reader. Seeing only the first record is often a sign that you’re using Reader instead of Acrobat and therefore you can’t use data connections unless you extend the PDF to allow <a href="http://forms.stefcameron.com/2006/08/12/importing-data-in-acrobat/" rel="nofollow">data import</a> in Reader.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leon</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6981</link>
		<dc:creator>Leon</dc:creator>
		<pubDate>Mon, 27 Sep 2010 04:56:03 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6981</guid>
		<description>I have found your blog to be very helpful!  Thank you!

I have a created a table that is bound to a SQL table via ODBC.  When I preview the form, only the first row of the query result appears in my table.  The data set varies from 1 to 10-15 rows (depending on the selected value of a dropdown list).  I have been trying for 3 days (I am ashamed to say) to get all the expected data to display.  I have set the table row to repeat...I just dont know what else to do.

Im wondering if I need some sort of script to populate each row according to the expected  number of rows.

I appreciate any help you can provide.

Thank you
Leon</description>
		<content:encoded><![CDATA[<p>I have found your blog to be very helpful!  Thank you!</p>
<p>I have a created a table that is bound to a SQL table via ODBC.  When I preview the form, only the first row of the query result appears in my table.  The data set varies from 1 to 10-15 rows (depending on the selected value of a dropdown list).  I have been trying for 3 days (I am ashamed to say) to get all the expected data to display.  I have set the table row to repeat&#8230;I just dont know what else to do.</p>
<p>Im wondering if I need some sort of script to populate each row according to the expected  number of rows.</p>
<p>I appreciate any help you can provide.</p>
<p>Thank you<br />
Leon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6980</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sun, 16 May 2010 13:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6980</guid>
		<description>@Maria,

Sounds like you have a complex form... I&#039;m having a hard time understanding at which point you lose those checkboxes. If you&#039;re just hiding the subform(s) that contain(s) the checkboxes, they shouldn&#039;t lose their values. Can you describe these subforms in greater detail, including what you&#039;re expecting to still be checked when the user performs a certain action?

For the summary table, I would&#039;ve thought that every checkbox would&#039;ve had a Click event which would check the (new) value of the checkbox. If it&#039;s &quot;1&quot;, then add a row to the summary table with the associated institution name; if it&#039;s &quot;0&quot;, remove the appropriate row from the table. Another way to do it would be to refresh the table (i.e. set the summary&#039;s row instances to zero to remove all instances, then look for all checked checkboxes and add appropriate rows) when the user clicks on the button to hide the institution list subform (the one with all the checkboxes).</description>
		<content:encoded><![CDATA[<p>@Maria,</p>
<p>Sounds like you have a complex form&#8230; I&#8217;m having a hard time understanding at which point you lose those checkboxes. If you&#8217;re just hiding the subform(s) that contain(s) the checkboxes, they shouldn&#8217;t lose their values. Can you describe these subforms in greater detail, including what you&#8217;re expecting to still be checked when the user performs a certain action?</p>
<p>For the summary table, I would&#8217;ve thought that every checkbox would&#8217;ve had a Click event which would check the (new) value of the checkbox. If it&#8217;s &#8220;1&#8243;, then add a row to the summary table with the associated institution name; if it&#8217;s &#8220;0&#8243;, remove the appropriate row from the table. Another way to do it would be to refresh the table (i.e. set the summary&#8217;s row instances to zero to remove all instances, then look for all checked checkboxes and add appropriate rows) when the user clicks on the button to hide the institution list subform (the one with all the checkboxes).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maria</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6979</link>
		<dc:creator>Maria</dc:creator>
		<pubDate>Mon, 10 May 2010 03:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6979</guid>
		<description>Hi Stefan,

Can you please help. Is there a way to create a drill-down drop list in LiveCycle. I am designing a complex application form for researchers to fill in. In this form I ask them to define their research institutions, some applicants a lot of institutions, so initially I thought I should create expandable table with drop-down lists in the row, so they can choose one from the list and add as many as they like later. But then the list became enougmous, and I couldn&#039;t find any way to make it a drill-down. Then I thought I should have a subform with all of those Institutions as check boxes, so that parent institution subform would have all of the child institutions in subforms. So I have one page of institutions and if you click on the institution another subform appears with the children institutions. I then wanted to have a summary table of all of the institutions as a table of read only text fields which grows once another check box is clicked. And I also have

this.presence = &quot;hidden&quot;;

script on exit on this subform with the ckeckboxes so it dissapers of the screen and is not printed later, it can be reopened by pressing the &quot;Display&quot; button. The hiding and the button works fine.

I have a few problems with the whole thing. First of all once I come out of the subform it hides but when I display it again the check boxes are unticked, so for some reason it doesn&#039;t same changes. And also I can&#039;t get that summary talbe to work at all, despite the fact that I thought it would be quite easy.

Can you help please? I thought of including more of my scripting, but it doesn&#039;t work and I feel very dum about it.</description>
		<content:encoded><![CDATA[<p>Hi Stefan,</p>
<p>Can you please help. Is there a way to create a drill-down drop list in LiveCycle. I am designing a complex application form for researchers to fill in. In this form I ask them to define their research institutions, some applicants a lot of institutions, so initially I thought I should create expandable table with drop-down lists in the row, so they can choose one from the list and add as many as they like later. But then the list became enougmous, and I couldn&#8217;t find any way to make it a drill-down. Then I thought I should have a subform with all of those Institutions as check boxes, so that parent institution subform would have all of the child institutions in subforms. So I have one page of institutions and if you click on the institution another subform appears with the children institutions. I then wanted to have a summary table of all of the institutions as a table of read only text fields which grows once another check box is clicked. And I also have</p>
<p>this.presence = &#8220;hidden&#8221;;</p>
<p>script on exit on this subform with the ckeckboxes so it dissapers of the screen and is not printed later, it can be reopened by pressing the &#8220;Display&#8221; button. The hiding and the button works fine.</p>
<p>I have a few problems with the whole thing. First of all once I come out of the subform it hides but when I display it again the check boxes are unticked, so for some reason it doesn&#8217;t same changes. And also I can&#8217;t get that summary talbe to work at all, despite the fact that I thought it would be quite easy.</p>
<p>Can you help please? I thought of including more of my scripting, but it doesn&#8217;t work and I feel very dum about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul jj</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6978</link>
		<dc:creator>paul jj</dc:creator>
		<pubDate>Sun, 18 Apr 2010 19:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6978</guid>
		<description>well well well - sorted it , can&#039;t believe i did it so quick, thanks to this forum !!!

if(ItemCost ne 0 &amp; HasValue(ItemCost) &amp; (ItemPer ne 0 &amp; HasValue(ItemPer))) then
((ItemQnty * ItemCost) / ItemPer) + ItemDelivery

else
null
endif

thanks all!!!</description>
		<content:encoded><![CDATA[<p>well well well &#8211; sorted it , can&#8217;t believe i did it so quick, thanks to this forum !!!</p>
<p>if(ItemCost ne 0 &amp; HasValue(ItemCost) &amp; (ItemPer ne 0 &amp; HasValue(ItemPer))) then<br />
((ItemQnty * ItemCost) / ItemPer) + ItemDelivery</p>
<p>else<br />
null<br />
endif</p>
<p>thanks all!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul jj</title>
		<link>http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6977</link>
		<dc:creator>paul jj</dc:creator>
		<pubDate>Sun, 18 Apr 2010 19:36:30 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/#comment-6977</guid>
		<description>Hi again, I worked it out - i had to check that out of the three input fields, two of them were null or 0 first, and then tell it to return a null or 0 value. the problem i have now is to write some code that will perform the test on those two fields.
I have managed to write
if(ItemCost ne 0 &amp; HasValue(ItemCost)) then
((ItemQnty * ItemCost) / ItemPer) + ItemDelivery
else
null
endif
and got it to work - how can i perform this test on the last input field &quot;per&quot;, i&#039;m so new to code its untrue :)  i need some direction on how the if function works i think.
Thanks
Paul</description>
		<content:encoded><![CDATA[<p>Hi again, I worked it out &#8211; i had to check that out of the three input fields, two of them were null or 0 first, and then tell it to return a null or 0 value. the problem i have now is to write some code that will perform the test on those two fields.<br />
I have managed to write<br />
if(ItemCost ne 0 &amp; HasValue(ItemCost)) then<br />
((ItemQnty * ItemCost) / ItemPer) + ItemDelivery<br />
else<br />
null<br />
endif<br />
and got it to work &#8211; how can i perform this test on the last input field &#8220;per&#8221;, i&#8217;m so new to code its untrue <img src='http://forms.stefcameron.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   i need some direction on how the if function works i think.<br />
Thanks<br />
Paul</p>
]]></content:encoded>
	</item>
</channel>
</rss>

