Question

I am trying to create a custom view for a sharepoint list, similar to the one explained here:

http://msdn.microsoft.com/en-us/library/ms916812.aspx

I have a column which is a number field with values ranging from 0 to 100.

I need to create a view style which will display an image in the column based on the column value, instead of displaying the value.

If the value is in between 0 to 25, i need to display an image 25.gif If the value is in between 25 to 50, i need to display an image 50.gif ..... and so on.

The calculation involved here is the CEILING function, CEILNG(NumberColumn,25)

The problem is, I need to specify this in CAML, in the VWSTYLES.XML

How can I specify the Ceilnig function in CAML?

Was it helpful?

Solution

Some other options could be:

As the VWSTYLES.XML is just a really awkward way of rendering html, you could code some javascript into your VWSTYLES.XML to render the image tag with the correct source.

Alternately, develop an ascx control and get the VWSTYLES.XML to render a control instead of HTML. So long as you can register the control on the page correctly.

OTHER TIPS

CEILING is used for rounding decimal values. Since you only have a few images, I would just use nested IF functions:

=IF([NumberColumn]>76, "100.gif", IF([NumberColumn]>51, "75.gif",
 IF([NumberColumn]>26,  "50.gif", "25.gif")))

You could also use the MOD function to convert 0-24 to 0, 25-49 to 1, etc. and calculate your image from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top