Showing posts with label status. Show all posts
Showing posts with label status. Show all posts

Friday, March 9, 2012

Dynamically Changing the Picture at the Record Level.

Hi,
Appreciate your help on the following.
I need to display images according to the status of the record. For example,
I am displaying product list where the margin is less than 15% then display
image1, when margin is between 16% and 25% display image2 etc. I am currently
using a table to store the path of the images.
Thank you again,
KG@.SF
Highly appreciate your helpI also have to develop similar concept but Matrix report where I have to
again display image indicators when a category of product margin falls betwen
a certain range. Appreciate your help,
KG
"KG@.SFC" wrote:
> Hi,
> Appreciate your help on the following.
> I need to display images according to the status of the record. For example,
> I am displaying product list where the margin is less than 15% then display
> image1, when margin is between 16% and 25% display image2 etc. I am currently
> using a table to store the path of the images.
> Thank you again,
> KG@.SF
> Highly appreciate your help

Sunday, February 26, 2012

dynamic update

i have a table with the following values

iden nam status
-- -- --
1 pp NULL
1 kk NULL
2 rr NULL
2 nn NULL
2 jj NULL
3 hh NULL

now i want to update the status cloumn in this table in such a way that the status colum = 'Status is' + iden + nam for all distinct values of iden from the table

how can we do this without using a cursor?

Here it is,

Code Snippet

Create Table #data (

[iden] int ,

[nam] Varchar(100) ,

[status] Varchar(100)

);

Insert Into #data Values('1','pp',NULL);

Insert Into #data Values('1','kk',NULL);

Insert Into #data Values('2','rr',NULL);

Insert Into #data Values('2','nn',NULL);

Insert Into #data Values('2','jj',NULL);

Insert Into #data Values('3','hh',NULL);

Update #data

Set

[status] = 'Status is ' + Cast(iden as varchar) + ' ' +nam

Select * from #data

|||

The most important question is why would you want to do that? It is both unnecessary, and not a good design consideration to store data that is easily 'computed' from existing row data.

Use a VIEW instead.

CREATE VIEW dbo.vMyTableView

AS

SELECT

Iden,

Nam,

[Status] = 'Status is ' + Cast( Iden as varchar(10) ) + Nam

FROM dbo.MyTable

GO