Showing posts with label sales. Show all posts
Showing posts with label sales. Show all posts

Saturday, February 25, 2012

Delete Table Row if row is blank

Hi All,

I face one problem.

I have one table in .rdlc to display all the sales in that table, but some of the sales is blank and assume there are only two column in table.

So when detect the row for that two column is blank, either the table will skip listing out the blank data or delete that particular row.

How can i do it?

By the way, assume the data we get from database can not filter the blank value.

Thanks

Kendy

In the table layout, you can set the Visible of a row by using the Expression.

=IIF(IsNothing(Column1) AND IsNothing(Column2), False, True)

HTH

|||

Hello Kendy,

Right click on your detail row and go to Properties. Expand Visibility, then enter this in the Hidden property:

=IIf(IsNothing(Fields!Field_1.Value) and IsNothing(Fields!Field_2.Value), True, False)

Remember, this is the hidden property so if they are both empty, you want the hidden property to be set to True.

Hope this helps.

Jarret

|||

Hi Jarret,

Its help and works, thanks.

Kendy

Sunday, February 19, 2012

Delete records by latest date

Hello,
Can anyone tell me how to delete records from a table
based on dates. For example I have a table of property
sales data. Each property could sell multiple times over
several years. So, the ID # of the property would be the
same each time it sold, but the sale date would be
different. I only want to keep one sale record for each
property ID # and I want it to be the latest sale date.
Here is a sample:
PIN SALEDATE TYPE
6842-564-299 2/12/01 A
6842-564-299 4/17/03 A
6724-312-765 9/5/02 B
6993-411-772 7/21/03 A
The first 2 records above have a duplicate PIN. So I want
to delete the one with the earliest date and keep the
other. Can anyone tell me how to do this in SQL Server
2000. Any help would be greatly appreciatedSo many choices :)
Assuming your table is called YourTable: Also assuming the sales date is a
string (if not you can remove the convert function.
delete YourTable
from YourTable
join
(select PIN, max(SALESDATE) as SALESDATE from YourTable group by PIN having
count(*) > 1) foo
on YourTable.PIN = foo.PIN and convert(smalldatetime,YourTable.SALESDATE) <
convert(smalldatetime,foo.SALESDATE)
Mark
"Shane Sprouse" <shane@.co.greenwood.sc.us> wrote in message
news:0b5301c3aa2f$ddad68e0$a001280a@.phx.gbl...
> Hello,
> Can anyone tell me how to delete records from a table
> based on dates. For example I have a table of property
> sales data. Each property could sell multiple times over
> several years. So, the ID # of the property would be the
> same each time it sold, but the sale date would be
> different. I only want to keep one sale record for each
> property ID # and I want it to be the latest sale date.
> Here is a sample:
> PIN SALEDATE TYPE
> 6842-564-299 2/12/01 A
> 6842-564-299 4/17/03 A
> 6724-312-765 9/5/02 B
> 6993-411-772 7/21/03 A
>
> The first 2 records above have a duplicate PIN. So I want
> to delete the one with the earliest date and keep the
> other. Can anyone tell me how to do this in SQL Server
> 2000. Any help would be greatly appreciated
>