Showing posts with label prior. Show all posts
Showing posts with label prior. Show all posts

Thursday, March 22, 2012

Alert User of Invalid Parameter Entry

Does anyone know if there is a way to alert the user that the parameter
value is invalid prior to the report rendering?
One of the parameters is an account number '########'. The user is
accustomed to seeing it as '###-####-#' and may enter it in that
format. I've already put the usual '(With no dashes)' next to the
prompt. However, if they do put dashes, (or some other invalid format),
the report runs as normal and spits out a blank report.
I would like the user to be aware of invalid parameter entries, similar
to a web app, or windows form.
TIA.On Dec 21, 11:06 am, Michael <Mich...@.discussions.microsoft.com>
wrote:
> Does anyone know if there is a way to alert the user that the parameter
> value is invalid prior to the report rendering?
> One of the parameters is an account number '########'. The user is
> accustomed to seeing it as '###-####-#' and may enter it in that
> format. I've already put the usual '(With no dashes)' next to the
> prompt. However, if they do put dashes, (or some other invalid format),
> the report runs as normal and spits out a blank report.
> I would like the user to be aware of invalid parameter entries, similar
> to a web app, or windows form.
> TIA.
There are a couple different things you can do. Either you can add a
textbox control to the report and set it to an expression like:
=iif(InStr(Parameters!AcctNumber.Value, "-") > 0, "Invalid Account
Number", Nothing)
-or-
You can do a replace on the Acct Number parameter entered by the user
via an expression in your dataset. An expression like this might help.
=Replace(Parameters!AcctNumber.Value, "-", "")
and you can embed them in each other to catch other stray characters
(i.e., remove all hyphens and asterisks)
=Replace(Replace(Parameters!AcctNumber.Value, "-", ""), "*", "")
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant

Monday, March 19, 2012

Aggregation that results two columns

Hi,
I have following data coming from prior transformations.

Id Unit Name NewFlag
_

1 JacuzziBox 1
2 Hummer H2 0
3 Waste dumper 0

and so on.

I want aggregate task to result 2 fields (without any GROUP BY-ing), so that one contains total number of rows or records, and one contain total number of records with NewFlag=1.

Just wondering if it is possible by using Aggregate and how.

Thanks for your help in advance,The Aggregate transform does not support calculations based on a conditional. However, since you are using 0 and 1 as values for the NewFlag, just sum that column and you should have the right result. You'll also need to select the count(*) aggregation in the dialog. Don't select any other columns, and you will get one row with the first column containing the total rows, and the second containing the NewFlag count.

Friday, February 24, 2012

After upgrade to SQL 2005 getting CONVERT error.

I have a query that was working prior to an upgrade to SQL 2005 from SQL 2000. Now, I am getting an "Error converting data type varchar to numeric." error message. It appears to be related to the order of operations of the "WHERE" clause.

Here is the partial WHERE clause:

AND ISNUMERIC(value) = 1
AND CONVERT(numeric(20,2), value) < 0
AND type IN (...

The value field in the database table is defined as a varchar and will contain mixed datatypes. That is why the "ISNUMERIC" line is in the where clause.

Interestingly, if I change the qualified values in the "IN" line to a single value, it works fine. As soon as I introduce a second value within the "IN" line, I get the error message.

Please see below thread for more details:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=768927&SiteID=1

This is by design. You will have to either use CASE expression to perform conditional checks or modify your schema to use the correct data types for the data.