您的位置:首页 > 其它

zz: Calculated Columns - Displaying Images from oscar

2008-12-04 22:15 459 查看

Calculated
Columns - Displaying Images

by oscar 12/1/2007
12:51:00 PM

Recently, I was working on a project that required the creation of an IT
Project Management Site Template. I thought, hmm, pretty straight forward, but
wait, I ran into an issue that I am positive, could have been solved in other
ways (List Event Handler)

The requirement was to display an image based on a certain condition, and
this condition had to do with lookup of other List Column values.

If
you want to display images for a calculated column here are the steps you need
to take:

Modify the FLDTYPES.XML file(or make a copy of it!)

Search for the field definition "Calculated"

On the default rendering pattern, paste the following

<Switch>
<Expr>

<GetFileExtension><Column/></GetFileExtension>

</Expr>
<Case Value="giF">

<HTML><![CDATA[<IMG SRC="]]></HTML><Column
HTMLEncode="TRUE"/><HTML>"</HTML>
</Case>

<Default>
<Column HTMLEncode="TRUE" AutoHyperLink="TRUE"

AutoNewLine="TRUE"/>
</Default>
</Switch>
Create a new Column of type Calculated - put some logic in it like so

=IF(AND(Impact="3",Probability="1"),"/_layouts/images/KPIDefault-1.giF",

IF(AND(Impact="3",Probability="2"),"/_layouts/images/KPIDefault-2.giF",

IF(AND(Impact="3",Probability="3"),"/_layouts/images/KPIDefault-2.giF",

IF(AND(Impact="2",Probability="1"),"/_layouts/images/KPIDefault-1.giF",

IF(AND(Impact="2",Probability="2"),"/_layouts/images/KPIDefault-1.giF",

IF(AND(Impact="2",Probability="3"),"/_layouts/images/KPIDefault-2.giF",

IF(AND(Impact="1",Probability="1"),"/_layouts/images/KPIDefault-0.giF",

IF(AND(Impact="1",Probability="2"),"/_layouts/images/KPIDefault-0.giF",

IF(AND(Impact="1",Probability="3"),"/_layouts/images/KPIDefault-1.giF","other")))))))))

NOTE: The Impact and Probability are columns in the
SharePoint List. Based on this logic, I am re-using the images from the KPIs in
MOSS and simply pointing to them.

And that's it! You now can output
images for your List. Here is how it looks





Technorati
Tags: wss 3.0,moss 2007,calculated
Fields,caml
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: