Showing posts with label field. Show all posts
Showing posts with label field. Show all posts

Friday, March 23, 2012

Proper case of a field

Is there a way which helps to standerdize the case of a field e.g. I have a
field called location name which is sometimes all in caps or in lower cases,
I need to format it to be like CAMBRDIGE becomes Cambridge and etc
ThanksI'd guess you want to create a user defined function that would do
this.
Pseudo-code...
create function dbo.udfProperCase( @.value varchar(100) )
returns varchar(100)
begin
declare @.i int
declare @.valueLen int
declare @.properCaseValue varchar(100)
set @.valueLen = len(@.value)
set @.i = 0
set @.properCaseValue = ''
while @.i < @.valueLen
begin
-- test for beginning of a word, make it uppercase, etc...
set @.properCaseValue = @.properCaseValue + whatever
set @.i = @.i + 1
end
return @.properCaseValue
end
You could then use it as such:
insert into MyTable( col1, col2 ) values( 'abc', dbo.udfProperCase(
'cambridge' ) )|||Thanks man! Looks . One more question. Where should i bring in the field
from the database, i mean
SET @.valueLen = len(@.value) '
OR
SET @.properCaseValue = @.properCaseValue + whatever '
How will this set my fields with proper cases like
dbo.udfProperCase('cambridge' )
Will this become Cambrige?
"bd" wrote:

> I'd guess you want to create a user defined function that would do
> this.
> Pseudo-code...
> create function dbo.udfProperCase( @.value varchar(100) )
> returns varchar(100)
> begin
> declare @.i int
> declare @.valueLen int
> declare @.properCaseValue varchar(100)
> set @.valueLen = len(@.value)
> set @.i = 0
> set @.properCaseValue = ''
> while @.i < @.valueLen
> begin
> -- test for beginning of a word, make it uppercase, etc...
> set @.properCaseValue = @.properCaseValue + whatever
> set @.i = @.i + 1
> end
> return @.properCaseValue
> end
>
> You could then use it as such:
> insert into MyTable( col1, col2 ) values( 'abc', dbo.udfProperCase(
> 'cambridge' ) )
>|||The body of the function wouldn't use the field from the database. You
could do the following:
insert into MyTable( col1, col2 )
select col1, dbo.udfProperCase( mycol ) from AnotherTable
In this example, the value of the field 'mycol' is passed into your
function. The function manipulates the value (in this case, makes it a
"proper case") and returns it.
Or you could do this to test your function:
print dbo.udfProperCase( 'this is my test' )
And it would use the literal string value.
Of course, the function I wrote is just pseudo-code. You'll have to
code the particulars of it yourself because, unfortunately, I don't
have a function like that in my toolbox to copy and paste for you.
I hope this helps.
Bryce|||It is certainly. One more thing, should I write upper and lower case
functions on the variable @.value '
"bd" wrote:

> The body of the function wouldn't use the field from the database. You
> could do the following:
> insert into MyTable( col1, col2 )
> select col1, dbo.udfProperCase( mycol ) from AnotherTable
> In this example, the value of the field 'mycol' is passed into your
> function. The function manipulates the value (in this case, makes it a
> "proper case") and returns it.
> Or you could do this to test your function:
> print dbo.udfProperCase( 'this is my test' )
> And it would use the literal string value.
> Of course, the function I wrote is just pseudo-code. You'll have to
> code the particulars of it yourself because, unfortunately, I don't
> have a function like that in my toolbox to copy and paste for you.
> I hope this helps.
> Bryce
>|||There is no need to use loops, proprietary or procedural code. SQL is
a declarative language, so use the functions instead. This usually
runs faster and it is portable.
CREATE FUNCTION TitleCase (@.input_title VARCHAR(100))
RETURNS VARCHAR(100)
RETURN
REPLACE (' a', ' A',
REPLACE (' b', ' B',
REPLACE ...
REPLACE(' z', ' Z',
(UPPER (SUBSTRING (@.input_title, 1, 1) + LOWER (SUBSTRING
(@.input_title, 2))
. ),
),
);
The nested REPLACE() functions capitalize the first letters of each
word. The intermost substring concatenations capitalize the first word.
I would also remove extra spaces in the same routine.|||Thanks buddy, looks great but one question..Could you explain a little how I
can use your replace in my version?
Do i have to declare some variables to use here?
Thanks
"--CELKO--" wrote:

> There is no need to use loops, proprietary or procedural code. SQL is
> a declarative language, so use the functions instead. This usually
> runs faster and it is portable.
> CREATE FUNCTION TitleCase (@.input_title VARCHAR(100))
> RETURNS VARCHAR(100)
> RETURN
> REPLACE (' a', ' A',
> REPLACE (' b', ' B',
> REPLACE ...
> REPLACE(' z', ' Z',
> (UPPER (SUBSTRING (@.input_title, 1, 1) + LOWER (SUBSTRING
> (@.input_title, 2))
> .. ),
> ),
> );
> The nested REPLACE() functions capitalize the first letters of each
> word. The intermost substring concatenations capitalize the first word.
> I would also remove extra spaces in the same routine.
>|||Put it in a UPDATE statement SET clause to clena up the data first.
then add a CHECK() constraint like this:
CHECK (<horrible expression> = my_column) so this will not happen
again.sql

proper case for name in sql server

hi,
a field with all capital letters for last name and frist name -- DAVID
JONES
I need a funcation taht I could retrive it from sql query analyzer
select propercase(field1) from names. it returns "David Jones"
THnaksHi
A google search would turn up many hits such as
http://vyaskn.tripod.com/code/propercase.txt but it doesn't cater for all
names e.g MacNeil, McNeil, O'Neill etc..
John
"mecn" wrote:
> hi,
> a field with all capital letters for last name and frist name -- DAVID
> JONES
> I need a funcation taht I could retrive it from sql query analyzer
> select propercase(field1) from names. it returns "David Jones"
> THnaks
>
>

Prompt Parameter in Ad Hoc Reports

Can i do this?
In the filter window, i want to add a field and make it into a prompt. But
then when the users run the report they should have the ability to not select
anything from the prompt and hence see the report for all values of that
field...On Feb 27, 11:47 am, Tk_Neo <T...@.discussions.microsoft.com> wrote:
> Can i do this?
> In the filter window, i want to add a field and make it into a prompt. But
> then when the users run the report they should have the ability to not select
> anything from the prompt and hence see the report for all values of that
> field...
One way of doing it is to create a report parameter for the filter
options (incl. no filter as an option) and either use the report
parameter value selected to filter with -or- use the report parameter
in the query or stored procedure to filter the results. Hope this
helps.
Regards,
Enrique Martinez
Sr. SQL Server Developer|||I posted a way to do this in the msdn forum:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1285083&SiteID=1
hth
Helen
"EMartinez" <emartinez.pr1@.gmail.com> wrote in message
news:1172636771.488607.218240@.t69g2000cwt.googlegroups.com...
> On Feb 27, 11:47 am, Tk_Neo <T...@.discussions.microsoft.com> wrote:
>> Can i do this?
>> In the filter window, i want to add a field and make it into a prompt.
>> But
>> then when the users run the report they should have the ability to not
>> select
>> anything from the prompt and hence see the report for all values of that
>> field...
> One way of doing it is to create a report parameter for the filter
> options (incl. no filter as an option) and either use the report
> parameter value selected to filter with -or- use the report parameter
> in the query or stored procedure to filter the results. Hope this
> helps.
> Regards,
> Enrique Martinez
> Sr. SQL Server Developer
>sql

Prompt for user input in criteria field of view

In Access, I use [Enter Date] in the Criteria field of the Query. I tried the same thing in SQL Server in the Criteria field of the View and it does not recognize this. Is there a comparable command in SQL to get user input into the Criteria field of a view?

Hi,

you either have to use a procedure with an input parameter or have to put a condition on the query with querying the view with:

Select * from SomeView Where SomeColumn = 'SomeValue'

But there is no GUI on SQL Server.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||MSSQL as service prompts you nothing. You have to write client application to be prompted.|||

Hi Jens,

I was able to find out how to do what I needed using the @. sign (i.e. @.Date Required?). In the criteria field of the SQL view, this generates a 'Date Required?' prompt box when running the view.

Thanks anyway!

Ernie

sql

Tuesday, March 20, 2012

PROGRESS import of field freezes SQL Server

hi,
I've got a SQL 2005 with an odbc connection to a PROGRESS database. We can
transfer data from the progress to the sql but there is 1 field we can not
transfer. This field, proclaimed by the PROGRESS administration, is a field
wich can contain an empty string or up to 8 characters.
But when we try to do a 'select problemfield, goodfield1,goodfield2 from
pub.table' in the import and export wizard and try to preview this select,
SQL Server freezes for a loooooong time resulting in an error "defined by
component".
We have tried to put the problem field into the select clause, with the
where clause without the where clause... always the same result. The datatyp
e
that we use is a varchar(8) or more but it always freezes.
Does anyone have an idea?
Note: when progress exports to a flat file and we import that flat file,
this works without any problems. So instead of using the odbc connection to
transfer the data overnight, we would like to use flat files and import them
with Integration S. Good solution or not?Ok,
We managed to get the import; but via a flatfile source not with the odbc
connector. Wat went wrong I cant say, it wasn't possible to import the field
s
via a ODBC connection, the flatfime however imported like nothing (although
it where millions of rows)
We have to do a lot of cleansing, the progress software sets a ? in fields
that are not filled in. In this case, implicit conversions to smalldatatime
fails. Now that we have everything in nvarchar, I'm sure SSIS will bring us
where we want.
Thx,
"Philippe" wrote:

> hi,
> I've got a SQL 2005 with an odbc connection to a PROGRESS database. We can
> transfer data from the progress to the sql but there is 1 field we can not
> transfer. This field, proclaimed by the PROGRESS administration, is a fiel
d
> wich can contain an empty string or up to 8 characters.
> But when we try to do a 'select problemfield, goodfield1,goodfield2 from
> pub.table' in the import and export wizard and try to preview this select,
> SQL Server freezes for a loooooong time resulting in an error "defined by
> component".
> We have tried to put the problem field into the select clause, with the
> where clause without the where clause... always the same result. The datat
ype
> that we use is a varchar(8) or more but it always freezes.
> Does anyone have an idea?
> Note: when progress exports to a flat file and we import that flat file,
> this works without any problems. So instead of using the odbc connection t
o
> transfer the data overnight, we would like to use flat files and import th
em
> with Integration S. Good solution or not?

Monday, March 12, 2012

Programming Field Lengths

Is it possible to tell sql server to cast to a datatype and set the
field length to a variable.

e.g. :-

declare @.flen int
set @.flen = 10

select (cast somefield as char(@.flen) newfield)
into newtable
from sometable

I have also tried :-
select (cast somefield as char(max(len(somefield))) newfield)
into newtable
from sometable

When I try the above examples I get error in @.flen; error in max
respectivly.

TIA

Simon<bozzzza@.lycos.co.uk> wrote in message
news:1119438419.547258.218740@.z14g2000cwz.googlegr oups.com...
> Is it possible to tell sql server to cast to a datatype and set the
> field length to a variable.
> e.g. :-
> declare @.flen int
> set @.flen = 10
> select (cast somefield as char(@.flen) newfield)
> into newtable
> from sometable
> I have also tried :-
> select (cast somefield as char(max(len(somefield))) newfield)
> into newtable
> from sometable
> When I try the above examples I get error in @.flen; error in max
> respectivly.
> TIA
> Simon

I don't believe there's any easy way to do this, but in most cases, it's
probably not necessary - instead of declaring char(10), why not just declare
varchar(1000), or whatever value is suitable for you? If you can explain why
you need to do this, someone may have a better solution. Depending on what
you need to achieve, you might be able to use dynamic SQL, but that has a
number of issues:

http://www.sommarskog.se/dynamic_sql.html

Simon|||(bozzzza@.lycos.co.uk) writes:
> Is it possible to tell sql server to cast to a datatype and set the
> field length to a variable.
> e.g. :-
> declare @.flen int
> set @.flen = 10
> select (cast somefield as char(@.flen) newfield)
> into newtable
> from sometable
> I have also tried :-
> select (cast somefield as char(max(len(somefield))) newfield)
> into newtable
> from sometable
> When I try the above examples I get error in @.flen; error in max
> respectivly.

No, you would have to use dynamic SQL for that. Seems easier to use
varchar.

What do you want to achieve, really?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||
Erland Sommarskog wrote:
> (bozzzza@.lycos.co.uk) writes:
> > Is it possible to tell sql server to cast to a datatype and set the
> > field length to a variable.
> > e.g. :-
> > declare @.flen int
> > set @.flen = 10
> > select (cast somefield as char(@.flen) newfield)
> > into newtable
> > from sometable
> > I have also tried :-
> > select (cast somefield as char(max(len(somefield))) newfield)
> > into newtable
> > from sometable
> > When I try the above examples I get error in @.flen; error in max
> > respectivly.
> No, you would have to use dynamic SQL for that. Seems easier to use
> varchar.
> What do you want to achieve, really?

Yhe problem is we have had some data supplied and the all the fields
lengths are set to 255 (nvarchar), even though this is not good pratice
we could live with it until someone else wanted a fixed length export
of the data.

So my idea was to work out the length of the fields and insert them as
the maximum width into the new table. Then the fixed length file would
look a lot better and cleaner.

Thanks for the reply, I will look into Dynamic SQL.|||(bozzzza@.lycos.co.uk) writes:
> Yhe problem is we have had some data supplied and the all the fields
> lengths are set to 255 (nvarchar), even though this is not good pratice
> we could live with it until someone else wanted a fixed length export
> of the data.
> So my idea was to work out the length of the fields and insert them as
> the maximum width into the new table. Then the fixed length file would
> look a lot better and cleaner.

Maybe. But what if the max lengths you find do agree with the actual
business rules? Next time you get a refresh, you could get an error
because of truncation.

So I would suggest that either you find out the actual max lengths, or
you leave the table the way it is.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||You have asked the same question in
microsoft.public.sqlserver.programming. Please don't post the same
question independently to diffferent groups. It's inconsiderate to
others who may waste time responding on something that has already been
answered elsewhere.

In your other thread you indicated that your intention is to
standardize the column sizes for reporting purposes. All the reporting
tools I know of allow you to specify a field width shorter than the
actual column width so I'm not sure why you would want to do this in
SQL. Keep it in the presentation tier is my suggestion.

--
David Portas
SQL Server MVP
--|||
David Portas wrote:
> You have asked the same question in
> microsoft.public.sqlserver.programming. Please don't post the same
> question independently to diffferent groups. It's inconsiderate to
> others who may waste time responding on something that has already been
> answered elsewhere.

Sorry.

> In your other thread you indicated that your intention is to
> standardize the column sizes for reporting purposes. All the reporting
> tools I know of allow you to specify a field width shorter than the
> actual column width so I'm not sure why you would want to do this in
> SQL. Keep it in the presentation tier is my suggestion.

Actually I needed to create a fix length text file of the data, so a
pascal programmer could import it into a DOS application, and the
programmer wasn't happy that the fields were coming out at 255 each.

After reading Erland's post, I gave the programmer the export in Comma
delimited format instead, so a refresh of the data won't effect the
export.

But thanks to all the posts I now know dynamic sql exists (I thought
exec was just for stored procedures) and it has opened up a whole new
world for me.|||Yes it is possible!

Do it this way!

eg :-

declare @.flen int
set @.flen = 10

exec('select cast(somefield as char(' + @.flen + ')) as newfield into
newtable
from oldtable')

Regards
Debian

*** Sent via Developersdex http://www.developersdex.com ***|||> I now know dynamic sql exists (I thought
> exec was just for stored procedures) and it has opened up a whole new
> world for me.

Make sure you understand the implications. Dynamic SQL should usually
be a last resort in production code. See:
http://www.sommarskog.se/dynamic_sql.html

--
David Portas
SQL Server MVP
--

Saturday, February 25, 2012

Programatically View / Stored Procedure with N fields

We have a table that has 10 fields of which say 5 are either non textual. We
want to have a resultant view with 7 fields, namely 1 numeric field and the
5 non-numeric fields (textual) and one additional field for the non textual
field name. In the example below the last 5 field names are Prod1, Prod2,
Prod3, Prod4, Prod5.
E.g.
Original
SA, Sales, Man1, Actual, Jan, 100, 200, 300, 400, 500
SA, Sales, Man2, Actual, Jan, 1, 2, 3, 4, 5
Result
SA, Sales, Man1, Actual, Prd1, Jan, 100
SA, Sales, Man1, Actual, Prd2, Jan, 200
SA, Sales, Man1, Actual, Prd3, Jan, 300
SA, Sales, Man1, Actual, Prd4, Jan, 400
SA, Sales, Man1, Actual, Prd5, Jan, 500
SA, Sales, Man1, Actual, Prd1, Jan, 1
SA, Sales, Man2, Actual, Prd2, Jan, 2
SA, Sales, Man3, Actual, Prd3, Jan, 3
SA, Sales, Man4, Actual, Prd4, Jan, 4
SA, Sales, Man5, Actual, Prd5, Jan, 5
In essence the size of the table will end up as
n records * 5 fields.
Thanks in advance.Avril
I'm not sure understood you.
Have you tride using UNION ALL to get what you wanted?
"Avril" <Avril@.ppp.com> wrote in message
news:effVz3oZGHA.1220@.TK2MSFTNGP02.phx.gbl...
> We have a table that has 10 fields of which say 5 are either non textual.
> We want to have a resultant view with 7 fields, namely 1 numeric field and
> the 5 non-numeric fields (textual) and one additional field for the non
> textual field name. In the example below the last 5 field names are Prod1,
> Prod2, Prod3, Prod4, Prod5.
>
> E.g.
> Original
> SA, Sales, Man1, Actual, Jan, 100, 200, 300, 400, 500
> SA, Sales, Man2, Actual, Jan, 1, 2, 3, 4, 5
> Result
> SA, Sales, Man1, Actual, Prd1, Jan, 100
> SA, Sales, Man1, Actual, Prd2, Jan, 200
> SA, Sales, Man1, Actual, Prd3, Jan, 300
> SA, Sales, Man1, Actual, Prd4, Jan, 400
> SA, Sales, Man1, Actual, Prd5, Jan, 500
> SA, Sales, Man1, Actual, Prd1, Jan, 1
> SA, Sales, Man2, Actual, Prd2, Jan, 2
> SA, Sales, Man3, Actual, Prd3, Jan, 3
> SA, Sales, Man4, Actual, Prd4, Jan, 4
> SA, Sales, Man5, Actual, Prd5, Jan, 5
> In essence the size of the table will end up as
> n records * 5 fields.
> Thanks in advance.
>|||Avril,
In SQL Server 2005, you can use the UNPIVOT operator for this.
In SQL Server 2000, you can use a CROSS JOIN like this:
select
column1, column2, column3, column4,
'Prd' + Nch as Prd,
column5,
case Nch
when 1 then Prod1 when 2 then Prod2 when 3 then Prod3
when 4 then Prod4 when 5 then Prod5 end as LastColumn
from yourTable
cross join (
select '1' as Nch union all select '2' union all select '3'
union all select '4' union all select '5'
) as F
There may be some typos, since you didn't give the create table
statements and sample data as INSERTs to test with, and you
will have to fix column names for the columns whose names
you didn't provide.
Steve Kass
Drew University
Avril wrote:

>We have a table that has 10 fields of which say 5 are either non textual. W
e
>want to have a resultant view with 7 fields, namely 1 numeric field and the
>5 non-numeric fields (textual) and one additional field for the non textual
>field name. In the example below the last 5 field names are Prod1, Prod2,
>Prod3, Prod4, Prod5.
>
>E.g.
>Original
>SA, Sales, Man1, Actual, Jan, 100, 200, 300, 400, 500
>SA, Sales, Man2, Actual, Jan, 1, 2, 3, 4, 5
>Result
>SA, Sales, Man1, Actual, Prd1, Jan, 100
>SA, Sales, Man1, Actual, Prd2, Jan, 200
>SA, Sales, Man1, Actual, Prd3, Jan, 300
>SA, Sales, Man1, Actual, Prd4, Jan, 400
>SA, Sales, Man1, Actual, Prd5, Jan, 500
>SA, Sales, Man1, Actual, Prd1, Jan, 1
>SA, Sales, Man2, Actual, Prd2, Jan, 2
>SA, Sales, Man3, Actual, Prd3, Jan, 3
>SA, Sales, Man4, Actual, Prd4, Jan, 4
>SA, Sales, Man5, Actual, Prd5, Jan, 5
>In essence the size of the table will end up as
>n records * 5 fields.
>Thanks in advance.
>
>|||Steve
Thanks that worked for me. Now if I wanted to extend that to say
If Column3 = 'Man2' then multiply the amounts by 0.15 or
If Column3 = 'Man3' then multiply the amounts by 0.3
How would this affect the statement below.
Column1 Column2 Column3 Column4 Column5
Prd1 Prd2 Prd3 Prd4 Prd5
SA Sales Man1 Actual
Jan 100 200 300 400 500
SA Sales Man1 Actual
Jan 1 2 3 4 5
SA Sales Man2 Actual
Jan 100 200 300 400 500
SA Sales Man2 Actual
Jan 1 2 3 4 5
SA Sales Man3 Actual
Jan 100 200 300 400 500
SA Sales Man3 Actual
Jan 1 2 3 4 5
select
column1, column2, column3, column4, column5,'Prd' + Nch as Prd,
case Nch
when 1 then Prd1
when 2 then Prd2
when 3 then Prd3
when 4 then Prd4
when 5 then Prd5
end as Amount
from dbo.Sheet1$
cross join (
select '1' as Nch union all select '2' union all select '3'
union all select '4' union all select '5'
) as F
Thanks in advance.
"Steve Kass" <skass@.drew.edu> wrote in message
news:uAu7oipZGHA.5000@.TK2MSFTNGP05.phx.gbl...
> Avril,
> In SQL Server 2005, you can use the UNPIVOT operator for this.
> In SQL Server 2000, you can use a CROSS JOIN like this:
> select
> column1, column2, column3, column4,
> 'Prd' + Nch as Prd,
> column5,
> case Nch
> when 1 then Prod1 when 2 then Prod2 when 3 then Prod3
> when 4 then Prod4 when 5 then Prod5 end as LastColumn
> from yourTable
> cross join (
> select '1' as Nch union all select '2' union all select '3'
> union all select '4' union all select '5'
> ) as F
> There may be some typos, since you didn't give the create table
> statements and sample data as INSERTs to test with, and you
> will have to fix column names for the columns whose names
> you didn't provide.
> Steve Kass
> Drew University
> Avril wrote:
>|||On Mon, 24 Apr 2006 06:55:21 +0100, Avril wrote:

>Steve
>Thanks that worked for me. Now if I wanted to extend that to say
>If Column3 = 'Man2' then multiply the amounts by 0.15 or
>If Column3 = 'Man3' then multiply the amounts by 0.3
>How would this affect the statement below.
(snip)
>select
>column1, column2, column3, column4, column5,'Prd' + Nch as Prd,
>case Nch
>when 1 then Prd1
>when 2 then Prd2
>when 3 then Prd3
>when 4 then Prd4
>when 5 then Prd5
>
END * CASE Column3
WHEN 'Man2' THEN 0.15
WHEN 'Man3' THEN 0.3
ELSE 1

>end as Amount
>from dbo.Sheet1$
>cross join (
>select '1' as Nch union all select '2' union all select '3'
>union all select '4' union all select '5'
> ) as F
(Untested - see www.aspfaq.com/5006 if you prefer a tested reply)
Hugo Kornelis, SQL Server MVP|||Thanks
"Hugo Kornelis" <hugo@.perFact.REMOVETHIS.info.INVALID> wrote in message
news:vmgq42tjek1ur7ru4velvtv3hiqnv7gekq@.
4ax.com...
> On Mon, 24 Apr 2006 06:55:21 +0100, Avril wrote:
>
> (snip)
> END * CASE Column3
> WHEN 'Man2' THEN 0.15
> WHEN 'Man3' THEN 0.3
> ELSE 1
>
> (Untested - see www.aspfaq.com/5006 if you prefer a tested reply)
> --
> Hugo Kornelis, SQL Server MVP

Programatically Show Hide Report Members?

Does anyone know how to programatically show hide members (specificallytextboxes) in a report based on whether another field is Null orEmpty? I have tried to do something to the effect of
<code>
Sub ShowBox()
If Len(Fields!itm.Formula.Value)>0 Then
Fields!textbox30.Visibility = True
End If
End Sub
</code>
I put this in the code section under report properties but I get an error to the effect of
References to a non-shared member require an object reference
and
Expression does not produce a value
I know i am doing this totally wrong, can someone help me out?

thanks

in the textbox expression you can do something like :

=IIF(Len(Fields!itm.Formula.Value)>0, Fields!itm.Formula.Value, "")

|||

ndinakar wrote:

in the textbox expression you can do something like :

=IIF(Len(Fields!itm.Formula.Value)>0, Fields!itm.Formula.Value, "")


Just wondering if any one got any more ideas:
I tried this way:

=IIF((Fields!group1.Value)=Group2,Fields!Isuue.Value,

Fields!Name.Value = False) does not work.(By the way, Issue is a varchar field)

The exception is thrown saying

Microsoft.ReportingServices.ReportProcessing.ReportProcessingException

=IIF((Fields!group1.Value)=Group2,Fields!Issue.Value,

Fields!Name.Value = "") doesn't give any error but doesn't work properly.

It shows the column, doesn't hide it.

Even if it hides the coulmn it doesn't delete the space for that column because

there are already some items in that column as shown below

Group1

Name Issue Marks

ss sds 90

gss pds 90

Group2

Name Marks

ss 90

gss 90

Marks Column should be printed in the place of Issue column under group2. Is that possible