Need to know how to get another/new line created for a report dashboard portal/url.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 01:21 PM
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
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 12:21 PM
I have not...I'm going to send you something. Hopefully it better explains things.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2022 12:39 PM
Okay, I have added 3 attachments.
1 is for how a project record looks and the Risks that are under it. At the end of the doc, I have some notes
The other 2 are .txt docs that have the entire HTML I am looking at and another with the entire Server Script in hopes that will help your understanding.
In the mean time, I put everything BACK to how it was before I started making modifications just to have a clean slate 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:01 AM
Had a chance to look at this?
As I stated, I put the code back to how it was before we started the convo and that's what's in the attachments. Now, I adjusted the code back to a portion of what was added here.
With that we get this...
I think the brackets and the double quotes are fine...BUT, you still have data on one line. Both the Risks and the Mitigation Strategy should have test 2 on one line and then test on the next line.
Here is how the server side code looks now...
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.project_value = []; //array to store data of project
//gs.addInfoMessage('filter='+input.filter_val);
var gr_project = new GlideRecord('pm_project');
gr_project.addEncodedQuery('state=3^work_endRELATIVEGT@dayofweek@ago@10^NQstate!=3^active=true'); // Pre defined filter applied
gr_project.addEncodedQuery(input.filter_val);
gr_project.query();
var gr_status = new GlideRecord('project_status');
while (gr_project.next()) {
var obj = {}; //object storing various data values of projects
obj.short_description = gr_project.getDisplayValue("short_description");
obj.x_freight_csm_implementation_consultant = gr_project.getDisplayValue("x_freight_csm_implementation_consultant");
obj.portfolio_value = gr_project.getDisplayValue("primary_portfolio");
obj.state_value = gr_project.getDisplayValue("state");
obj.phase = gr_project.getDisplayValue("phase");
obj.percent_complete_value = gr_project.getDisplayValue("percent_complete");
obj.approved_start_date_value = gr_project.getDisplayValue("approved_start_date");
obj.approved_end_date_value = gr_project.getDisplayValue("approved_end_date");
obj.planned_cost = gr_project.getDisplayValue("cost");
obj.start_date_value = gr_project.getDisplayValue("start_date");
obj.work_cost = gr_project.getDisplayValue("budget_cost");
obj.work_start_value = gr_project.getDisplayValue("work_start");
obj.work_end_value = gr_project.getDisplayValue("work_end");
obj.x_freight_csm_source = gr_project.getDisplayValue("x_freight_csm_source");
obj.x_freight_csm_pay_model_type = gr_project.getDisplayValue("x_freight_csm_pay_model_type");
obj.x_freight_csm_processing_model_s = gr_project.getDisplayValue("x_freight_csm_processing_model_s");
// obj.x_freight_csm_sales_forecast = gr_project.getDisplayValue("x_freight_csm_sales_forecast");
obj.x_freight_csm_sales_forecast = new x_freight_csm.FreightCommonFunctions().convertStringCurrency();
obj.x_freight_csm_anticipated_invoice_volume = gr_project.getDisplayValue("x_freight_csm_anticipated_invoice_volume");
obj.x_freight_csm_of_core_carriers = gr_project.getDisplayValue("x_freight_csm_of_core_carriers");
obj.x_freight_csm_of_cpf_carriers = gr_project.getDisplayValue("x_freight_csm_of_cpf_carriers");
obj.status = gr_project.getDisplayValue("status");
obj.x_freight_csm_solutions_design_meeting = gr_project.getDisplayValue("x_freight_csm_solutions_design_meeting");
obj.x_freight_csm_billing_guide_published = gr_project.getDisplayValue("x_freight_csm_billing_guide_published");
obj.x_freight_csm_test_date_begin = gr_project.getDisplayValue("x_freight_csm_test_date_begin");
obj.x_freight_csm_test_date_finish = gr_project.getDisplayValue("x_freight_csm_test_date_finish");
obj.x_freight_csm_target_launch = gr_project.getDisplayValue("x_freight_csm_target_launch");
obj.x_freight_csm_actual_launch = gr_project.getDisplayValue("x_freight_csm_actual_launch");
obj.x_freight_csm_acs_credit_received = gr_project.x_freight_csm_acs_credit_received ? 'Y' : 'N';
//Get status report fields
gr_status.initialize();
gr_status.addQuery('project', gr_project.getUniqueValue());
gr_status.orderByDesc('sys_created_on');
gr_status.setLimit(1);
gr_status.query();
while (gr_status.next()) {
var lastWeek = gr_status.getDisplayValue("achievements_last_week") ? gr_status.getDisplayValue("achievements_last_week").replace(/<\/?[^>]+(>|$)/g, "").replace(/&/g, '&').replace(/'/g, "'").replace(/`/g, "`").replace(/@/g, "@").replace(/+/g, "+").replace(/=/g, "=").replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">") : gr_status.getDisplayValue("achievements_last_week"); //display alpha numeric character
obj.achievements_last_week = lastWeek;
var nextWeek = gr_status.getDisplayValue("key_activities_next_week") ? gr_status.getDisplayValue("key_activities_next_week").replace(/<\/?[^>]+(>|$)/g, "").replace(/&/g, '&').replace(/'/g, "'").replace(/`/g, "`").replace(/@/g, "@").replace(/+/g, "+").replace(/=/g, "=").replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">") : gr_status.getDisplayValue("key_activities_next_week"); //display alpha numeric character
obj.key_activities_next_week = nextWeek;
}
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
}
}
)();
And then the HTML is back to how it was originally...and the screen shot shows the result. To me, the code works fine...the HTML is just pesky and not sure what the heck is needed to get these to move to another line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 01:22 PM
Hi,
I am not sure if you tried to change the server side as below along with HTML ?
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
}
And on HTML Side.
<tr>
<td>
<div class="label-column">
<h5>${Risks}</h5>
</div>
</td>
<td>
<div class="label-column">
<h5>${Mitigation Strategy}</h5>
</div>
</td>
</tr>
<tr ng-repeat="projects in c.data.project_value">
<td>
{{projects.risk_description}}<br/>
</td>
<td>
{{projects.risk_mitigation}}<br/>
</td>
</tr>