K2’s 4.5 Release – Inline Functions

Last October I had the privilege to visit the K2 Insiders conference. We all got to see a preview of K2’s new 4.5 release. Now (finally!) a targeted beta is available for selected partners, customers and insiders. This blog post will focus on Inline functions, a new feature of the 4.5 release which will be available for K2 blackpoint 4.5 and K2 blackpearl 4.5. The new release also features improvements to the designers, as you can read in Jey’s blogpost.

Why are inline functions so important?

To explain why inline functions are so important for K2, it is needed to provide some background. Way back before the South African development team started working on K2 blackpearl, a vision was created on how to design processes from a business perspective. The current K2 architecture has a lot of features that can be mapped to that vision. An example of this is SmartObjects. The vision shows that (enterprise) data should not be included/part of the process and should be referred from within the process. SmartObjects do just that, making live a lot easier when working with the K2 platform.

Another big part of the vision is to allow you to design processes without the need to write code. A lot of processes can be implemented without code, but I’ve had lots of occasions where I still needed to write small pieces of code. Within the new K2 designer for SharePoint and K2 studio, you’re unable to write code and you’re stuck going back to Visual Studio. This isn’t how K2’s vision was created and so a solution was needed to reduce the use of code and allow you to call (simple) functions.

What are inline functions?

Every wizard within K2 uses input fields where you can drag and drop items from the Object Browser to the input fields. Inline functions allow you to call simple functions inside those input fields. The functions are categorized in groups, so all the Date and Time functions are together and all the Text manipulation functions are together. A complete list of inline functions will be listed in the product documentation which will also be up on the knowledge base site. For now, you can check this blog post.

So, why is this so good?  Well, as stated in the previous paragraph, this will allow you to do more with the designers that do not support the use of code.

How do they work?

This youtube video will hopefully explain how you use inline functions while designing a process.

From a technical perspective, inline functions are executed within the workflow server.

[UPDATE] I forgot to share the video for the public, it should be better now :-)

But, the function I need isn’t there!

Ok, K2 can’t provide you with every function thinkable on the planet, but they always provide you with ways to extend the K2 platform. This is also the case with inline function! In the end, it all comes down to a simple .NET assembly with some class and method attributes. The developer reference will have an article/how-to on this.

Conclusion

I hope this blog post makes you understand how valuable inline functions can be when designing a process. For myself, it’s another way of doing things and allows me to create processes more easy and (in a lot of occasions) without code!

All Inline Functions in SourceCode.Workflow.Functions

New in K2 4.5 are Inline Functions!  In this post, you’ll find a list of all the inline functions and description from the SourceCode.Workflow.Functions assembly. Which is the assembly that we get with our K2 installation.

This blogpost is part of a post on inline functions and only for reference!

Text
Find Returns the index if the specified string is found within another string. Returns 0 if no match can be found.
Contains Returns a true value if a substring is found within another string.
Left Returns a subset of characters from the left side of a string.
Right Returns characters from the right side of a string.
Mid Returns a subset of characters from a string, starting at a specified index and continuing to the end of the string.
Mid Returns a subset of characters from a string, starting at a specified index and continuing a specified length.
To Lower Converts a string to lower case.
Length Returns the length of a string.
To Upper Converts a string to upper case.
Proper Converts a string to proper case.
Replace Replaces a substring within a string with a new substring.
Trim Removes leading and trailing spaces and line breaks from a string.
Split Splits text into substrings delimited by a specified separator value.
Join Concatenates a list of text values or fields, delimiting each with a separator.
Pad Left Pads a string with a padding character on the left side up to a specified length.
Pad Right Pads a string with a padding character on the right side up to a specified length.
Insert Inserts a substring into a string at a specified position.
URL Encode Encodes a URL string.
URL Decode Decodes a URL string.
Mathematical
Power Gets one value raised to the power of another.
Power Gets one value raised to the power of another.
Square Gets the square of a number.
Square Gets the square of a number.
Square Root Gets the square root of a positive number.
Square Root Gets the square root of a positive number.
Root Gets the positive nth root of a positive number.
Root Gets the positive nth root of a positive number.
Absolute The real number for which to get the absolute value.
Absolute The real number for which to get the absolute value.
Maximum Gets the maximum value of a list of values.
Maximum Gets the maximum value of a list of values.
Minimum Gets the minimum value of a set of values.
Minimum Gets the minimum value of a set of values.
Random Gets a random number less than or equal to a specified maximum value.
Random Gets a random number less than or equal to a specified maximum value.
Random Between Gets a random number between or equal to two specified values.
Random Between Gets a random number between or equal to two specified values.
Round Rounds a number up or down to a value with a specified precision.
Round Up Rounds a value up.
Round Down Rounds a value down.
Average Calculates the average of a collection of values.
Average Calculates the average of a collection of values.
Sum Gets the sum of a set of values.
Sum Gets the sum of a set of values.
Format Number Formats a number to a text representation using a specified numeric format specifier.
InfoPath
Get Attachment Content Gets an attachment’s file content from an array of bytes.
Get Attachment Name Gets an InfoPath attachment’s filename from an array of bytes.
Set Attachment Creates an InfoPath attachment and returns it as a base-64 string.
Lists
First Item Gets the first value in a list.
Last Item Gets the last value in a list.
Count Counts the number of items in a list of values.
Text
Hyperlink Creates a hyperlink with a display name and URL.
Date and Time
Today Gets the current day.
Yesterday Returns yesterday’s date.
Tomorrow Return tomorrow’s date.
Maximum Gets the maximum date and time from a list of values.
Minimum Gets the minimum date and time from a list of values.
Add Days Adds a specified number of days to a date.
Add Hours Adds a specified number of hours to a date and time.
Add Minutes Adds a specified number of minutes to a date and time.
Add Seconds Adds a specified number of seconds to a date and time.
Day Difference Determines the number of days between two dates, and hours are decimal fractions.
Day Gets the day of a given date.
Month Gets the month of a given date as a number.
Now Gets the current date and time.
Subtract Days Subtracts a specified amount of days from a date.
Subtract Hours Subtracts a specified amount of hours from a date and time.
Subtract Minutes Subtracts a specified amount of minutes from a date and time.
Subtract Seconds Subtracts a specified number of seconds from a date and time.
Weekday Gets the name of the day of the week from a specified date.
Week Number Gets the week number of the year of a specified date.
Year Gets the year of a date.
Format Date and Time Formats a date and time to a text representation using a specified date and time format.
Start of Year Gets the first day of a year.
End of Year Gets the last day of a year.
Start of Month Gets the first day of a month.
End of Month Gets the last day of a month.
Start of Week Gets the first day of a week.
End of Week Gets the last day of a week.
Start of Quarter Gets the first day of a quarter.
End of Quarter Gets the last day of a quarter.
Start of Year Gets the first day of a year.
End of Year Gets the last day of a year.
Start of Month Gets the first day of a month.
End of Month Gets the last day of a month.
Start of Week Gets the first day of a week.
End of Week Gets the last day of a week.
Start of Quarter Gets the first day of a quarter.
End of Quarter Gets the last day of a quarter.
Quarter Gets the quarter number a specified date is in.
Logical
If Returns one of two values based on a Boolean condition. Nested expressions are allowed.
True Gets the Boolean value of true.
False Gets the Boolean value of false.
Yes Gets the Boolean value of true.
No Gets the Boolean value of false.
And Performs an And operation on two Boolean values, returning true if both values are true, false if any value is false.
Or Performs an Or operation on two Boolean values, returning true if one of the values is true, false if both values are false.
Xor Performs an Exclusive Or operation on two Boolean values, returning true if one and only one of the values is true.
Not Returns a true value if the condition evaluates to false and a false value if the condition evaluates to true.
Conversion
To Decimal Converts a value to a Decimal data type.
To Boolean Converts a value to a Boolean data type.
To Long Converts a value to a Long data type.
To Integer Converts a value to an Integer data type.
To Short Converts a value to a Short data type.
To Double Converts a value to a Double data type.
To DateTime Converts a value to a DateTime data type.
To String Converts a value to a String data type.
To Base-64 String Converts an array of bytes to a base-64 encoded string.
To Binary Converts a base-64 encoded string to an array of bytes.
To Bytes Converts a string to an array of bytes using the default character encoding.

SharePoint Connection 2010 NL – Day 2

After the post from day 1, the post of day 2 couldn’t really be left behind. So here’s my take on the sessions I went to see.

SharePoint Connection NL 2010

SharePoint Connection NL 2010

MSOL06: Nintex Workflow 2010: Extending 2010-Era SharePoint Workflow to End User and Enterprise Needs Alike by Mike Fitzmaurize

As a K2 insider it seemed weird going to the Nintex session, but I went to see what they have to offer as it is always good to keep an open mind. I’ve already seen Nintex a while ago but now they showed its integration in SharePoint 2010. Mike is a nice speaker and listening to him was good, I also think nobody noticed that the workflow he build couldn’t actually start and he didn’t return to fix it. But then again, he was working on an alpha build of Nintex. Nintex still runs on the SharePoint WF, you can either see this as an advantage or a disadvantage. Also, the integration with backend systems is done via wizards. Nintex has a lot of those which makes the out of the box package product pretty complete. If I look at K2 from that perspective, it’s able to integrate with SmartObjects and more generic solutions which allow for more flexibility.

MSC11: SharePoint 2010 Search by Richard Taylor

Richard Taylor about to start

Richard Taylor about make people smile!

Yesterday I really enjoyed listening to Richard, when I saw he did a functional session on Search, I was curious and went for it. The session had a lot of information on what search actually is. And that search is not actually what you want to do, you want to FIND things. This al leaded into explaining what Findability is and what you need to do for it. Interestingly, it wasn’t SharePoint that provided the solution according to Richard. He says if you have a mess that using SharePoint will not solve the problem, you need to structure your data and an Information Architect is crucial to get Search working correctly and make things findable. This was a valuable lesson and enjoyable to listen too, the hour flew by and everybody left with things to think about in the next SharePoint project.

MSC27: Claims-based identity in SharePoint 2010 by Spencer Harbar

I expected a lot from this session, but it didn’t really deliver. Partly because there was no demo but only slides and a lot of theoretical stuff on the claims based identity framework (Geneva).

The session did hold a lot of good content which is way too much to sum up here. It was important to note that with claims based authentication you’re not always able to eliminate Kerberos, this is because the backend system needs to be claims based aware, which some systems are simply not (yet). When you want to use Kerberos, you’ll need to use claims based authentication within SharePoint, which (from my understanding) will be able to create a windows identity and authenticate via Kerberos.

I really like the claims based authentication and really want to start working wit hit and try some different scenarios.

Spencer also noted that claims based identity (currently) only works with MSIE8. I presume that’s for the claims based identity to work as if it’s integrated authentication. So for older browsers we’ll probably see forms based authentication that uses claims based identification.

UPDATE: Spencer commented to this article about the browser requirements. He also provided some tweets:

http://twitter.com/harbars/status/8318105648

http://twitter.com/harbars/status/8318666635

http://twitter.com/harbars/status/8318676296

http://twitter.com/harbars/status/8318716190

SharePoint Connection NL 2010

Ask the experts area

MSC31: SharePoint UI Customizations by Marianne van Wanrooij

This session was a ‘redeploy’ of the session already held in Las Vegas. Marianne made her own demo’s, which was good to see.

JavaScript, Status bar and Notifications

SharePoint has a nice feature called JavaScript on demand, which only gets the JavaScript if needed. This allows for a small size of the basic page that requests the correct JavaScript when you need it.
After this, Marianne showed how the status bar and the notification area can be manipulated using JavaScript and the server client object model.

Ribbon

The ribbon is also extendable in SharePoint 2010, it allows you to add and remove buttons using a SharePoint feature which gives you very tight UI integration with SharePoint. The ribbon is actually one big image which is cut up by CSS. This is a very efficient technique that eliminating callbacks to the server. In the demo, a button was added to the ribbon and some simple code was run.

Dialog framework

The dialog framework was also part of the demonstration. There is not much to tell about it (which is a good thing!). You can open a dialog and provide it a URL to use as a page. The dialog framework hides all the html elements with the ‘s4-notdlg’ css class. This allows you to use one page for dialogs and for normal pages!

MSC30: Advanced Web Part Development by Jan Tielens

Jan Tielens about to start

Jan Tielens ready to rock!

I can’t help saying it again, Jan Tielens his presentations and demo are super to see! They simply work and are so clear. He makes it look way to easy!
The session covered topics on web part development in SharePoint 2010. There are some new things, like XSS Safeguards which are important to know about as a developer. A big improvement is the Virtual Web Part. For me, that’s nice to see, but I don’t understand why it was so important to drag and drop UI elements.  Apart from that, Jan showed how you can use the visual web part to create connect web parts. After that he went on and made two connected web parts update with Ajax.

Conclusion

I enjoyed the SharePoint Connections conference, although a lot of it was already known from Las Vegas, it still added knowledge for me. For me, that’s the most important part of going to a conference. Apart from that, it was nice to see all the SharePoint people again and shake some hands!

http://twitter.com/harbars/status/8318676296

WordPress Themes