Digging into Microsoft Office SharePoint Server 2007 (MOSS 2007), Windows SharePoint Services (WSS) v3.0, Windows Workflow Foundation (WF), Microsoft Dynamics CRM, and InfoPath 2007.
Working on that demo app, this came up - I wanted a number rounded to the nearest 1000. This is easy enough in Excel - the ROUND function takes negative values, so that =ROUND(2009,-3) will give you 2000. The Math.Round function in System.dll doesn't offer this functionality however - you have to implement that yourself. Here's an example of one way to do this:
using System;
staticclassProgram
{
staticvoid Main(string[] args)
{
double d = (double)newRandom().Next();
// round to the nearest 1000
Console.WriteLine("{0} rounded to the nearest thousand is {1}", d, Round(d, -3));
// round to the nearest 100 etc
Console.WriteLine("{0} rounded to the nearest hundred is {1}", d, Round(d, -2));
}
staticdouble Round(double value, int digits)
{
if ((digits < -15) || (digits > 15))
thrownewArgumentOutOfRangeException("digits", "Rounding digits must be between -15 and 15, inclusive.");
if (digits >= 0)
returnMath.Round(value, digits);
double n = Math.Pow(10, -digits);
returnMath.Round(value / n, 0) * n;
}
staticdecimal Round(decimal d, int decimals)
{
if ((decimals < -28) || (decimals > 28))
thrownewArgumentOutOfRangeException("decimals", "Rounding decimals must be between -28 and 28, inclusive.");
Back in November we released HubKey's Client-side API for SharePoint. This API wraps many of SharePoint Server 2007's Web Services (Lists Web Service, Webs Web Service, etc.) to provide a familiar object model that can be used on remote client machines without having to process XML requests and responses.
We've recently made a few updates and have included a demonstration application which is shown running in the screen capture below. This demo app creates a new list on a remote test site with a quick launch link, creates a "test person" list scoped content type, adds a number of randomly generated people records, and then adds a new default view with a custom query returning people below age 65. This list data is then browsable and editable by a DataGridView hosted in a Windows form. In addition, paging is demonstrated by using the SPListItemCollectionPosition object.
You can download a demo copy of the API - click here for details.
One feature commonly requested by users of Microsoft Dynamics CRM is a total of the number of records in a view or advanced find.
Out-of-the-box, MS CRM 4.0 displays both a count of the number of records selected on the page, and the total number of records on the page, both of which are visible in the status bar at the bottom of the results grid for the view. A count of the number of records in total is missing however, as is the total number of pages available.
HubKey's new Record Count Add-on for Microsoft Dynamics CRM 4.0 meets this feature request by including both the current page number, the total pages, and the total records in the status bar along side the record selection count.
This add-on is simple to install, can be configured to exclude certain entities, and supports configurable multiple user interface languages. The totals are calculated for quick and advanced finds, lookup views, and both private and public views.
A demonstration of the installation and use of the add-in is shown in the screen capture below:
To download a free trial version of the software and get a 30 day license key, click here.
To purchase a full retail server license key for $350 (per CRM organization), please use HubKey's application web store on this page or contact us at HubKey for more information.