Haaron Gonzalez Rotating Header Image

Support

Formulas to get the first and last row on a repeating table in InfoPath

You know, you wake up knowing that is going to be a wonderful day working for a customer with the software products you love. During today on-site support session, you found out that is needed to write some good old XPath formulas on an InfoPath form.

There is a repeating table with the columns necessarily to describe travel information like Departure Date, Return Date, City, you named and the requirement was to expose the initial Departure Date and the last Return Date of the entire trip, so, what do we mean with entire trip? I maybe start a trip from San Diego to Mexico City, and then another trip from Mexico City to Seattle and then from Seattle to Las Vegas. Clearly, the Departure Date and Return Date are not associated with just one row “trip” in the repeating table because I have at least more than one row for describing all the trips.

The data structure of the repeating table is:

 

 

structure

So, here are the formulas to get the first and last row on a repeating table.

../my:TravelInfo/my:TravelInformation[count(preceding-sibling::my:TravelInformation) = 0]/my:DepartureDate

../my:TravelInfo/my:TravelInformation[count(following-sibling::my:TravelInformation) = 0]/my:ReturnDate

Fortunately, the approach work as a charm. No C# code saved the day today. Pure old good XPath did it. InfoPath, you are definitely the sunshine of my love, especially now that you will be supported until 2026 baby.

 

A quick tale from the SharePoint support trenches

Basically, the customer had a workflow, build in SharePoint Designer 2010 that will use some of the out of the box Actions like the Pause for Duration and Send Email. The issue was that once the workflow paused for a minute it wasn’t able to resume the work, leaving the workflow always running “In Progress”. Doing some research found KB2674684 SharePoint 2010: Workflow failed to run after pause and according to the description made me remember my good old ASP.NET developer days.

The bottom line is that SharePoint on premise is ultimately a Microsoft ASP.NET solution that works with multiple windows services and related Microsoft technologies/servers. From the web perspective Web Server Controls, Web User Controls, HTTP Handlers, Web Services, AJAX, ASPX pages, assemblies, web.config, page directives and so on are just pieces that work together to deliver a page that end users to consume.

Turns out that if you have the Workflow Timer Service started on a server that is running as an Application Server role “App” and you don’t have the SharePoint Foundation Web Application service started “basically the WFE role”, workflows will fail rehydrating the workflow when resume from a pause action, the reason why?, is because in order to rehydrate a paused workflow SharePoint needs to read some settings from the running web application web.config file, but because we have only the “App” role and not the “App/WFE” role running, it fails loading from the required Web Application the web.config file, because THERE IS NO web.config to load for that particular web application in the App server. The App Server without the SharePoint Foundation Web Application Service started only has available the Central Administration web application, not those additional web applications that WFE have available in IIS as a web site.

According to the article there are three methods for solving this issue:

  • Method 1: Locate one Web Front End server, which has Web Application service running, run the following PowerShell command to copy workflow-related configuration from the web.config to the configuration database so it will be available from every server in the Farm.

$webapp = Get-SPWebApplication -identity http://<web app name>

$webapp.UpdateWorkflowConfigurationSetttings()

  • Method 2: Start the Web Application Service on all servers that have the Workflow Timer Service is running.
  • Method 3: Disable the Workflow Timer Service on servers that are not running the Web Application service.

I decided to use Method 3 because we have dedicated App server and dedicated WFE server.

By the way, if you have Nintex Workflow installed in your farm, what just explain also apply. Nintex Workflow should run only n WFE servers, so make sure you Workflow Timer Service is stopped on all app servers in your farm.

Thanks for reading!