Related row count = 0

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

04 Dec 2018

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 2083 times

User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

04 Dec 2018

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 2082 times

User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

04 Dec 2018

Got it:
relatedItems(2).data('ctx')..................

Sorry to bother - this may help others

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

04 Dec 2018

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.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests