Thursday, January 08, 2009 ..:: Forums ::.. Register  Login
 Forums Minimize
SearchForum Home
     
  Mainstream Forums  General Discussion  Customize Repor...
 Customize Report
 
sarah
47 posts
Joined
9/14/2007

Customize Report
Posted: 16 Sep 07 7:24 AM
Hi, I've created a custom report for the tasks assigned to a specific user...

Now I would like to create the same report for all users of the CRM.....for allow each user to see specific task (assigned to the user that is logged)

How Can I "duplicate" my first report without recreate XX reports with the same columns but different "assigned to" users?
How Can I link each report create for each report .... each user can view only the report with "assigned to user logged" filter

Thanks
support
2240 posts
1st
Joined
1/3/2006

Re: Customize Report
Posted: 16 Sep 07 9:29 AM

It would seem that the missing Duplicate link is a minor oversight.  You can add the following to the grdMySaved grid. 

<asp:HyperLink NavigateUrl='<%# "edit.aspx?DuplicateID=" + Eval("ID") %>' Text='<%# L10n.Term(".LBL_DUPLICATE_BUTTON_LABEL") %>' CssClass="listViewTdToolsS1" Runat="server" />

If you are unable to edit the code, you can also manually edit the URL, changing the ID to DuplicateID.  For example, after clicking on the edit link, the web browser address bar would look like http://localhost/SplendidCRM/Reports/edit.aspx?id=00000-0000-0000-0000000.  Change it to http://localhost/SplendidCRM/Reports/edit.aspx?DuplicateID=00000-0000-0000-0000000 and when you save, a new report will be created.  This DuplicateID tip works across all modules of SplendidCRM, but most modules provide a Duplicate button in their detail view.

On a similar note, we probably should allow you to select the "Current User" as one of the Assigned To.  This is not easy to do, but it sounds very useful.

Also, it may be useful to note that the Role Management already gives you the ability to restrict records to only those that the logged-in user owns.

 

 

dutchinusa
51 posts
Joined
5/24/2006

Re: Customize Report
Posted: 17 Sep 07 11:38 AM

I set this up a few months ago.  I will try to show how I did this but I am still on version 1.2 and have made quite a few edits to the Reports.EditView so my line numbers will mean nothing. 

Change Reports.EditView Method lblFILTER_OPERATOR_BIND as follows (The two lines that are bold are the lines that I added): 

private void lblFILTER_OPERATOR_Bind()

{

lstFILTER_OPERATOR.DataSource = null;

lstFILTER_OPERATOR.Items.Clear();

string[] arrModule = lstFILTER_COLUMN_SOURCE.SelectedValue.Split(' ');

string sModule = arrModule[0];

string sTableAlias = arrModule[1];

string[] arrColumn = lstFILTER_COLUMN.SelectedValue.Split('.');

string sColumnName = arrColumn[0];

if ( arrColumn.Length > 1 )

sColumnName = arrColumn[1];

string sMODULE_TABLE = Sql.ToString(Application["Modules." + sModule + ".TableName"]);

DataView vwColumns = new DataView(SplendidCache.ReportingFilterColumns(sMODULE_TABLE).Copy());

vwColumns.RowFilter = "ColumnName = '" + sColumnName + "'";

if ( vwColumns.Count > 0 )

{

DataRowView row = vwColumns[0];

string sCsType = Sql.ToString(row["CsType"]);

lblFILTER_OPERATOR_TYPE.Text = sCsType.ToLower();

txtFILTER_SEARCH_DATA_TYPE.Value = sCsType.ToLower();

lstFILTER_OPERATOR.DataSource = SplendidCache.List(sCsType.ToLower() + "_operator_dom");

lstFILTER_OPERATOR.DataBind();

if(lstFILTER_COLUMN.SelectedItem.Text.ToUpper() == "Assigned To".ToUpper()) // 06-13-07 Matt Holden - Added Custom Operator to filter by user logged in.

lstFILTER_OPERATOR.Items.Add(new ListItem("Logged In User", "current_user"));

lblFILTER_OPERATOR.Text = lstFILTER_OPERATOR.SelectedValue;

}

BindSearchText();

}

THEN you need to adjust BuildReportSql to handle this new type of filter. 

you should be able to search for the following text within BuildReportSql:

foreach ( XmlNode xFilter in xmlFilters.DocumentElement )

within this control structure, get to switch statement sDATA_TYPE > case "string" > switch sOPERATOR > and add this as the last case statement for this switch:

case "current_user":

{

//assumption that table/view specified in sDATA_FIELD has the column ASSIGNED_USER_ID available wherever the ASSIGNED_TO field is found.

string sDATA_FIELD_ADJUSTED = sDATA_FIELD.Substring(0, sDATA_FIELD.IndexOf(".")) + ".ASSIGNED_USER_ID";

sb.Append(" and " + sDATA_FIELD_ADJUSTED + " = " + sPARAMETER_NAME + ControlChars.CrLf);

rdl.AddQueryParameter(xQueryParameters, sPARAMETER_NAME, "Guid", Security.USER_ID.ToString());

break;

}

Hope that helps.  If someone knows of a better way, please let me know. 

dutchinusa
51 posts
Joined
5/24/2006

Re: Customize Report
Posted: 17 Sep 07 12:20 PM

I believe that I lift this edit out. 

You must edit the file RdlUtil.cs method public void AddQueryParameter(XmlNode xQueryParameters, string sPARAMETER_NAME, string sDATA_TYPE, string sVALUE) to (again bold line is the edit):

public void AddQueryParameter(XmlNode xQueryParameters, string sPARAMETER_NAME, string sDATA_TYPE, string sVALUE)

{

XmlNode xQueryParameter = this.CreateElement("QueryParameter", sDefaultNamespace);

xQueryParameters.AppendChild(xQueryParameter);

SetSingleNodeAttribute(xQueryParameter, "Name", sPARAMETER_NAME);

if ( sDATA_TYPE == "string" || sDATA_TYPE == "enum" || sDATA_TYPE.ToLower() == "guid")

SetSingleNode(xQueryParameter, "Value", "=\"" + sVALUE.Replace("\"", "\\\"") + "\"");

else

SetSingleNode(xQueryParameter, "Value", "=" + sVALUE);

}

  Mainstream Forums  General Discussion  Customize Repor...

Forum Home  Search       

Copyright (c) 2006-2008 SplendidCRM Software, Inc. All Rights Reserved.   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2009 by Perpetual Motion Interactive Systems Inc.