Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 04:34 PM
Hey Mickey,
Glad to see you were able to have a go at it. You can definitely achieve what you want to but because the way your biaDependenciesForGroup is set up its returning each variable as its own row and thats why you are getting the repeates. You will need to either update the logic of the function to group or you will need to in your script remember what "depends on" you are looking at as part of the while loop so you can merge the rows.
Below is an example of how you may tackle it using your script as a basis. Please not I havent tested this and no guarantee it works but its just to illustrate how it could be done.
if (biaDependenciesForGroup.hasNext()) {
tableBodyContent = '<tr>' +
'<th width="60%">' + 'Depends On' + '</th>' +
'<th>' + 'Contingency Strategy' + '</th>' +
'<th>' + 'Description of Contingency Strategy' + '</th>' +
'</tr>';
var currentDepends = '';
var contingencyStrategy = '';
var contingencyDescription = '';
while (biaDependenciesForGroup.next()) {
if (currentDepends == '') {
currentDepends = biaDependenciesForGroup.getDisplayValue('dep_depends_on');
}
if (currentDepends == biaDependenciesForGroup.getDisplayValue('dep_depends_on')) {
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Contingent Strategy') {
contingencyStrategy = biaDependenciesForGroup.getDisplayValue('var_value');
}
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Description of Contingency Strategy') {
contingencyDescription = biaDependenciesForGroup.getDisplayValue('var_value');
}
} else {
tableBodyContent = tableBodyContent +
'<td width="60%">' + currentDepends + '</td>' +
'<td>' + contingencyStrategy + '</td>' +
'<td>' + contingencyDescription + '</td>' +
'</tr>';
currentDepends = biaDependenciesForGroup.getDisplayValue('dep_depends_on');
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Contingent Strategy') {
contingencyStrategy = biaDependenciesForGroup.getDisplayValue('var_value');
}
if (biaDependenciesForGroup.getDisplayValue('var_variable') = 'Description of Contingency Strategy') {
contingencyDescription = biaDependenciesForGroup.getDisplayValue('var_value');
}
}
}
}