Home › Forums › vLooup for SharePoint › average total type on vLookup
- This topic has 5 replies, 2 voices, and was last updated 9 years ago by Alexander Bautz.
-
AuthorPosts
-
-
November 9, 2015 at 03:38 #9218
I’m attempting to provide an average percentage as a total on a percentage column. I can add {“average”:true} to the column, but it still remains an aggregate total. Not sure if it’s anything to do with the column type being a percentage as I cannot get it to trigger on other numeric fields either.
Using DFFS 4.359
-
November 11, 2015 at 23:48 #9250
Hi,
It seems there is a bug in the tooltip help text – use this format in the “Special configurations”:{"percentage":true,"suffix":"%","totalsType":"average"}
Sorry for the inconvenience – I’ll update the tooltip in the next release.
Alexander
-
November 13, 2015 at 02:53 #9270
Thanks, your solution works.
-
November 19, 2015 at 00:18 #9355
I am attempting to average another field which is a checkbox. The values are presented as “Yes” or “No” strings and thus not eligible for aggregation. I can get to the vLookup.dataObj to do a manual count, but I’m wondering if there is a way to present the Boolean as 1 or 0 and aggregate normally? This total will also hopefully be a percentage.
Here’s my current tests for a manual count:
function getSignificantEventsPercent() { console.log(spjs.vLookup.dataObj); console.log(spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].count); console.log(spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].items[1].Significant_x0020_Event_x0020_KP); var countKPImet = 0; for (var currentItem = 1; currentItem <= spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].count; currentItem++){ if (spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].items[currentItem].Significant_x0020_Event_x0020_KP == "Yes") { countKPImet++; } } // For currentItem console.log(countKPImet); }
- This reply was modified 9 years ago by Tony Bowes.
- This reply was modified 9 years ago by Tony Bowes.
-
November 20, 2015 at 04:36 #9365
Sidestepped it by updating a rollup field instead:
function getSignificantEventsPercent() { var countKPImet = 0; var allFinalised = true; for (var currentItem = 1; currentItem <= spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].count; currentItem++){ if (spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].items[currentItem].Significant_x0020_Event_x0020_KP == "Yes") { countKPImet++; } if (spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].items[currentItem].Finalised == "No") { allFinalised = false; } } // For currentItem if (allFinalised) { if (spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].count > 0) { var newSignificantEventPercent = Math.round((countKPImet/spjs.vLookup.dataObj.vLookupSURsignificantEvents[1].count) * 100); console.log(newSignificantEventPercent); // debug setFieldValue("SU_x0020_Significant_x0020_Event",newSignificantEventPercent); } $("span.FinalisedWarning").html(""); // clear warning } else { $("span.FinalisedWarning").html("Not all Service User Reports finalised!"); // show warning } // allFinalised } // getSignificantEventsPercent function vLookupIsLoadedCallback(fin){ if(fin === "vLookupSURsignificantEvents") { getSignificantEventsPercent(); } }
- This reply was modified 9 years ago by Tony Bowes.
-
November 20, 2015 at 08:00 #9368
I’m glad you figured it out, and thank you for the “beer” donation.
Best regards,
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.