Tuesday, September 18, 2012

Substring in InfoPath

To get a value AFTER a character
substring-after(FieldName, ";")
This will return all text after the character ;

To get a value BEFORE a character
 substring-after(FieldName, ";")
This will return all text before the character ;

Substring and Concatenate

I often use Concatenate to join text from two fields. For example, the Date function now() has a "T" between Date and Time. I usually create a new field where I use substring and concatenate to replace the T with a space. Formula:

concat(substring-before(DateTimeField; "T"), " ",substring-after(DateTimeField; "T"))

This gives me the date and time in one single field with a space between.


Working with Date formats in InfoPath

To extract the day number of a date

number(substring(DateField, 9, 2))

To extract the month number of a date
number(substring(DateField, 6, 2))

To extract the year number of a date
number(substring(DateField, 1, 4))

Calculate hours

addSeconds(now(), 7200)

Get the month name from a date (and time) field


Get three characters of the month name

Sort or group a view by month name

To sort, add the month number in front
=TEXT(month([DateField]); "00")&" "&TEXT([DateField];"mmmm")

Add two calculated columns that will take the start and the end of the month.

"Start of Month"  =DATE(YEAR([DateField]), MONTH([DateField]), 1)

"End of Month"    =DATE(YEAR([DateField]), MONTH([DateField])+1,1)-1

Add a filter in the view:
"Start of Month" is less than or equal to [Today]
"End of Month" is greater than or equal to [Today]

Sunday, September 16, 2012

Error in the personal information on MySite

If you see this error on the MySite and personal information page:

"There was a problem retrieving data for this field. Updating values in this field is disabled temporarily. You can still update values in other fields."

Then something is wrong with the Managed Metadata Service. Clicked on the service app for Managed Metadata service and got the following error:

So check the following things to fix this:

* In CA, Services on server, restart the Managed metadata service

* In CA, verify that the Service Application is associated to the MySites web app
* Is the Application pool started

* In EventViewer, look for errors. I had this error (8088, The managed metadata service is inaccessible):

* So that error in Event Viewer made me check the Site Collection Administrators on the Content Type hub site, and the service account was removed (for some strange reason...) so I added the it again, and the Managemed Metadata and MySite started working immediately: