I’m hoping I can get some help on a hurdle which I’m having a battle with.
In the attached form, I have 2 parts.
In part 1 the user is expected to enter amounts and identify where is those amounts currently sit: (Chequing, Savings, RSP – chosen by the “Account” column dropdowns)
In part 2, I’m looking to display the total Amounts but based on which account the user has chosen.
So if the user
. . . Part 2 would look like
Total Amount in Chequing = $10.00
Total Amount in Saving = $30.00
Total Amount in RSP = $500.00
. . . but if the user changed the dropdown in Row 1 to RSP then Part 2 would look like:
Total Amount in Chequing = $0.00
Total Amount in Saving = $30.00
Total Amount in RSP = $510.00
I’ve been struggling with the use of variable, as I feel the solution lies with them, however I’m having a frustrating time. That, in addition to being a little unsure where best to place the code.
Any help with this would be greatly appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Sorry about that seems the first line of my code got 'lost', have updated you sample and uploaded to https://sites.google.com/site/livecycledesignercookbooks/home/westrat-Example1.pdf?attredirects=0&d=...
The missing line was
var total = 0;
Regards
Bruce
Views
Replies
Total Likes
Hi
You could use something like this JavaScript code in the calculate event of ChequingTotal.
var rows = Part1.resolveNodes("#subform[*]")
for (var i = 0; i < rows.length; i++) {
var row = rows.item(i);
var accountType = row.resolveNode("AccountType");
if (accountType !== null && accountType.rawValue == "0") {
var amount = row.resolveNode("AccountAmount");
if (!amount.isNull) {
total += amount.rawValue;
}
}
}
total;
Similar code in SavingsTotal and RSPTotal but with accountType.rawValue == "0" changed to accountType.rawValue == "1" and accountType.rawValue == "2" respectively.
You should make the binding values the same across all rows as Row4 had them as 3,4,5. The code could be a lot easier if you used a table. If could also be easier if you were only going to have 4 rows, but I have assumed you might add some more at some time.
Views
Replies
Total Likes
First and foremost, I would like to thank you for your help. The time you put into responding to my issue is much appreciated. I was hoping to impose at bit more. I’ve tried the code but did not find success. Any chance you could take another look? I attach the form with the coding included.
Again, thank you.
Views
Replies
Total Likes
Hi,
Sorry about that seems the first line of my code got 'lost', have updated you sample and uploaded to https://sites.google.com/site/livecycledesignercookbooks/home/westrat-Example1.pdf?attredirects=0&d=...
The missing line was
var total = 0;
Regards
Bruce
Views
Replies
Total Likes
Fantastic! Bruce, thank you once again.
Views
Replies
Total Likes
Views
Likes
Replies