Problem:
Is there a way to edit the reports slide? I would like to take off the learner response column in the “detailed results” portion of the data collection
ActivePresenter Version:
OS:
Notes:
Problem:
Is there a way to edit the reports slide? I would like to take off the learner response column in the “detailed results” portion of the data collection
ActivePresenter Version:
OS:
Notes:
Hi,
You can hide the “Learner Response” column by using JavaScript. Please follow the below steps:
if (!prez.initDetailReport) {
prez.initDetailReport = true;
var oldDetailedReportData = prez.detailedReportData;
prez.detailedReportData = function(bIncludeCorrectResponses) {
var data = oldDetailedReportData.call(this, bIncludeCorrectResponses);
data = data.replace(/(<th width='30%' align='center'>Learner Response<\/th>)/g, "");
data = data.replace(/(<td align='center' class='ap-result-response' style='word-break:break-all'>.*?<\/td>)/g, "");
return data;
}
}
Regards,
Thank you so much that worked perfectly. One more questions. Would it be the same code if I wanted to manipulate different elements. For example removing the ID and NO. columns or maybe the max score as well. Could I just substitute the new column name in. For example the code says
.>Learner Response</th>)/ could I just change it to .>Max Score</th>)/
Hi,
You can remove other columns by replacing the report data string. However, it requires more complex and hardcode. Therefore, you should not use this way.
Regards,
Hi all,
To hide the specific columns in the report table, you can add the following JavaScript codes to the Report Slide’s On Load event > Execute JavaScript action:
var columns = [3, 8]; // column index
for (var i = 0; i < columns.length; ++i) {
$('table th:nth-child(' + columns[i] + ')', this.node).hide();
$('table td:nth-child(' + columns[i] + ')', this.node).hide();
}
Then, edit the value of the var columns in the scripts. Enter the correct column number you want to hide.
For example, the above code demonstrates how to hide columns 3 and 8.
Hope it helps.
var columns = [3, 8]; //column index
for (var i = 0; i < columns.length; ++i) {
$(‘table th:nth-child(’ + columns[i] + ‘)’, this.node).hide();
$(‘table td:nth-child(’ + columns[i] + ‘)’, this.node).hide();
}
I can hide the columns I want with this code. But what I want, for example, is to see whether the 5th question is true or false, using javascript. I would be very happy if you could help me write the code that tells me whether the question I want is true or false, one by one. Kind regards
We do not support coloring the question result in the report table. So, if you want to see whether the question is true or false, just base on the Result column.
BR,
Hi @PhuongThuy_Le
. This is a great post, exactly what I’ve just been looking for! I’m wondering if there’s a way to add to the code so the column headers can be changed. For example, the first column header is No., but is there I way I could change it to say Question Number, or instead of Slide Index change it to Slide Number for example? TIA!
samamara
Hi,
I’d like to extract specific values (for example, only the “Learner Response” cells) from the HTML returned by prez.detailedReportData(true).
Is the only way to do this by parsing the HTML with match or replace (regex), or is there a simpler method or built-in API in ActivePresenter to directly access these values?
In short:
What is the easiest way to extract a specific value from prez.detailedReportData?
Hi,
You can use the function prez.reportData(); to achieve that.
Refer to the ActivePresenter User Manual > Custom JavaScript in HTML5 Output (page 327) for more details: https://atomisystems.com/apdownloads/ActivePresenter9_UserManual_en.pdf
BR,
For those who wants to rename the column header, kindly refer to this thread: Edit or Customize Column Headers on Reports Slide
Thank you very much.