Infopath 2010 How to get the total of fields with a Time Data Type in a repeating table - infopath

Please help... I am noob to Infopath coding and I am having a hard time with finishing a project. I have setup a repeating table where it should count the time spent for each activity. Below is the screenshot
I want to be able to get the total time for the column "Activity Time" and place it on the Footer of the repeating table. I already tried Googling for some answers but can't find one for a Time Data Type.
Thank you in advance.

Infopath cannot add time values into a total like that. You need to convert the time values into numbers, then sum the numbers and convert the result back into a time value.
Step by step instructions are on the InfoPath blog from Microsoft here:
http://blogs.msdn.com/b/infopath/archive/2007/02/21/calculating-elapsed-time-without-code.aspx

Related

Find difference in days between two date fields in Infopath

Could someone help me with determining the difference in days between two date fields in InfoPath forms.
Usual subtraction doesn't work with the date fields. like DateField1 - DateField2. Any code or no code solution is highly appreciated.
There are ways to get difference of dates in InfoPath, but they are very complex and involve writing rules and parsing the date into month/day/year. Instead, I recommend this method described elsewhere that uses Excel Services. Because Excel is excellent at calculations, it makes sense to write the calculations in Excel and call the Excel document from InfoPath (if you have SharePoint with Excel Services).
Here are 2 sets of instructions on how to set up InfoPath and Excel Services. The instructions are long and/or copyrighted so I cannot include them here, but to summarize you would set up new Data Connections in InfoPath to use web services (SOAP) open the Excel document and set the date fields based on your InfoPath date fields and retrieve the calculated value from Excel.
Calculating date differences in InfoPath using SharePoint Excel Services
InfoPath and Excel Services
It took me about an hour to get it working because I had to do some trial & error with the Trusted Location settings.
I utilize a separate SharePoint list to help calculate the number of days between two dates in Infopath. This is so I can account for leap years and have the ability to just count work days, not all days. I update this list with new data once a year.
Here is the Excel file source for the list containing 2018-2020 data: https://1drv.ms/x/s!ApLhBloaS1wVgsUOMRrRfbekFftY9Q
Steps:
Import the first worksheet of the above Excel file as a new list in Sharepoint.
Add a receive data connection to this list from your InfoPath form.
For the first date, create a action to convert the date to a number in YYYYMMDD format. Assuming the date is stored as DateTime, you can use this formula:
floor(number(translate(substring-before(../my:endDate, "T"), "-", "")))
Query the list for the number value of the first date. Store this number in a field (column) in your form. (This field does not need to show in your form.)
Repeat steps 3 & 4for the second date.
Subtract the first date number from the 2nd, store this in a third column.
Note: The Excel file uses the formula "NETWORKDAYS" and includes columns for weekdays, weekdays minus US Federal holidays, and weekdays minus NYSE holidays. Now you can get the number of work days between two dates using one of these columns. If you live outside the US, you could add a column to the Excel for other holidays, such as UK bank holidays.

Pentaho: Get System info - get previous month

As the title suggest, I would like to get the previous month using the given month from Get System Info. I used Get System Info step to get todays month and year, and from there I would like to get the previous month. This is so it would be dynamic and I can ran this any day and still get the correct filter rather than making a hard coded year and month. Is this possible? If so, how do I do that?
Here is how I did it. This is the overview
Here is the calculator:
And concatenate fields:
There is still a few loop hole on getting the previous month during January. But, that is how I did it.

Need daily totals via web app date range query

Newbie Question! I'm using the web api I'm able to get the entire totals over a date range, but I want the daily totals too! Sounds simple enough, but I can't get it. Trying
https://www.googleapis.com/analytics/v3/data/ga?ids=ga:AAAAAAA&start-date=2013-09-20&end-date=2013-09-30&metrics=ga:visitors,ga:visits,ga:bounces,ga:newVisits,ga:entrances,ga:pageviews,ga:uniquePageviews,ga:timeOnPage,ga:exits,ga:timeOnSite&query(start-date,end-date)&access_token=XXXXX
I can see in the console that I have data on more than one day during this range.
It appears you can add a "dimension" of ga:date (or week or year) that will return that granularity of detail to the queries.

SharePoint list column calculation based on the last entry (previous row)

I am trying to add a column to my SharePoint list to caculate the change in tonnage from the last entry.
For example, assume that the last entry was made about two weeks ago (1/15) and I am making new entry today (2/1). How can I add a column that will caculate the difference between the tonnage entered on 1/15 and the tonnage being entered on 2/1?
I understand that this may be difficult to do, but please let me know if there is any possilbity. Or if there is another tool in SharePoint that will help me cacluate the change over time.
Please help.
Thanks.
I can't think of a way to do it with SharePoint Designer. But if you implemented an ItemAdding Event Receiver, you could look up the value of the previous entry, perform the calculation, and store the value in your column.

Drupal: Custom date widget?

I'm trying to create a custom date widget. Users can only chose a date from the next 10 days. So, instead of making them chose year, month, day, hours and minutes I want to have a single select list for the date (next 10 days) and two select lists for the time (hours and minutes).
Here is what I'm trying to achieve:
http://i52.tinypic.com/jikrv7.png
This is not just about changing date field settings (like granularity), I'm pretty sure I'll have to write some code to have correct dates in the select list (there could be 5 days from the current month and 5 days from the next one), and then correctly handle everything after user submits data.
What's the best way to achieve this? Where should I start from?
I would greatly appreciate any suggestions.
Thank you!
You need to implement hook_widget and possibly hook_widget_info and hook_widget_settings. Also have a look at CCK for developers.

Resources