Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Tuesday, March 20, 2012

Background expression

Hi All,

I tried using the following Expression in a field's background property:

=iif( Fields!ProjectedDate.Value between (getdate()+1) and (getdate()+7), Orange ,White )

And then I got this message, anyone got any ideas?

The background color expression for the textbox 'textbox49' contains an error: [BC30455] Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

=iif( Fields!ProjectedDate.Value < (getdate()+1) AND Fields!ProjectedDate.Value > (getdate()+7), Orange ,White )

I dont think you can use between in expression.

sql

Sunday, March 11, 2012

Axis Object - Auto Interval Error

Hello,
I am trying to plot a graph using the following data expression:
=(sum(Fields!Closed.Value)*7.5)/sum(Fields!FTE.Value)
and I get an error whenever I try to publish the graph:
An error has occured while rendering chart chart1. Details: Axis Object - Auto Interval Error Axis Object - Auto Interval Error
Anyone know what causes this and how it can be fixed?
Thanks
Wow... found the answer. So an error in my data caused this expression to be infinity. The Auto Interval Error can not handle a data point that is infinite so to fix this simply perform a check. In this case:
=iif(sum(Fields!FTE.Value)=0,"100",((sum(Fields!Closed.Value)*7.5)/sum(Fields!FTE.Value)))
I used the value 100 here becasue it is beyond my scall so a value of 100 will be very obvious.

Thursday, February 16, 2012

Average Times

I have a report that displays the average time between events. I use the
following expression to calculate the time
=IIF(RowNumber("DailyInspectCount") > 1,-1 *
(DateDiff(DateInterval.Minute,Fields!InspectedByDate.Value,Previous(Fields!InspectedByDate.Value))),0)
& " min."
This gives me the number of minutes between each event just fine. Now I
want to get an overall average for the whole row. When I use the AVG
function I get the error "Aggregate functions cannot be nested inside other
aggregate functions". Does anyone know a way to get the values from this
expression to generate the average? Thanks.
JohnCorrection,
I want to get the average for the whole column not the row.
"John Wright" <riley_wright@.hotmail.com> wrote in message
news:uVA4BwvpIHA.4716@.TK2MSFTNGP06.phx.gbl...
>I have a report that displays the average time between events. I use the
>following expression to calculate the time
> =IIF(RowNumber("DailyInspectCount") > 1,-1 *
> (DateDiff(DateInterval.Minute,Fields!InspectedByDate.Value,Previous(Fields!InspectedByDate.Value))),0)
> & " min."
>
> This gives me the number of minutes between each event just fine. Now I
> want to get an overall average for the whole row. When I use the AVG
> function I get the error "Aggregate functions cannot be nested inside
> other aggregate functions". Does anyone know a way to get the values from
> this expression to generate the average? Thanks.
>
> John
>

Average Expression ?

Hi,
I want to calculate the Average Sales for given columns, eg
Jan Fab Mar April AVERAGE
100 100 100 100 100
20 20 10 15.66
30 10 50 30
Is it possible using an Expression ?
ThanksCreate a matrix report and change the aggregate from Sum to avg
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.
"Vishal" wrote:
> Hi,
> I want to calculate the Average Sales for given columns, eg
> Jan Fab Mar April AVERAGE
> 100 100 100 100 100
> 20 20 10 15.66
> 30 10 50 30
> Is it possible using an Expression ?
> Thanks
>
>

Friday, February 10, 2012

Autonumber problem Error "Data type mismatch in criteria expression"

Hi All,

I am already busy for several hours on this problem WHO CAN HELP ME ;(
I got a Access database with with the field "Password", "Title", And the field PMID (PMID is a AUTONUMBER FIELD in ACCESS 1,2,3,4,5,6,7)

I got this script
SQL = "Select Title, Password From Checklist " _
& "Where Title = '"&Title&"' And Password = '"&Password&"'"
Set RS = MyConn.Execute(SQL)

THIS WORKS GREATTTTTTTTTTTTTTT!!!!!!!!!
But now here it comes.
I want to change TITLE to PMID in this script.

SQL = "Select PMID, Password From Checklist " _
& "Where PMID = '"&PMID&"' And Password = '"&Password&"'"
Set RS = MyConn.Execute(SQL)

Know i think is should remove the singel '. So i did that. I canged the script to
SQL = "Select PMID, Password From Checklist " _
& "Where PMID = #" & PMID & "# And Password = '"&Password&"'"
Set RS = MyConn.Execute(SQL)

But i keep getting errors like
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression 'PMID = ## And Password = 'test''.
/pm/login.asp, line 17

It seems that it doesn't reed the PMID...
WHO CAN HELP ME ;)?This is not a SQL problem - it looks to me like your VBScript VARIABLE called PMID is empty. Try putting this debug message in your code instead of the Execute:

Response.Write( "PMID = " & PMID )

I'll bet when you run it you see this:

PMID =

So the problem is you need to assign a value to PMID.|||Hi andrewst

You Are right :), It is emty then... How is this posible.

How so i fix that. THis field is a AUTONUMBER.
And there are numbers in it...

When i look in Access and go with the DESIGNS VIEW
to the "PMID" field. It tells me this properties:
- Field Size : Long Integer
- New Values : Increment
- Format :
- Caption :
- Indexed : YES (No Duplicades)

When i look in the normal VIEW in the table PMID it give just the normal Numbers automaticly generated. 1,2,3,4,5,6,7,8,9,10... until 86|||PS
Here is the whole script

----------------
<HTML>
<BODY>

<%
PMID = Request.Form("ID")
Password = Request.Form("passw")
'grab the form contents

Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open ("problemman")

SQL = "Select PMID, Password From Checklist " _
& "Where PMID = " & PMID & " And Password = '"&Password&"'"
Set RS = MyConn.Execute(SQL)

If Not RS.EOF Then
Session("allow") = True
'if there is a match then show the page
%>

<html>
'HERE IS MY HTML PAGE
</html>

<%
Else
Response.Redirect "http://www.testl.com/main.htm"
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>

</BODY>
</HTML>|||Originally posted by jvdzwaan
Hi andrewst

You Are right :), It is emty then... How is this posible.

How so i fix that. THis field is a AUTONUMBER.
And there are numbers in it...

When i look in Access and go with the DESIGNS VIEW
to the "PMID" field. It tells me this properties:
- Field Size : Long Integer
- New Values : Increment
- Format :
- Caption :
- Indexed : YES (No Duplicades)

When i look in the normal VIEW in the table PMID it give just the normal Numbers automaticly generated. 1,2,3,4,5,6,7,8,9,10... until 86
Yes, but the problem has nothing to do with the COLUMN called PMID in the table, it is to do with the VBSCript VARIABLE that happens to have the same name. The variable is not AUTONUMBER, it is just a variable. If you don't assign a value to it, it will not get one for itself!|||Originally posted by jvdzwaan
PS
Here is the whole script

----------------
<HTML>
<BODY>

<%
PMID = Request.Form("ID")
Password = Request.Form("passw")
'grab the form contents

Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open ("problemman")

SQL = "Select PMID, Password From Checklist " _
& "Where PMID = " & PMID & " And Password = '"&Password&"'"
Set RS = MyConn.Execute(SQL)

If Not RS.EOF Then
Session("allow") = True
'if there is a match then show the page
%>

<html>
'HERE IS MY HTML PAGE
</html>

<%
Else
Response.Redirect "http://www.testl.com/main.htm"
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>

</BODY>
</HTML>
So the question is: why has the field called "ID" in the form not been populated? Is this field displayed? Did you type a value into it before hitting Submit?|||yes... I got a form with 2 fields
one called ID
and one called passw

when i fill in the form I entered for the ID 61 (is in the DB)
in the passw field i entered test

Then i get the error

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/PM/login.asp, line 14|||Originally posted by jvdzwaan
yes... I got a form with 2 fields
one called ID
and one called passw

when i fill in the form I entered for the ID 61 (is in the DB)
in the passw field i entered test

Then i get the error

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/PM/login.asp, line 14
So have you solved the variable problem yet? I mean, if you put:

Response.Write "PMID = " & PMID

in your program, does it now say:

a) PMID = 61

or:

b) PMID =

If the answer is still (b) then you are sure to get an error since the SQL you send to Access is:

Select PMID, Password From Checklist Where PMID = And Password = 'test'

which is invalid. In this case, you need to debug the variable assignment, not the SQL!

If it seems OK, then try writing out the whole SQL statement:

Response.Write SQL

and see if it a sensible SQL statement.