Need to know how to get another/new line created for a report dashboard portal/url.

allentschumper1
Tera Contributor

Hello -

sorry, this is hard to explain.  I have a page that was created using a widget (by a colleague) and sporadically we are enhancing it (add new columns, clean up bad data, make sure it's pulling the right data).  

Added an attachment that shows you what it looks like.

If you look at the bottom of the report/page you will see it says Risks and Mitigation Strategy.  That there is supposed to take the data from the description field (for Risk) and mitigation plan (Mitigation Strategy) field on a Project and put that data on the portal/page.  

However, you can have multiple Risks on a Project.  and we need all of them to display when they are there.  Right now, we only get one line.  If you look at the screen shot, it's actually pulling the description from 2 Risks and putting the data there (as well as Mitigation Strategy field).  I am trying to find out a way to split that into different/new lines.

I have been told it needs some adjusting on the HTML portion of the widget...possibly the Server Script as well.

Looking for suggestions on how this would look and what is needed to be done.

Thank you

13 REPLIES 13

sandeeprawat
Tera Expert

Hi,

Having new lines in <td> can be tough. Not saying impossible and there might be a solution the way you want it.

I would however propose another way, which would be to redesign the data.project object as below.

 

var gr_risk = new GlideRecord('risk');
gr_risk.addQuery('task', gr_project.getUniqueValue());
gr_risk.orderByDesc('sys_created_on');
//gr_risk.setLimit(1);
gr_risk.query();
var mitigation = [];
//var slips = [];
var allRisks = [];
while (gr_risk.next()) {
mitigation.push(gr_risk.getDisplayValue("mitigation") ? gr_risk.getDisplayValue("mitigation") : 'N/A');
allRisks.push(gr_risk.getDisplayValue('description'));
//slips = (gr_risk.getDisplayValue("description")) ? gr_risk.getDisplayValue("description") : 'N/A';

obj.risk_description = allRisks;

obj.risk_mitigation = mitigation;

data.project_value.push(obj); //each object obj now represents separate project values of dscription and mitigation

}

}
}

 

html at a high level should be similar to

<table ng-repeat="projects in c.data.project_value"> // looping through all projects
<tr >
<td>
{{projects.risk_description}}<br/>
</td>

<td>{{projects.risk_mitigation}}

</td>
</tr>
</table>
</div>

You would have to make appropriate adjustments in html side, but I hope you got the idea.

Hope that helps

excellent, thank you.  I'll play around with this and see what happens!  I think I've got the idea 🙂  Again, at least gives me something to toy with and see if I can make any adjustments on the fly.

Thank you and I'll let you know.

allentschumper1
Tera Contributor

Maybe I don't understand as much as I should 🙂  at least the HTML side.  i put in the new portion of the server script and get this in the report...

find_real_file.png

 

not sure if they would want to have the [] and "" in there...is there a way to alleviate that?

 

Then, also, the report shows the project multiple times...don't want that...

 

find_real_file.png

I did put the portion of HTML in...didn't look right, have to play around with it some more.  But i'll have to get that HTML working in order to say, have Risk 1 be stacked on top (first line) over Risk 2 (second line)...obviously a break in the line is needed.  

Hi,

Yes the ng-repeat at the table level is not working for you.. sorry there I did not know your complete html structure.

So you just need to loop on the risk and mitigation values and keep the Labels fixed. It should be something like below.

 

<div class="label-column">
<tr>
<td>
<h5>${Risks}</h5>
</td>

<td>
<h5>${Mitigation Strategy}</h5>
</td>
</tr>
</div>
<div class="label-column">
<tr ng-repeat="projects in c.data.project_value">
<td>
{{projects.risk_description}}<br/>
</td>
<td>
{{projects.risk_mitigation}}<br/>
</td>
</tr>
</div>

 

I hope it looks better this time.

Also, server side there is some code redundancy in while loop, lets simplify it as

while (gr_risk.next()) {

obj.risk_description = gr_risk.getDisplayValue("mitigation") ? gr_risk.getDisplayValue("mitigation") : 'N/A';

obj.risk_mitigation = gr_risk.getDisplayValue('description');

data.project_value.push(obj); //each object obj now represents separate project values of dscription and mitigation

}

If this doesn't work, then share the server side/html code again well which you edited.

Hi,

Got a chance to check the solution out yet ?