Page 1 of 1

Related row count = 0

Posted: 04 Dec 2018
by Roo
I was looking at a number of other posts here and wanted to include a couple of subtotals and last date on a related items.

I've looked through some of Nikita's checks and found that when I run

fd.relatedItems(0).data('ctx').ListData.Row.length

I get a return of 0 - even though there is a row? why would this be?
missingrelateditems.png
missingrelateditems.png (56.6 KiB) Viewed 2091 times

Re: Related row count = 0

Posted: 04 Dec 2018
by Roo
Hi Again,

I think I found the issue why it is showing 0. I have 2 related items on this master form.

I'm using the ctx (as showing in other threads) but it seems to be showing the unrelated related items.

How can I use the following functionality to target a specific related items? (I put the css class of the one I wanted to "ctx" but it seems to return the others value "Pictures")

var total = 0;
var rows = fd.relatedItems(0).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['daystaken'])
});
455.png
455.png (24.02 KiB) Viewed 2090 times

Re: Related row count = 0

Posted: 04 Dec 2018
by Roo
Got it:
relatedItems(2).data('ctx')..................

Sorry to bother - this may help others

Re: Related row count = 0

Posted: 04 Dec 2018
by AlexZver
Dear Roo,

Yes. you absolutely right, by incrementing an index in "relatedItems(index)" you can gain access to all of the related items controls on your form.