News combit Dev Blog

Scripting Support in Functions

Posted: Wednesday, October 7, 2015 | 2 comment(s)
 
List & Label has a very powerful formula language. Most manipulations one could think of are possible out of the box or can be realized by using a user defined designer function. However, the latter requires you as a developer to think of the need before deploying your application. In LL21, we'll introduce a new feature that allows to use C# or scripting host languages like VBScript directly in the function wizard.

This vastly extends the power of List & Label expressions, of course. As a script can introduce arbitrary security problems, this is an opt-in feature only – your application has to set a corresponding option in order to get scripting support. It's easy:

 LL.Core.LlSetOption(LlOption.ScriptingEngineEnabled, 1); 
Once this option is set, you can use the Script$() function in the Designer as follows:
 

New feature of version 21


A more advanced application could be a script to count the number of work days between two dates – provided you have a map of public holidays, it's simply the number of days that are not (depending where you live, of course) Saturday or Sunday or public holiday. So you simply loop through all days, check if they are in your holiday map or weekend days and – if not – increment your counter by one. This is something that would not be possible with LL's own expression language as it doesn't support any looping (yet :) ). Also, you probably don't want to edit such a script in the function wizard directly as it doesn't have Autocomplete or Intellisense for C# Scripts (yet :) ). The solution is simple – you just include a file that you can create in the editor of your choice. You include it by using the LoadFile$() function like

Script$("CSharpScript",LoadFile$(ProjectPath$()+"WorkingDaysSample.cs"))
By including a pragma you can even configure your favorite debugger to fire up upon script execution and debug your script using all of Visual Studio's glory:
 

New feature of version 21


I'm really curious to see what you guys will do with this feature. Oh, and by the way, this was one of the highest voted suggestions in our feedback portal. You asked and we listened.




Author: Jochen Bartlau
Head of Development List & Label

Jochen Bartlau leads the development at combit as Managing Director. He's a Microsoft .NET enthusiast driving innovation & agile project management. The mobile devices geek who used to be a physicist in his first life loves to spend his spare time with his family.


  

RSS
combit Development BlogRSS
What’s this blog for?
A place to share updates about the ongoing development of our products. General musings on the software industry included.
Archive
January 2021 (1)
December 2020 (2)
November 2020 (1)
October 2020 (2)
September 2020 (1)
August 2020 (2)
July 2020 (1)
June 2020 (1)
May 2020 (2)
April 2020 (2)
March 2020 (2)
February 2020 (1)
January 2020 (1)
December 2019 (1)
November 2019 (2)
October 2019 (2)
September 2019 (2)
August 2019 (2)
July 2019 (2)
June 2019 (2)
May 2019 (1)
April 2019 (0)
April 2019 (1)
March 2019 (1)
February 2019 (1)
January 2019 (1)
December 2018 (1)
November 2018 (2)
October 2018 (4)
September 2018 (4)
August 2018 (2)
July 2018 (2)
June 2018 (2)
May 2018 (1)
April 2018 (1)
March 2018 (1)
February 2018 (2)
January 2018 (1)
December 2017 (1)
November 2017 (2)
October 2017 (3)
September 2017 (3)
August 2017 (2)
July 2017 (2)
June 2017 (1)
May 2017 (2)
April 2017 (1)
March 2017 (1)
February 2017 (1)
January 2017 (2)
December 2016 (1)
November 2016 (1)
October 2016 (4)
September 2016 (5)
August 2016 (2)
July 2016 (2)
June 2016 (3)
May 2016 (2)
April 2016 (3)
March 2016 (3)
February 2016 (1)
January 2016 (2)
December 2015 (2)
November 2015 (1)
October 2015 (4)
September 2015 (5)
August 2015 (2)
July 2015 (2)
June 2015 (2)
May 2015 (1)
April 2015 (2)
March 2015 (1)
February 2015 (1)
January 2015 (1)
December 2014 (2)
November 2014 (1)
October 2014 (1)
September 2014 (2)
August 2014 (1)
July 2014 (2)
June 2014 (1)
May 2014 (2)
April 2014 (1)
March 2014 (2)
+1 800 256 3608 (toll-free North America only)