Thursday, January 26, 2012

'NaN' in InfoPath Decimal/ percentage field

In InfoPath 2007, we used to get NaN in our calculated decimal fields. So, I tried to add a Rule to check if the value is NaN and replace it is with '0' if it is true. However, there is no option to check if the value of a decimal field with a text NaN
NaN error in calculated decimal fields

So the workaround for this is, change the field type to text and add the rule as below. After creating the rule, again change the field type to Decimal.

NaN error in calculated decimal fields

Wednesday, January 25, 2012

Sumproduct in InfoPath 2007

An workaround to do similar to excel Sumproduct function in InfoPath 2007

We had a requirement to calculate the sum of product of 2 column in a repeating table. See the screen shot below

Sumproduct in InfoPath 2007

Sales Tax is a Decimal field with Percentage format enabled
Quantity is an integer
Purchase Price is Decimal field
Monthly Total is Decimal field

We want the Monthly Total value to be
Monthly Total = Sum(Quality * Purchase Price) * percentage of Sales Tax

Since there is no option to do the sum(Quality * Purchase) in InfoPath as  SUM XPath function takes only a node set as parameter, I've created a field named QuantityPurchasePrice to have the product of Quality and Purchase Price and made the field hidden by setting the conditional formatting as below

Sumproduct in InfoPath 2007


Now apply the following formula in the Total field

sum(QuantityPurchasePrice) * (1 + SalesTax)


..and with some sample value, the output is

Calculate Sumproduct in InfoPath 2007



Monday, January 23, 2012

unbound (control cannot store data)

Scenario: In Design view of a InfoPath 2007 form, had several controls within a table and the table is placed within a section control. Deleted the section control and got the following error in all the controls within the section

Issue: Error in controls as "unbound (control cannot store data)"

Reason: The controls has unbind

Resolution: Right click each control, click Change Binding and from the data source, select the appropriate field in which to store the control data .

InfoPath Change Binding

Tuesday, December 27, 2011

The transaction log for database 'SharePoint_Config' is full

Scenario: Tried to change web application settings from Authentication Providers page from Central Administration

Problem: Received the error "The transaction log for database 'SharePoint_Config' is full" when tried to save the updated settings.

Resolution: Found that the drive that containing the config database log is having very few space remaining.
Following steps helped to resolve this issue

1. Do full backups of all the SharePoint databases.  
2. Open the database, right click SharePoint Config database > Properties
3. Select Simple under Recovery model list > Click OK
4. Right click the database,  Tasks > Shrink > Files
5. In File type select Log
6. Click OK

Refer to the following post for more information

Monday, October 31, 2011

Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be restored to a server with version '12.0.0.6535' or later.

I tried to backup and restore a site collection from our production server to development. Our production is MOSS 2007 64 bit and Development is MOSS 2007 32 bit.

I got the following error when tried to restore the backed up file

"Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be  restored to a server with version '12.0.0.6535' or later."

When I checked the version of each SharePoint site Site Actions > Site Settings, both had different versions. In order to have a successful restoration, we need to sync both the SharePoint versions.

Site Version

We were having version 12.0.0.6535 in production and 12.0.0.6421 in development.


I have fixed the issue by installing KB983444 which brought the MOSS 2007 to version 12.0.0.6535.
Run the Config wizard after  patch/hotfix/kb applied.

I'm able to use stsadm to restore from my backup into the new MOSS 2007 site.

Reference:
http://technet.microsoft.com/en-us/security/bulletin/MS10-039

http://www.microsoft.com/downloads/details.aspx?familyid=3841ceda-d0af-4e5e-8a1a-7dd954850783

Monday, October 24, 2011

The file '/_Layouts/Bamboo.ProjectPortfolioDashboard/HandleDataForCharts.ashx' does not exist.


Issue: We have installed the Bamboo's Project Portfolio Dashboard solution in our production environment without any issues, however, when we add the Web Part, the images in the Web Part were not loaded and getting the following error

The file '/_Layouts/Bamboo.ProjectPortfolioDashboard/HandleDataForCharts.ashx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.SimpleHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

Note: Our SharePoint site is SSL enabled. The WebPart is working in http and not on Https. When contacted Bamboo we have been told that the issue is not with their setup and it is with our environment.

Resolution: We checked that the file HandleDataForCharts.ashx does exist at the _layouts folder. We finally found out that an HttpHandler entry is missing in the web.config file

We were able to  resolved the issue by adding the following web.config entry under <httpHandlers> section

<add verb="*" path="*.ashx" type="Bamboo.HandleDataHelper.HandleDataForCharts" validate="false" />

The following link http://msdn.microsoft.com/en-us/library/bb515343.aspx helped us to resolve the issue

Friday, September 30, 2011

Create multi level approval workflow in SharePoint 2010 using Visual Studio


Requirement: We have a requirement to create a Multi-level approval workflow for document libraries. I need to use SharePoint groups for each level of approval/review as there are multiple users need to review the document and approve and don't want to hard code the SharePoint groups. Can we create a custom workflow section where I can set the 'level of approvals' and 'Approvers' for each level when assigning a workflow for a document library

Solution: Create a workflow association page using VS.NET 2008. Refer to my previous post for more info.

Attached the screen shots of final output
Page 1:
Create Multi-level Approval Workflow

Page 2:
Create Multi-level Approval Workflow

The codebehind page of the association page (aspx page) will have the code to create SharePoint groups for "Reviewers"(1st level approval) and "Approvers"(2nd level approval) on submit. All the workflow related activities is handled in the Workflow coding.