Ceiling function in SharePoint CAML query - sharepoint

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?

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.

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.

Related

Changing portlet item color scheme based off of date

I am trying to change the colors of lines displayed in my portlet based off of a date range. The following are examples of what I am trying to do.
within the last 7 days - green
greater than 7 days - red.
I have tried the following expressions :date - 7 and it does not work, I am assuming as there is not an overloaded operator to handle the subtraction between a date object and a integer. Also for the expression field, can it handle function calls? As I have also tried to use getdate() which does not work here.
Assuming you are talking about a ResultSet portlet on a Start Center, date math has historically been abysmal in this context. You would be better to write an Automation Script to support a new Function and then call your Function from an Attribute Formula. You can then do your color coded rows against the integer attribute you associated to the Formula.
The only thing I found lacking in the relevant Help and product documentation was that your script needs to return its calculation result in a variable called retval or whatever it is for Custom Condition launch points.

React-Virtualized using cellmeasurer with a maximum width?

Is there any way to use react-virtualized's CellMeasurer with a maximum column width which then made the height expand?
For example, I may have an id field in column one of the grid. This would never grow too large, but I want to size it based on the largest value. Then in column two I have a text field that I am not too sure how large it will be. If it turns out that all of my current data set has a small value in column two, I'd like to size based on the largest value. If it happens to have some larger text (over a certain width) I'd like to use that maximum width, and then expand the row's height to accommodate the lines text.
From what I can see in the docs and code, this type of feature isn't supported. If this is the case, I think my best method would be implementing my own CellMeasurer with a slightly more complex _measure function. Does this sound like the proper course of action?
You should be able to do this by adding a style constraint to your rendered cell. CellMeasurer just measures what the browser reports- and CSS controls the browser's max width.
React might freeze the style object too so use spread rather than directly modifying:
style={{
...style,
maxWidth: 300
}}

how to display sum of field in axgridview

I'm working with Microsoft Dynamics AX R3,2012 and i want to add a group by field in an dynamics:AxGridView then a sum for a certain field by the group field indicated then the total sum without the group by .Please help me .i didn't find a solution.like what described in this page http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm
You can create a display method to compute your sum on each row. If you do so, don't forget the 'cacheAddMethod' in order not to compute it each time. This is the "historical" way.
More info on display methods.
Or you can create a view and use computed column in it. It will depends on your current datamodel and query you want to run.
More info on computed column in views.
Thanks for your reply,My Problem is not to create display method but the Problem is how to display the sum of subtotal by this display field.So my solution is to add GroupField in the AxGridView with designed field like GoalId in my case.then in the AxGridView i create template field with footer containing label not visible in default. So in rowdatabound i do the total by the new group that known with a test in rowcreated in GoalId 's value changes .Then when i get a new group i put the value of cumul of the previous value of a the previous group and in the footer template i display the total of all rows.this is the solution and thanks so much for your help. but now the problem that i noticed that axgridview have problems after updating data with a groupby fields and with template field.it display noting in this fields

Ignoring NaN in number field on Validation of InfoPath form

I have a Purchase Order form which I need to calculate any entered values automatically (for totals, tax etc). Problem is, some of these fields in the InfoPath form have their default values as a calculation for this purpose. Fine.. but the problem then arises when a line is blank (there are 12 lines in the form but not all may be used in one PO). If a line is blank then the calculated fields will of course, display 'NaN'. For example the Quantity and Price fields are multiplied to make the total, then the total is multiplied by the tax percentage to get the net total. I attach a screenshot below for ease of understanding:
This is fine when it's line 1, as line 1 will definitely be filled in, but not for the others. See line 6 as a demo which is causing this problem. I have tried no default and '0' in the static fields, but neither works unless I put in an integer in (which then confuses users). The form validation insists that a number is in the number fields (not 'NaN'), so is there any way I can either ignore that on form validation, or find another workaround to solve this issue?
For reference, the calculations input as the default value for these are as follows:
Quantity: 0
Price per item: 0
Pre-tax price: Line6Quantity * Line6Price
VAT: (Line6Total - Line6SubTotal) / Line6Total
Line total: Line6SubTotal * (1 + Line6VAT)
As you can see, the VAT/Line Total fields are designed to be interchangeable, so people can fill in either/or. The form is being filled in from SharePoint.
Hope this all makes sense; help much appreciated.
You can make an easy workaround by checking the value in a function called before the form is submitted. So add an onClick="checkForNaN()" function to your submit form.
The isNaN() function should come in handy as you scan through the input boxes to check whether they evaluate to NaN. If so, simply change them to something acceptable to your form validation code.

force breaking a string in a fixed width Gridview cell

I have a Gridview control on an ASP.Net page with fixed width cells. The data coming from the database occasionally comes over as a contiguous string of characters. When there are dashes in the string, it will break so as not to upset the width of the layout. If there are no dashes (specifically, I'm dealing with underscores), the string will not break and forces the cell to widen out, thus upsetting the layout of the page. Is there a way to tell the cell to keep its width and break the string? As it stands, I don't have access to the field's data directly, as the GridView bind its datasource to a dataset object coming from the database. Thanks for any feedback.
If you handle the RowDataBound event you'll be able to break the string "manually". Otherwise it'll only break based on "HTML rules".
First thing to note is that this doesn't have a lot to do with ASP.NET but is rather a pure HTML (and CSS) problem.
A possible solution is to use the css attribute table-layout: fixed and set some fixed width values to all columns. The disadvantage of this approach is that the total table width is fixed so it doesn't scale with the window size.
Another possible approach is to display in columns shorter strings using a utility function that cuts the long strings to a maximum length.

Resources