INFOPATH TO DISPLAY DATE OF SELECTED DAY.

 I have created a infopath form like below

START DATE :

Happens Every: textbox drop down Weeks (Mon,thue,---sun)

Due Date :

Now when the user selects Start date as 7/1/2013, In the text box if he gives 3 and from drop down he selects Thuesday.

Now in Due Date it should display Next week Monday date i.e (7/8/2013).

Similarly for Months. Can you please help me with a fromule in infopath form

Attached is the image of my form. please help me it is urgentMY INFOPATH FORM

July 7th, 2013 6:30am

Hello,

InfoPath does not handle date calculations well. Other than the out of the box AddDate() function, there is no easy way to calculate a date. 

You would need custom code for that functionality.

cheers,

Free Windows Admin Tool Kit Click here and download it now
July 7th, 2013 9:17pm

Hi Teylyn,

Thanks for your reply. Can you please help me to achieve the same .. A hello world example is also ok

July 8th, 2013 6:21am

Sorry, I don't do code. 
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2013 6:25am

I Have written a c# code but how can i use it in List infopath form.

In Sharepoint LIST infopath i could not get the code editor.

 public  String GetNthWeekdayOfMonth(DateTime EnteredDate, int Number, DayOfWeek weekday)
        {
            String error = "";

            var days = Enumerable.Range(1, DateTime.DaysInMonth(EnteredDate.Year, EnteredDate.Month)).Select(day => new DateTime(EnteredDate.Year, EnteredDate.Month, day));

            var weekdays = from day in days
                           where day.DayOfWeek == weekday
                           orderby day.Day ascending
                           select day;

            int index = Number - 1;

            if (index >= 0 && index < weekdays.Count())
                return Convert.ToString(weekdays.ElementAt(index));

            else
            
                error="The specified day does not exist in this ";

            return error;
        }

July 8th, 2013 8:07am

You cannot use code with List Forms.
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2013 8:22am

Hi sandy, 

You can try with the InfoPath form code behind(via VSTA) to calculate the filed value, here are two articles about this topic you can take a look.

Refresh InfoPath field after code-based calculation

Using the InfoPath 2010 Object Model and Visual Studio Tools for Applications

Thanks

July 9th, 2013 5:41am

Daniel, the Op has a Sharepoint list form. Can you clarify if your suggestion works with list forms?
Free Windows Admin Tool Kit Click here and download it now
July 9th, 2013 6:04am

Hi teylyn,

Sorry for I missed the "list form", list form cannot use the code in InfoPath.

Thanks

July 9th, 2013 6:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics