.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

error when using the sum function

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :Sql Server


I am using SSRS 2005 and when I use the following expression it works perfectly at the group footer level but not at the page footer level. 

=Sum((iif(Fields!Freight.Value = "PREPAID", Fields!C_Cost_FrtPpd.Value,Fields!C_Cost.Value)))

The error is:

[rsAggregateOfMixedDataTypes] The Value expression for the textbox textbox55 uses an aggregate function on data of varying data types. Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type.

Preview complete -- 0 errors, 1 warnings

I have tried the CDbl, CDec, and CInt to try to convert the data but I am just not sure which part of the expression is incorrect.  But it works perfectly at the group footer level.

=Sum((iif(Fields!Freight.Value = "PREPAID", CDbl(Fields!C_Cost_FrtPpd.Value),CDbl(Fields!C_Cost.Value))))


What am I missing?  Any help would be appriceiated.

Thank you

View Complete Post

More Related Resource Links

ERROR [S1000] [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).


I Am Continiously Getting Error For Following Line Of Code, It Work  Fine In Other Database

Am I Doing Any Mistake

if (sh3itno != "" && dpsh3no != "")
                string queryy = "SELECT [CHEQNO] FROM [SH3MAST] WHERE (([CHEQDATE] = " + chqdate + ") AND ([FAVOUR] = " + favour + ") AND ([CHQTYPE] = " + ctype + ") AND ([TRSTN] = " + trstn + ") AND ([TRBANK] = " + trbank + ") AND ([SH3ITNO] = " + sh3itno + ") AND ([DPSH3NO] = " + dpsh3no + "))";
                OdbcCommand cmd3 = new OdbcCommand(queryy, connen1);
                string chqno =cmd3.ExecuteScalar().ToString(); (Here Iam Getting Error)
                tbl.Rows[i]["cheque no"] = chqno;
Stack Trace: 

[OdbcException (0x80131937): ERROR [S1000] [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).]
   System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) +39
   System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, Strin

Error "The process cannot access the file ....." occurs while using function "ExportToStream"


Dear all,

   I sometimes get the following error while printing crystal report to pdf:

   System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because
it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export
(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream
(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
 at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at
 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at
 CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382

  The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?

Thank you very much.


Cross Join and error Two sets specified in the function have different dimensionality.

WITH   SET   [InternetSET] AS {   CROSSJOIN ([APM Channel].[APM Channel Desc].&[Interactive] , {        [APM SubChannel].[APM Sub Channel Desc].&[Affiliates]       ,[APM SubChannel].[APM Sub Channel Desc].&[Partner]       ,[APM SubChannel].[APM Sub Channel Desc].&[Unreferred]       ,[APM SubChannel].[APM Sub Channel Desc].&[SMS]       ,[APM SubChannel].[APM Sub Channel Desc].&[Search]       ,[APM SubChannel].[APM Sub Channel Desc].&[Media]       ,[APM SubChannel].[APM Sub Channel Desc].&[E-mails] } ) }   SET   [Top1SET] AS {   TOPCOUNT([InternetSET],1,[Measures].[% Approve]) } MEMBER   [Top1]   AS   SUM([Top1SET],[Approved Apps]) / SUM([Top1SET],[Basic Apps]), Format_String='0.00%'   MEMBER   [Internet]   AS SUM([InternetSET],[Approved Apps]) / SUM([InternetSET],[Basic Apps]), Format_String='0.00%' select { // if I use the set below instead of the member below it I get // error : Two sets specified in the function have different dimensionality [Top1set] // if I use the member below instead of the set above the query works // but the name of the item is not dis

SharePoint Farm Backup Error in Search instance function

I'm working with MS Project Server 2007 with SharePoint WSS. When doing a full farm backup in SharePoint Central Admin > Operations > Backup and Restore > Perform a Backup, I encountered 2 errors in "SharePoint Windows Services Search, Search instance". 1) Error: Object a8b2cbfe-ef8b-45ce-92a0-c5675f534ec0 failed in event OnBackup. For more information, see the error log located in the backup directory.  InvalidOperationException: System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.SharePoint.Search.Administration.SPSearchBackupRestoreTimerJob.Execute(Guid targetInstanceId)   2) Error: Object a8b2cbfe-ef8b-45ce-92a0-c5675f534ec0 failed in event OnBackupComplete. For more information, see the error log located in the backup directory.  Object a8b2cbfe-ef8b-45ce-92a0-c5675f534ec0 failed in event OnBackup. For more information, see the error log located in the backup directory.  InvalidOperationException: System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.SharePoint.Search.Administration.SPSearchBackupRestoreTimerJob.Execute(Guid targetInstanceId)  InvalidOperationException: System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.SharePoint.Search.Administ

How to : Generic error handling function. Passing GridViewUpdatedEventArgs as EventArgs

Hi, I want to build a generic error handling function for handling inseted, updated, deleted events from formview, gridview and detail view. I am still a bit new to C# so I have encoutered a simple problem that I cannot resolve and cannot find an answer while searching google.Right now I handle error with validator for generic validation but I need to catch BLL error.I have different event handler for the different type of event : protected void FormView_AjoutCompte_ItemInserted(object sender, FormViewInsertedEventArgs e) { if (e.Exception != null) { Afficher_Erreur(e.Exception); e.ExceptionHandled = true; } } protected void GridView_ListeUtilisateurs_RowUpdated(object sender, GridViewUpdatedEventArgs e) { if (e.Exception != null) { Afficher_Erreur(e.Exception); e.ExceptionHandled = true; } } protected void GridView_ListeUtilisateurs_RowDeleted(object sender, GridViewDeletedEventArgs e) { if (e.Exception != null) { Afficher_Erreur(e.Exception); e.ExceptionHandled = true; } } I want to create a generic function that will handle them all, a function such as : private void GestionDerreur(EventArgs e) { if (e.Exception != null) { Afficher_Erreur(e.Exception); e.Exc

Modifying Customizing EditForm.aspx of Doc lib breaks Upload function - Unknown Error

Part of a bigger design issue really. But does anybody know why customizing EditForm.aspx of a Doc lib breaks the Upload function? and how to fix it so it does not. My version of the editform works great, but after an upload I get Unknown Error the resulting url looks like this: https://xxxxx.edu/sites/xxxx/_layouts/Upload.aspx?List=%7b0404432B-91A3-4E18-9202-5954E3A7E0D2%7d&RootFolder=%2fsites%2fmcpharm%2ftest3&Source=https%3a%2f%2fxxxxx.edu%2fsites%2fmcpharm%2ftest3%2fForms%2fAllItems.aspx --- The bigger design issue - disregard if you like: That said, the bigger design issue is we are trying to relate one list row to many documents, but don't want to seperate the docs into seperate folders and would like the solutoin to be seamless. We are going to add a look up from the doc lib to the list, but did not want to use anythng but the List's ID column. However, we do not want users to have to manually look up List row IDs in that form, and we did not want to use a list column that can be edited, even if we can add a unique column policy. My design and thinking is to build a few custom pages with dataviews to show row level details in both lists (1 to many) and a dataview to drive list level functions like edit, delete and upload docs. I think all the pieces are there except for the less than graceful upload function that fist uploads the file and then asks the

Error For Execute User Define Function in remote host.

Hi there.I wanna to call a user defined function in stored proc.it's ok in local test but in the host it rises error: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.MinCount", or the name is ambiguous.What should i do?

Error: "Select statements included within a function cannot return data to a client"

hi all, Not sure if there is an easier way to do this but this is my first ever Function I created so far. I am getting the error: "Select statements included within a function cannot return data to a client" All I am trying to do is ...if the date is NOT passed then apply NULL as the default value and run the SELECT statement. If the date IS NOT null then run a different SELECT statement. CREATE FUNCTION [SchemaTest].[fn_Test] ( @instance as uniqueidentifier ,@date as datetime = null ) RETURNS varchar(8000) AS BEGIN If (@date is null) --@date = null ?? Begin Select * From Uds.RealtimeLogging Where instanceID = @instance End Else Begin Select * From Uds.RealtimeLogging Where instanceID = @instance and [timeStamp] > @date End Return @stepIds END Thank you!JCD

The expression contains undefined function call MyUserFunction() error :Telerik Reports

  Hello All, I am getting the error."An error has occured while processing textbox:The expression contains undefined function call FormType()". I have a report..where in i used a user function called "FormType". My datasource  for teh report is sharepoint list. I am passing a parameter to the user function in the code.My user functions retrieves three values(one each time based on the conditions)But when i select the user function..in the edit expression dialog box.. i am not writing any parameter inside the user function as i am not sure what to write there. I have gone through http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx and thought i might fall in 2nd cateogry..but unable to find a solution for that Please help me. Here is the code. InitializeComponent();             string strType;             SPSite oSite = new SPSite("spsiteurl");             SPWeb oWeb = oSite.OpenWeb();             string[] parameters = { "10", "100", "1000" };             T

Error calling a Oracle10g function from C#.net - HELP !


I have a function which can take 2 parameters and will return a string !

my function lokks like this,

Login(uname IN varchar2,inpass IN varchar2) return varchar2

The function absolutely works fine in isqlplus !

the problem is in the .cs file....

I'm using OracleHelper !

I dont know hoe to invoke the function from C# using Oraclehelper !

i'm posting my code anyways....

string s = OracleHelper.ExecuteScalar(connection,CommandType.StoredProcedure,"Login",
new OracleParameter("uname",TextBox1.Text),
new OracleParameter("inpass",TextBox2.Text)).ToString();


Scope statement using Tail function has count error


My time hierarchy (TimeHier) has a QUADWEEK level with 28 members. When I select the last 13 members with the Tail function, I get the appropriate members:

Tail([Time].[TimeHier].[QUADWEEK].Members, 13))

However, if I use that same function inside a Scope statement, it only applies to the last 12 members. I have to increase the count by 1, to 14 to make it work inside the scope. I'm baffled.

Here's the full code:




Create SQL CLR function error



I am using VS 2008 - SQL Server Project to create User Defined Functions.

Build successfully and when I try to run it (F5), it prompts the error below:

Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80131522. You need to restart SQL server to use CLR integration features.

a) The database is version 9.0 compatible.
b) .Net framework 3.5 SP1 installed.
c) Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) (Build 2600: Service Pack 3)

Kindly advise what I need to do to fix the error.

Thank you in advance.

DB-Library error msg (Number=10004, Severity=9, Function=dbopen)



I am using Named Pipes to create Alias of the Sql Server 2008 using CliConfg utility. Now whenever i try to connect to the server I receive 

DB-Library error msg (Number=10004, Severity=9, Function=dbopen) Unable to connect: SQL Server is unavailable or does not exist.  Connection is busy , error.

please help.


error calling javascript function in asp link button


I am using a asp link button in grid template field which calls a pop up,i need to find the link button's control in cs page.

my link button code

<asp:LinkButton runat="server" ID="hlQName" Text='<%# Eval("QuestionnaireName")%>' OnClientClick

Using a Function from a Custom assembly - An unexpected error occurred while compiling expressions.


LocalReport, SQL 2005, Custom Assembly compiled in Framework 2.0, with this I can add the reference to the report.

Client  (WinForm Framework 4.0)  In the same path of my application, I have the custom assembly (that uses the report)

When I try to get the DataSources, getParameters, or SetParameters, I always get the same error. The LoadDefinition(stream) does not load anything. Any Idea?

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.

I also tried to enable the NetFx40_LegacySecurityPolicy in the config of my application, and nothing change.

If I don't use the Function from the custom assembly I don't have any problem.
Thanks in advance. 

delete document button in ribbon gives javascript error: g is not a function



We have a default SharePoint 2010 installation. So an out of the box site template, out of the box document libraries/lists etc, out of the box theme (default one) etc.

When we check the checkbox next to a document in the shared documents library, the tab in the ribbon automatically switches to the document tab. In this tab there is a button "delete document". When I click that I get a confirmation request, I click OK, and then I get a little yellow box in the upper right corner that tells me SharePoint is deleting the document, and then nothing happens.

The document stays where it is, no refresh of the page as SharePoint should do...

I have a javascript error, and in FireFox it tells me "g is not a function" on line 2 of the file inplview.js?rev=AohvE9XEf%2FI78tuaw1TGAA
Line 2 contains like 100 javascript functions on the same line, so it's impossible to find out which function or command throws the error.
This is not a file created by me, so I guess it comes with SharePoint and that I should not touch it.

So what do I do now?
I have another server that we use for SharePoint testing, and there the button works as it should, so it's not SharePoint either...
Problem is that we use this server to give basic SharePoint trainings to our employees, so it's not a very good start

onload call javascript function error


I want to initialise a text box value:

<script language="JavaScript" type="text/javascript" src="<%=ResolveUrl("~/Scripts/Common.js")%>">


<body onload="LoadDefaulteValue('revision')">

<input id="revision" type="text"  name="revision"/>

In the Common.js file, I have 2 functions:

function LoadCurrentDate(boxname) {
    var d = new Date();
    var months = new Array(12);
    months[0] = 'Jan';
    months[1] = 'Feb';
    months[2] = 'Mar';
    months[3] = 'Apr';
    months[4] = 'May';
    months[5] = 'Jun';
    months[6] = 'Jul';
    months[7] = 'Aug';
    months[8] = 'Sep';
    months[9] = 'Oct';
    months[10] = 'Nov';
    months[11] = 'Dec';
    document.getElementById(boxname).value = d.getDate() + '-' +

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend