SharePoint components - business processes without development, InfoPath, SharePoint Designer or workflows. SharePoint Services, SharePoint Foundation & SharePoint Server 2010-2016.

August 2013
Current page:
 

New types of functions in Value Picker

By: Vladi Gubler | Comments [2] | Category: Products | 8/12/2013

Hello,

NOTE: For more info on value picker, read documentation.

Value Picker is used in many of our product to provide a convenient, powerful and error-free way of entering values for assignments, conditions and fields. For instance, you use it when you set conditions for tab/column permissions in Smart List Pro, alerts in Smart Alert Pro or actions in Smart Action Pro. About 7 different products currently use this convenient component. It looks like a regular text field with an icon next to it.

Value Picker Field

You can type in the value or click on the icon and open up a pop-up to choose columns and functions.

Value Picker Popup

The picker validates the entered value, making sure there are no grammatical errors and that the returned value is of the correct type. For instance, when entering a condition for a date/time column, the value must return a valid date/time.

Your value can be made up of simple text, column value (just pick a column from the left side) and functions (on the right). There are many powerful functions to choose from, such as [Me] (returning the current user) or $Year([date column]) (returns the year part of the date value. You can even use simple arithmetics, such as [Amount]+100.

SO WHAT'S NEW?

The exciting news are that we are rolling out a whole bunch of new functions for you to employ. Let me just overview them all:

$Year(DateTime)
Returns the year (number) from a date column value. E.g. $Year([Created]) - returns the year an item was created.

$Month(DateTime)
Returns the month (number) from a date column value

$Day(DateTime)
Returns the day (number) from a date column value

$Weekday(DateTime)
Returns the weekday (text) from a date column value. E.g. returns Saturday (it will be in the language of your website).

$Hour(DateTime)
Returns the hour (number) from a date column value. The value will be in 24-hour format.

$Minute(DateTime)
Returns the minute (number) from a date column value.

$WeekNumber(DateTime)
Returns the number of the week in the year (1-52). The numbering starts according to the regional settings of the site.

[Today]
Returns today's date

[Current User] or [Me]
Returns current user for assignment or conditions, e.g. Where Created by Equals [Me].

$Lookup(LookupField|DisplayField)
Returns the value of a column from a list used in a lookup column in the current list. Consider the following: Leave Requests list uses a column Department, which is a lookup to Departments list and shows the values from its Title column. The Departments list also contains an another column, Abbr, which is used to store abbbreviated names of the departments (such as SL for Sales or MK for Marketing). $Lookup([Department]|[Abbr]) will return the abbreviated name of the currently selected department. This is very useful, for instance, for generating IDs or referencing manager names.

$Extract(Text|Pattern)
Extracts a portion of text according to a pattern. Your pattern can provide the required prefix and suffix surrounding the text you are looking for. For example, your Body column contains the contact name after the word "Contact:". $Extract([Body]|?Contact:^\r) will return the text from the word Contact: until the end of the line from anywhere within the column. It will ignore any HTML markup if present.
? - indicate that the prefix can be found anywhere within the text. When ? is not included, the prefix must be at the beginning of the text
Prefix - optional, any text immediately preceding the extracted value
^ - value to extract
Suffix - optional, any text immediated following the extracted value. When omitted, spaces, commas, periods and line breaks are considered the suffix. \r is the special character indicating that the suffix must be the line break (spaces, commas and periods are included in the extracted value).

[List Title]
Returns the name of the current list

[Site Title]
Returns the name of the current site

[List URL]
Returns URL of the current list

[Site URL]
Returns URL of the current site

$Left(String|Length)
Returns the specified number of character from the beginning of a literal or column value. You can include column names for both arguments or even use functions within functions.

$Right(String|Length)
Returns the specified number of character from the end of a literal or column value. You can include column names for both arguments or even use functions within functions.

$Substring(String|Start|Length)
Returns the specified number of character starting from the a specific position within a literal or column value. You can include column names for all three arguments or even use functions within functions.

$Contains(String|String)
Returns whether or not (yes/no) the second argument value is found anywhere within the first argument value. You can include column names for both arguments or even use functions within functions.

$Find(String|String)
Returns the position (number) of the second value within the first value. If the value is not found, -1 is returned. You can include column names for all three arguments or even use functions within functions.

$GetValue(URL|ListName|ItemID|FieldName)
Returns a field value from an arbitrary list
URL - optional, URL of the site. When omitted, current site is assumed, you must still include the pipe | character. In principal, you can provide URL of any site, assuming the user will have the necessary permissions to access it. Column values and functions are also permitted.
ListName - name of the list to query. Column values and functions are permitted.
ItemID - ID of the item to retrieve. Column values and functions returning a number are permitted.
FieldName - name of the column to get the value from. Column values and functions are permitted.

$Text(DateTime/Number|Format)
Convert datetime or number value to string according to the specified format string. The format strings are according to Microsoft .NET specifications, e.g. given a date column value, dd-MM-yyyy could return 01-01-2013

$AddDate(DateTime|Amount|Unit)
Add/subtract value to a datetime value, e.g. $AddDate([Created]|10|day) will return the date 10 days after the Created date of the item.

$If(Boolean|Expression|Expression)
Returns either expression A or expression B result depending on the value of the boolean argument. All 3 parameters can be literal, column values or functions. For the boolean parameter you can even use comparison, such as [Amount]>10 or [Approval]!=Approved.

As you can see, the functions provide powerful capabilities for doing more with your SharePoint.