1142c3182990062fd73c087d378bc56deb2acbf3
[portal/sdk.git] /
1 import {
2     AfterViewInit,
3     ChangeDetectionStrategy,
4     ChangeDetectorRef,
5     Component,
6     ElementRef,
7     Input,
8     OnInit,
9     SimpleChanges,
10     ViewChild
11 } from '@angular/core';
12 import { MatPaginator } from '@angular/material/paginator';
13 import { MatSort } from '@angular/material/sort';
14 import { MatTableDataSource } from '@angular/material/table';
15 import { ActivatedRoute, Router } from '@angular/router';
16 import { HttpClient } from '@angular/common/http';
17 import { environment } from '../../../../../../../environments/environment';
18 import { RunService } from '../run.service';
19 import { GridsterConfig, GridsterItem, GridType } from 'angular-gridster2';
20 import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
21 import { DisplayHtml } from '../../display-html';
22 import { FormControl } from '@angular/forms';
23 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
24 import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
25
26 export interface PeriodicElement {
27
28 }
29
30 const ELEMENT_DATA: PeriodicElement[] = [{}];
31
32 @Component({
33     selector: 'app-run-report',
34     templateUrl: './run-report.component.html',
35     styleUrls: ['./run-report.component.css'],
36     changeDetection: ChangeDetectionStrategy.OnPush
37 })
38 export class RunReportComponent implements OnInit, AfterViewInit {
39     @Input('reportId') inputReportId: string;
40     @Input('reportMode') reportMode: string;
41     @Input('queryString') queryString: string;
42     @Input('DashboardReportObj') DashboardReportObj: Array<GridsterItem>;
43     @Input('TriggerFFArr') TriggerFFArr: string[];
44     @Input('hitCnt') hitCnt: number;
45     @Input('runAgain') runAgain: string;
46     @Input('groupSelectValue') groupSelectValue: string;
47     @Input('chartType') chartType: string;
48     @ViewChild('iframe') iframe: ElementRef;
49     @ViewChild(MatPaginator, { static: false } as any) paginator: MatPaginator;
50     @ViewChild(MatSort, { static: false } as any) sort: MatSort;
51     dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
52     displayedColumns: string[];
53     IncomingReportId: string;
54     displayedColumnsArr: string[];
55     displayedRowObj: PeriodicElement[];
56     formFieldPresent: boolean;
57     showSpinner: boolean;
58     formFieldList: {}[];
59     isReady: boolean;
60     responseFormFieldListLength: number;
61     NEWdisplayedColumns: string[];
62     initCnt: number;
63     reportName: string;
64     showDashboardReport: boolean;
65     checkCnt: number;
66     options: GridsterConfig;
67     dashboard: Array<GridsterItem> = [];
68     openOptionsFlag: boolean;
69     showMoreVert: boolean;
70     errorMessage = '';
71     stackTrace = '';
72     error = false;
73     environment: any;
74     initialQueryString: string;
75     initCounter: number;
76     runButtonHitCnt: number;
77     chartRunUrl: string;
78     url: SafeResourceUrl;
79     replaceDisplayValue: String;
80     nodeName: string;
81     uploadId: string;
82     ecgi: string;
83     lac: string;
84     cid: string;
85     displayTotal: any[];
86     totalRecords: number;
87     pageSize: number;
88     download_in_progress: boolean;
89     commentCtrl = new FormControl('');
90     isChartAvailable = false;
91     timeTaken = '...';
92     saveResponseObj: any;
93     showBackButton = false;
94
95     constructor(private _http: HttpClient,
96         private _route: ActivatedRoute,
97         private _runService: RunService,
98         private _router: Router,
99         private changeDetectorRefs: ChangeDetectorRef,
100         public sanitizer: DomSanitizer) {
101         this.displayedColumnsArr = [];
102         this.displayedRowObj = [];
103         this.displayedColumns = [];
104         this.formFieldList = [];
105         this.showSpinner = true;
106         this.isReady = false;
107         this.NEWdisplayedColumns = [];
108         this.initCnt = 0;
109         this.checkCnt = 0;
110         this.showDashboardReport = false;
111         this.openOptionsFlag = false;
112         this.showMoreVert = false;
113         this.environment = environment;
114         this.initCounter = 0;
115         this.runButtonHitCnt = 0;
116         this.displayTotal = [];
117         this.totalRecords = 0;
118         this.pageSize = 0;
119         this.download_in_progress = false;
120
121     }
122
123     ngOnChanges(changes: SimpleChanges) {
124         if (this.reportMode !== 'Regular' && this.initCnt > 0 && changes['runAgain']) {
125             this.showMoreVert = false;
126             if (changes['queryString']) {
127                 this.queryString = changes['queryString']['currentValue'];
128             }
129             if (this.queryString !== this.initialQueryString) {
130                 this.initCnt = 1;
131                 this.showDashboardReport = false;
132                 this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
133                 this.displayedColumnsArr = [];
134                 this.displayedRowObj = [];
135                 this.displayedColumns = [];
136                 this.formFieldList = [];
137                 this.showSpinner = true;
138                 this.isReady = false;
139                 this.NEWdisplayedColumns = [];
140                 this.displayTotal = [];
141                 this.isChartAvailable = false;
142                 this.timeTaken = '...';
143                 const startDate: Date = new Date();
144                 const startTime = startDate.getTime();
145                 this._runService.getReportDataWithFormFields(this.queryString, this.inputReportId)
146                     .subscribe((response) => {
147                         if (response['errormessage']) {
148                             this.showError(response);
149                             this.changeDetectorRefs.detectChanges();
150                         } else {
151                             this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
152                                 this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0';
153                             if (this.reportMode !== 'FormField') {
154                                 this.postFetchingReportDataFn(response, false);
155                                 const endDate: Date = new Date();
156                                 const endTime = endDate.getTime();
157                                 this.timeTaken = ((endTime - startTime) / 1000).toString();
158                                 this.showMoreVert = true;
159                                 this.showDashboardReport = true;
160                                 this.errorMessage = '';
161                                 this.error = false;
162                             } else {
163                                 this.postFetchingReportDataFn(response, false);
164                                 const endDate: Date = new Date();
165                                 const endTime = endDate.getTime();
166                                 this.timeTaken = ((endTime - startTime) / 1000).toString();
167                                 this.showMoreVert = true;
168                                 this.errorMessage = '';
169                                 this.error = false;
170                             }
171                         }
172                     });
173             }
174         } else {
175         }
176         if (this.initialQueryString !== this.queryString && this.initCounter > 0 && this.hitCnt !== this.runButtonHitCnt) {
177             this.runButtonHitCnt = this.hitCnt;
178             this.initialQueryString = this.queryString;
179             this.initialProcesses();
180         } else {
181             this.runButtonHitCnt = this.hitCnt;
182         }
183
184     }
185
186     ngOnInit() {
187         this.dataSource.paginator = this.paginator;
188         this.dataSource.sort = this.sort;
189         this.dataSource.data = this.displayedRowObj;
190         this.initialProcesses();
191         this.errorMessage = '';
192         this.error = false;
193     }
194
195     initialProcesses() {
196         if (this.DashboardReportObj.length > 0) {
197             this.dashboard = this.DashboardReportObj;
198             this.options = {
199                 gridType: GridType.ScrollVertical,
200                 margin: 10,
201                 outerMargin: true,
202                 outerMarginTop: 10,
203                 outerMarginRight: 10,
204                 outerMarginBottom: 5000,
205                 outerMarginLeft: 10,
206                 scrollSensitivity: 10,
207                 scrollSpeed: 20,
208                 emptyCellDragMaxCols: null,
209                 emptyCellDragMaxRows: null,
210                 ignoreContentClass: 'gridster-item-content',
211                 enableOccupiedCellDrop: true,
212                 ignoreMarginInRow: false,
213                 draggable: {
214                     enabled: true,
215                 },
216                 resizable: {
217                     enabled: true,
218                 },
219                 swap: true,
220                 pushItems: true,
221                 disablePushOnDrag: false,
222                 disablePushOnResize: false,
223                 pushDirections: { north: true, east: true, south: true, west: true },
224                 pushResizeItems: true,
225                 disableWindowResize: true,
226                 disableWarnings: false,
227                 scrollToNewItems: true,
228                 enableDropToAdd: true,
229                 enableEmptyCellDrop: true,
230                 minCols: 2,
231                 minRows: 2,
232             };
233             this._runService.getDashboardReportFormFields(this.inputReportId)
234             .subscribe((dashboardFormFields) => {
235                 this.download_in_progress = true;
236                 this._runService.runDashboardReport(this.inputReportId, this.queryString)
237                     .subscribe((runDashboardReportResp) => {
238                     });
239                 this.download_in_progress = false;
240             });
241
242
243             this.showDashboardReport = true;
244
245         }
246         this.hitCnt = this.runButtonHitCnt;
247         this.initialQueryString = this.queryString;
248         this.initCounter++;
249     }
250
251     ngAfterViewInit() {
252         this.afterViewInitialProcesses();
253     }
254
255     afterViewInitialProcesses() {
256         if (sessionStorage.length > 0) {
257             this.showBackButton = true;
258         } else {
259             this.showBackButton = false;
260         }
261         if (this.DashboardReportObj.length === 0) {
262             if (this.reportMode === 'Regular' && this.initCnt == 0) {
263                 this.showMoreVert = false;
264                 this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
265                 this.displayedColumnsArr = [];
266                 this.displayedRowObj = [];
267                 this.displayedColumns = [];
268                 this.formFieldList = [];
269                 this.showSpinner = true;
270                 this.isReady = false;
271                 this.NEWdisplayedColumns = [];
272                 this.timeTaken = '...';
273                 const startDate: Date = new Date();
274                 const startTime = startDate.getTime();
275                 this._runService.getReportData(this.inputReportId)
276                     .subscribe((response) => {
277                         if (response['errormessage']) {
278                             this.showError(response);
279                             this.changeDetectorRefs.detectChanges();
280                         } else {
281                             this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
282                                 this.inputReportId + '&refresh=Y&display_content=Y&r_page=0';
283                             this.postFetchingReportDataFn(response, false);
284                             const endDate: Date = new Date();
285                             const endTime = endDate.getTime();
286                             this.timeTaken = ((endTime - startTime) / 1000).toString();
287                             this.showMoreVert = true;
288                         }
289                     });
290             } else {
291                 this.showMoreVert = false;
292                 this.dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
293                 this.displayedColumnsArr = [];
294                 this.displayedRowObj = [];
295                 this.displayedColumns = [];
296                 this.formFieldList = [];
297                 this.showSpinner = true;
298                 this.isReady = false;
299                 this.NEWdisplayedColumns = [];
300                 this.timeTaken = '...';
301                 const startDate: Date = new Date();
302                 const startTime = startDate.getTime();
303                 if (localStorage.getItem(this.inputReportId)) {
304                     this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
305                         this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0';
306                     this.postFetchingReportDataFn(JSON.parse(localStorage.getItem(this.inputReportId)), false);
307                     this.saveResponseObj = JSON.parse(localStorage.getItem(this.inputReportId));
308                     const endDate: Date = new Date();
309                     const endTime = endDate.getTime();
310                     this.timeTaken = ((endTime - startTime) / 1000).toString();
311                     this.showMoreVert = true;
312                     localStorage.removeItem(this.inputReportId);
313                 } else {
314                     this._runService.getReportDataWithFormFields(this.queryString, this.inputReportId)
315                         .subscribe((response) => {
316                             if (response['errormessage']) {
317                                 this.showError(response);
318                                 this.changeDetectorRefs.detectChanges();
319                             } else {
320                                 this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
321                                     this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=0';
322                                 this.saveResponseObj = response;
323                                 this.postFetchingReportDataFn(response, false);
324                                 const endDate: Date = new Date();
325                                 const endTime = endDate.getTime();
326                                 this.timeTaken = ((endTime - startTime) / 1000).toString();
327                                 this.showMoreVert = true;
328                             }
329                         });
330                 }
331             }
332         } else {
333             this.showMoreVert = true;
334             this.showSpinner = false;
335         }
336         this.errorMessage = '';
337         this.error = false;
338         this.initCnt = 1;
339     }
340
341     showError(Errresponse: any) {
342         this.errorMessage = Errresponse['errormessage'];
343         this.stackTrace = Errresponse['stacktrace'];
344         this.error = true;
345         this.showSpinner = false;
346         this.isChartAvailable = false;
347     }
348
349     postFetchingReportDataFn(response: any, isPageChange: boolean) {
350         this.pageSize = 0;
351         this.totalRecords = 0;
352         this.displayedColumnsArr = [];
353         this.displayedColumns = [];
354         this.formFieldPresent = false;
355         this.responseFormFieldListLength = 0;
356         this.reportName = response['reportName'];
357         let rdc_cntr = 0;
358         while (response['reportDataColumns'][rdc_cntr]) {
359             const columnTitle = response['reportDataColumns'][rdc_cntr]['columnTitle'];
360             const columnId = response['reportDataColumns'][rdc_cntr]['colId'];
361             this.displayedColumnsArr.push(columnTitle + ',' + columnId);
362             rdc_cntr++;
363         }
364
365         if (response['chartWizardAvailable'] === true && this.chartType !== 'none') {
366             this.isChartAvailable = true;
367             this.iframe.nativeElement.setAttribute('src', this.chartRunUrl);
368         }
369
370         let totalCnt = 0;
371         while (response['reportTotalDataRows'][totalCnt]) {
372             this.displayTotal.push(response['reportTotalDataRows'][totalCnt]);
373             totalCnt++;
374         }
375
376         let rdr_cntr = 0;
377         while (response['reportDataRows'][rdr_cntr]) {
378             let dca_cntr = 0;
379             const obj = {};
380             const reportDataRows = response['reportDataRows'][rdr_cntr];
381             while (this.displayedColumnsArr[dca_cntr]) {
382                 const rowColumnId = this.displayedColumnsArr[dca_cntr].split(',')[1];
383                 if (reportDataRows[rowColumnId]) {
384                     let drillDownHtml = '';
385                     let displayValue = '';
386                     drillDownHtml = reportDataRows[rowColumnId]['drillDownURL'];
387                     displayValue = reportDataRows[rowColumnId]['displayValue'];
388                     if (drillDownHtml !== null &&
389                         drillDownHtml.length > 0 &&
390                         !displayValue.includes('linkToReport')) {
391                         const value = this.convertToLinkToReport(drillDownHtml);
392                         if (value.length > 0) {
393                             this.replaceDisplayValue = value + ',' +
394                                 reportDataRows[rowColumnId]['displayValue'];
395                         } else {
396                             this.replaceDisplayValue = reportDataRows[rowColumnId]['displayValue'];
397                         }
398                     } else {
399                         this.replaceDisplayValue = reportDataRows[rowColumnId]['displayValue'];
400                     }
401                     let displayObj: DisplayHtml = new class implements DisplayHtml {
402                         'background-color': string;
403                         'font-family': string;
404                         'font-size': string;
405                         'font-style': string;
406                         'font-weight': string;
407                         'text-align': string;
408                         'text-decoration': string;
409                         color: string;
410                     };
411                     if (reportDataRows[rowColumnId]['displayValueHtml'].includes('{')) {
412                         displayObj = JSON.parse(reportDataRows[rowColumnId]['displayValueHtml']);
413                     }
414                     displayObj['text-align'] = reportDataRows[rowColumnId]['alignment'];
415                     if (this.replaceDisplayValue.includes('linkToReport') || this.replaceDisplayValue.includes('linkToFeedback') || this.replaceDisplayValue.includes('linkToMail')) {
416                         obj[reportDataRows[rowColumnId]['colId']] = this.replaceDisplayValue.split(',').join('|')
417                             + '|' + JSON.stringify(displayObj);
418                     } else {
419                         obj[reportDataRows[rowColumnId]['colId']] = this.replaceDisplayValue
420                             + '|' + JSON.stringify(displayObj);
421                     }
422                 }
423                 dca_cntr++;
424             }
425             this.displayedRowObj.push(obj);
426             rdr_cntr++;
427         }
428         this.pageSize = response['pageSize'];
429         for (let cntr = 0; cntr < this.displayedColumnsArr.length; cntr++) {
430             const columnArrId = this.displayedColumnsArr[cntr].split(',')[1];
431             this.displayedColumns.push(columnArrId);
432         }
433         this.totalRecords = 0;
434         this.totalRecords = response['totalRows'];
435         this.showSpinner = false;
436         if (!isPageChange) {
437             this.paginator.length = this.totalRecords;
438             this.paginator.pageSize = this.pageSize;
439             this.paginator.pageIndex = 0;
440         }
441         this.dataSource.data = this.displayedRowObj;
442         this.dataSource.sort = this.sort;
443
444     }
445
446     linkToReport(reportID: string, queryParameters: string) {
447         localStorage.setItem(this.inputReportId, JSON.stringify(this.saveResponseObj));
448         if (sessionStorage.length === 0) {
449             sessionStorage.setItem('1', this.inputReportId + '|' + this.queryString);
450         } else {
451             let length = sessionStorage.length;
452             length++;
453             sessionStorage.setItem(length.toString(), this.inputReportId + '|' + this.queryString);
454         }
455         this._router.navigate(['v2/app/run', reportID, queryParameters]);
456     }
457
458
459
460     linkToMail(mailId: string) {
461         const email = 'mailto:' + mailId;
462         window.location.href = email;
463     }
464
465     openOptions() {
466         this.openOptionsFlag = !this.openOptionsFlag;
467     }
468
469     downloadReport(contentType: string, extension: string) {
470
471         if (this.showDashboardReport === false) {
472             this.download_in_progress = true;
473             this._runService.downloadReport(this.inputReportId, extension)
474                 .subscribe((responseExcel) => {
475
476                     this.downLoadFile(responseExcel, contentType, extension, '');
477                     this.download_in_progress = false;
478                 });
479         } else {
480             this._runService.getDashboardReportFormFields(this.inputReportId)
481                 .subscribe((dashboardFormFields) => {
482                     this.download_in_progress = true;
483                     this._runService.runDashboardReport(this.inputReportId, this.queryString)
484                         .subscribe((runDashboardReportResp) => {
485                             this._runService.downloadDashboardReportExcel(this.inputReportId)
486                                 .subscribe((responseDownloadDashboardReport) => {
487                                     this.downLoadFile(responseDownloadDashboardReport, contentType, extension, 'Dashboard');
488                                 });
489                         });
490                     this.download_in_progress = false;
491                 });
492         }
493     }
494
495     downloadSinglePage(contentType: string, extension: string) {
496         this.download_in_progress = true;
497         this._runService.downloadSinglePageReport(this.inputReportId, extension)
498             .subscribe((responseExcel) => {
499
500                 this.downLoadFile(responseExcel, contentType, extension, '');
501                 this.download_in_progress = false;
502             });
503     }
504
505     downLoadFile(data: any, type: string, extension: string, reportType: string) {
506         const blob = new Blob([data], { type: type });
507         const date = new Date();
508         const dateStr =
509             ('00' + (date.getMonth() + 1)).slice(-2) +
510             ('00' + date.getDate()).slice(-2) +
511             date.getFullYear() +
512             ('00' + date.getHours()).slice(-2) +
513             ('00' + date.getMinutes()).slice(-2) +
514             ('00' + date.getMilliseconds());
515         let fileName = this.reportName + dateStr + '.' + extension;
516         if (reportType === 'Dashboard') {
517             fileName = '';
518             fileName = reportType + '_' + this.inputReportId + '_' + dateStr + '.' + extension;
519         }
520         if (window.navigator.msSaveOrOpenBlob) {
521             window.navigator.msSaveBlob(blob, fileName);
522         } else {
523             const anchor = window.document.createElement('a');
524             anchor.href = window.URL.createObjectURL(blob);
525             anchor.download = fileName;
526             document.body.appendChild(anchor);
527             anchor.click();
528             document.body.removeChild(anchor);
529             window.URL.revokeObjectURL(anchor.href);
530         }
531     }
532
533     applyFilter(filterValue: string) {
534         this.dataSource.data = this.displayedRowObj;
535         this.dataSource.sort = this.sort;
536         if (filterValue === '' || filterValue === null) {
537         } else {
538             this.dataSource.filter = filterValue.trim().toLowerCase();
539         }
540     }
541
542     setStyle(rowData: string) {
543         let styles = '';
544         if (rowData.split('|')[0] === 'linkToReport') {
545             styles = rowData.split('|')[4];
546         } else if (rowData.split('|')[0] === 'linkToMail') {
547             styles = rowData.split('|')[3];
548         } else {
549             styles = rowData.split('|')[1];
550         }
551         if (styles.includes('{')) {
552             return JSON.parse(styles);
553         } else {
554             return {};
555         }
556     }
557
558     
559
560     getDisplayTotal(keys: string) {
561         if (this.displayTotal.length > 0) {
562             return this.displayTotal[0][keys].displayValue;
563         } else {
564             return '';
565         }
566     }
567
568     onPaginationChange(event: any) {
569         if (this.DashboardReportObj.length === 0) {
570             if (this.reportMode === 'Regular' && this.initCnt === 0) {
571                 this.showMoreVert = false;
572                 this.displayedColumnsArr = [];
573                 this.displayedRowObj = [];
574                 this.displayedColumns = [];
575                 this.formFieldList = [];
576                 this.showSpinner = true;
577                 this.isReady = false;
578                 this.NEWdisplayedColumns = [];
579                 this.isChartAvailable = false;
580                 this.timeTaken = '...';
581                 const startDate: Date = new Date();
582                 const startTime = startDate.getTime();
583                 this._runService.getReportDataWithPageNo(this.inputReportId, event.pagenum)
584                     .subscribe((response) => {
585                         if (response['errormessage']) {
586                             this.showError(response);
587                             this.changeDetectorRefs.detectChanges();
588                         } else {
589                             const endDate: Date = new Date();
590                             const endTime = endDate.getTime();
591                             this.timeTaken = ((endTime - startTime) / 1000).toString();
592                             this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
593                                 this.inputReportId + '&refresh=Y&display_content=Y&r_page=' + event.pagenum;
594                             this.postFetchingReportDataFn(response, true);
595                             this.showMoreVert = true;
596                         }
597                     });
598             } else {
599                 this.showMoreVert = false;
600                 this.displayedColumnsArr = [];
601                 this.displayedRowObj = [];
602                 this.displayedColumns = [];
603                 this.formFieldList = [];
604                 this.showSpinner = true;
605                 this.isReady = false;
606                 this.NEWdisplayedColumns = [];
607                 this.isChartAvailable = false;
608                 this.timeTaken = '...';
609                 const startDate: Date = new Date();
610                 const startTime = startDate.getTime();
611                 this._runService.getReportDataWithFormFieldsWithPageNo(this.queryString, this.inputReportId, event.pageIndex)
612                     .subscribe((response) => {
613                         if (response['errormessage']) {
614                             this.showError(response);
615                             this.changeDetectorRefs.detectChanges();
616                         } else {
617                             const endDate: Date = new Date();
618                             const endTime = endDate.getTime();
619                             this.timeTaken = ((endTime - startTime) / 1000).toString();
620                             this.chartRunUrl = environment.baseUrl + 'raptor.htm?action=chart.run&c_master=' +
621                                 this.inputReportId + this.queryString + '&refresh=Y&display_content=Y&r_page=' + event.pagenum;
622                             this.postFetchingReportDataFn(response, true);
623                             this.showMoreVert = true;
624                         }
625                     });
626             }
627         } else {
628             this.showMoreVert = true;
629             this.showSpinner = false;
630         }
631         this.errorMessage = '';
632         this.error = false;
633         this.initCnt = 1;
634     }
635
636     convertToLinkToReport(value: string) {
637         value = value.replace(/;/g, '');
638         let outPut = '';
639         while (value.includes('c_master=')) {
640             const index = value.indexOf('c_master=');
641             if (index > 0) {
642                 value = value.substring(index, value.length);
643             } else if (index === 0) {
644                 value = value.replace('c_master=', '');
645             }
646         }
647         const split = value.split('&');
648         if (split[1].length <= 0) {
649             return outPut;
650         }
651         outPut = 'linkToReport,' + split[0] + ',';
652         let splitCounter = 1;
653         for (splitCounter = 1; splitCounter < split.length; splitCounter++) {
654             if (!split[splitCounter].includes('LOGIN_ID=') &&
655                 !split[splitCounter].includes('display_content=') &&
656                 !split[splitCounter].includes('drilldown_index=') &&
657                 !split[splitCounter].includes('show_back_btn=') &&
658                 !split[splitCounter].includes('r_action')) {
659                 outPut = outPut + '&' + split[splitCounter];
660             }
661         }
662         return outPut;
663     }
664
665     takeToReport(queryString: string, reportID: string) {
666         this._router.navigate(['v2/app/run', reportID, queryString, this.groupSelectValue]);
667     }
668
669     goBack() {
670         const length = sessionStorage.length;
671         let repId = '';
672         let queryString = '';
673         if (length > 1) {
674             let split = [];
675             split = sessionStorage.getItem((length).toString()).split('|');
676             repId = split[0];
677             queryString = split[1];
678             sessionStorage.removeItem((length).toString());
679         } else if (length === 1) {
680             let split = [];
681             split = sessionStorage.getItem('1').split('|');
682             repId = split[0];
683             queryString = split[1];
684             sessionStorage.removeItem('1');
685         }
686         localStorage.removeItem(this.inputReportId);
687         this._router.navigate(['v2/app/run', repId, queryString]);
688     }
689
690 }