calculating date difference in Infopath 2007 excluding weekends ,h

R

Rao

i am new guy in Sharepoint. i want to calculate the date difference bn two
dates. and also excluding sat nd sundays, and public holidays.
plz help its very urgent.
regards
rao
 
S

S.Y.M. Wong-A-Ton

You'll have to write code to get this done. Look into using a TimeSpan
object. A Google search on "Date difference C#" and "TimeSpan C#" should
produce plenty of hits to get you started. Since public holidays differ per
country and per year, you'll have to somehow save those dates in a file or
database, retrieve them, and exclude them from your date difference
calculation.
 
R

Rao

Thank u for u r reply. i ll tryyyyy
rao

S.Y.M. Wong-A-Ton said:
You'll have to write code to get this done. Look into using a TimeSpan
object. A Google search on "Date difference C#" and "TimeSpan C#" should
produce plenty of hits to get you started. Since public holidays differ per
country and per year, you'll have to somehow save those dates in a file or
database, retrieve them, and exclude them from your date difference
calculation.
 
R

Rao

but my doubt is how integrate this .net code to infopath form.when i am
writingb the code in c# , can i open the infopath form in browser.
plz dont mind tell me cleary. in my project iam using event handlers to
store the data in database where the data is available in sharepoint list.
and also i am using sharewebsite iam opening in .net to retrive the data
from database to infopath form using Xpathnavigator concepts.
plz help .its very urgent
 
S

S.Y.M. Wong-A-Ton

If you're using a browser form, it is best to put the list of dates for
public holidays in a SharePoint list and then access that list as a secondary
data source from code in the InfoPath form. Reading from a file or a database
tends to raise security issues. You will need to admin deploy your form to
SharePoint if you use code.

Hope this helps. It is very difficult for me to understand what you really
mean, so if you still have questions, try posting them again.
 
R

Rao

thanx for ur reply
ok. let me clearly explain u.
now i wrote code in websrvices. it is working in websrvice. then i am
using dataconnection in infopath form. i am able to retrive the noof days
calculation result. but when i am in open in priview mode i am getting these
errors: 1.infopath contacted a datasorce but failed to retrive the data.the
form will load without requested data. 2. some errors were not applied.
here i cheked the automatically retrive the datab when form opend.
if i unchek this optin during establishing connection ,i am getting no
errors nd also no result,
after this i published this form in my site through document library.
, then i want see my infopath form in browser . how do , which link i hv
use???//
tell me clearly.
plz help
client is waiting for my result
plzzzzzzzz
regards
ravinder rao
 
R

Rao

hi
i solved the problem of leaves calculation through webservice. but
excluding holidays is not solved . u said na, put the holidays list in
custom list nd then compare. plz tell me how to do.
and more problem is when user enter the leave btween certain dates . dont
allow once again to apply leave btween those days.and i want display to the
user "u already applied the leave on this date" tell me the procedure. how
to do.
plz help me. its urgent
 
S

S.Y.M. Wong-A-Ton

If you created a web service, you can let the web service retrieve a list
from somewhere (it does not have to be a SharePoint list, but could be a file
or database table) and then filter out the holidays for you. Since I do not
know how you built the web service, I cannot make any suggestions for this.
My suggestion for using a SharePoint list was in case you used code within
the form itself.

I do not understand your second question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top