Archive

Archive for the ‘Infopath’ Category

InfoPath Hyperlink Control: Show Hyperlink Based on Filtered Data

March 11th, 2010 No comments

In InfoPath, Hyperlink control does not support filtering data when you select a field for repeating group. But you can definitely avert this limitation using a trick. For example, I have secondary data source “Data” as xml file with the following content

<?xml version="1.0" encoding="utf-8" ?>
<Settings>
    <Setting Name="Users" Value="2" />
    <Setting Name="WebAddress" Value="http://blog.vishalon.net" />
</Settings>

Now I want to get a hyperlink out of “Value” attribute of “Setting” node whose “Name” is “WebAddress”. Read more…

Review of InfoPath forms functionality in Business Productivity Online Suite (BPOS)

November 13th, 2009 No comments

I got some hands on experience about Business Productivity Online Suite(BPOS). Its a great tool for small companies who wants to have exchange server, office communicator, sharepoint and live meeting for their business needs. I do have experience with SharePoint and InfoPath but this assignment was quite challenging.

Well, What’s the challenge?

  1. New assignment requires me to use InfoPath forms to reduce client’s paperwork.
  2. Many bloggers have written that InfoPath form is not supported in BPOS standard suite.
  3. Client does not want to invest in buying InfoPath. Many of client users are contractors and client does not want to buy license if they need to.

So how I am going to do?

InfoPath is supported in BPOS standard suite. Even browser enabled InfoPath forms are supported.

So why am I writing review?

Well, even though InfoPath is supported, there are lots of limitations that I want to share with you. Of course, if the client would have got InfoPath license, my life would have been much easier but I love challenges. I had previously not worked with browser enabled form so it was a new concept for me. When I initial though of creating solution, I thought that InfoPath form is backed by .Net power so I don’t need to worry about anything and I will quickly put the solution but I was wrong. Here is a good list of InfoPath 2007 features those are not supported in InfoPath Form Service. This is a limitation of Form Service. On the top of it, there is a limitation of BPOS which cripples how we develop the solution.

Here is a list of limitations of InfoPath form Service and BPOS that I confronted so far.

  • I cannot use any kind of .Net code
  • I cannot retrieve data from SharePoint List/Web Service (throws evergreen LogID 5566 error. This error occurs because of certificate name – as per support response) using custom views.
  • Some of the controls are not supported in browser enabled forms.
  • BPOS does not support data connection library in standard suite so I have to manually change the URL while moving forms from staging site to production.
  • Browser enabled form does not support mobile view.

Here is a list of what you can do with it?

  • I can only use Rules, Conditional formatting and Data Validations.
  • You can get all data from the list but not from particular view.
  • It supports multiple view. You can even hide view and open it (for example) by clicking on a button.

Subtract Time in Infopath

January 13th, 2006 2 comments

Infopath is a great tool for rapidly developing an application which
gathers information from the user. Many times these applications uses
start time and end time as their fields. Infopath has a “Time”
datatype. We can directly assign this datatype to the fields. You can
compare two fields of this datatype but substraction of fields is not
handled. You have to manually parse the field value, subtract the
values and change the appropriate fields. Here is the proposed solution
of this problem.

This solution contains 3 functions

  1. UpdateHours()
  2. convertJScriptNumberToXML()
  3. roundFloat()

Lets see all these functions one by one.

function UpdateHours(){
	var TimeIn = XDocument.DOM.selectSingleNode("/my:Time/my:StartTime").text;
	var TimeOut = XDocument.DOM.selectSingleNode("/my:Time/my:EndTime").text;
	var index1 = TimeIn.indexOf(":");
	var hi = TimeIn.substring(0,index1);
	var index2 = TimeIn.indexOf(":", index1+1);
	var mi = TimeIn.substring(index1+1, index2);
	index1 = TimeOut.indexOf(":");
	var ho = TimeOut.substring(0,index1);
	index2 = TimeOut.indexOf(":", index1+1);
	var mo = TimeOut.substring(index1+1, index2);
	var ti = parseFloat(hi) + (mi/60);
	var to = parseFloat(ho) + (mo/60);
	var tt = to - ti;
	var node = XDocument.DOM.selectSingleNode("/my:Time/my:TotalHours");
	if (tt != "" && node.getAttribute("xsi:nil"))
		node.removeAttribute("xsi:nil");
	node.nodeTypedValue = convertJScriptNumberToXML(tt);
}

As
the name suggests, this function updates the value of “TotalHours”
field. First of all, it will get the value of “StartTime” and “EndTime”
field. The value will be in the format of HH:MM:SS. So the value will
be parsed according to the position of “:”. Both the values will be
converted inot the float representation. Now value will be sutracted
and the result will be stored in “TotalHours” field.

function convertJScriptNumberToXML(value){
	var retVal;
	switch (value)	{
		case Number.NEGATIVE_INFINITY:
			retVal = "-INF";
			break;
		case Number.POSITIVE_INFINITY:
			retVal = "INF";
			break;
		case value:
			retVal = roundFloat(value,2);
			break;
		default:
			retVal = "NaN";
	}
	return retVal;
}

This function converts the actual number into text based value. Here he number will be rounded upto 2 digits.

function roundFloat(value, decimalPlaces){
	if (value < -1E15 || 1E15 < value)
	{
		return value;
	}
	else
	{
		var nPowerToRound = Math.pow(10, decimalPlaces);
		return Math.round(value*nPowerToRound)/nPowerToRound;
	}
}

This
function actually rounds the float value to the required decimal place.
To apply this code to your application, copy/paste these three
functions into the script file. In the “OnAfterChange” event of start
time and end time field, call the function “UpdateHours”.

Note: Please put the downloaded code in C:\

Categories: Infopath Tags: