Chapter 5 – Sharepoint Form Functions

Sams Info Path with Sharepoint 2010 – 02/13/2011, 09:05AM

Exploring various functions within InfoPath 2010. Functions enable you to manipulate, construct, or obtain data within your form. Can be used throughout Infopath in the following areas:
(1) default values for fields/controls
(2) calculated value control
(3) Naming the form instance on submission
(4) Rules

Sharepoint URL Function – use these functions to gain key path information

Inserting URL for root server, site collection, site and the list.

Calculate a Future Date – create a future date (x days from today, for example)
Use AddDays() with Today()

Or you can replace the Today() with a date field name

Get current Sharepoint User —
UserName()
e.g., setting the default value for a people/group picker. Note: userName() is case-sensative!!!!

In preview, the name is red – because it’s not validated yet.


Click this button to validate and it’ll turn black.

Or, if you assigned the default value of these two fields to username(), then it will be validated.

Removing leading or trailing spaces —
normalize-space()
e.g., normalize-space(firstname)

Remove all spaces from an entry —

Translate(firstname, ” “,””)

In a string (firstname), replace all white spaces (” “) with empty string (“”)

Default a blank amount to ZERO —
nz()

Set the default value to nz(.)
— “.” Meaning self, or this field.

Calculate the sum of all items —
sum() – to calculate the sum of a specific field in a repeating group/table.

sum(ItemAmount)

Also applies to: min(), max(), avg().

Count(GroupName) will tell you how many items (repeating rows has been entered. Use groupname as parameter.)

String functions:
Substring(text, find text)
Substring-After(text, find text)
Substring-Before(text, find text)
String-length()

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: