Clarionlive Webinar#400 - Clarion Cloud Functions

Clarionlive Webinar#400 - Clarion Cloud Functions

“Serverless Computing” doesn’t really mean there’s no server. Serverless means there’s no server you need to worry about. That might sound like PaaS, but it’s higher level that than."


Let’s run some Clarion Code in the cloud!

Notice the Clarion code in the “expression” parameter of this URL?

https://clarionapi.azurewebsites.netapi/evaluate?expression='The Big ' & Format(400, @N06)

Go on, click on it and see!

How about the Clarion value for Today()?
Or even better, what on earth is “78947” as a Clarion Date?


  • What is an Azure Function?
  • How does this know about Clarion?
  • Where to from here?


  • Clarion console app
  • Command() in and StandardOutput back.
  • Github project
  • .NET Process


Obvious reason is cost. Instead of having a dedicated server to run a Clarion web service, just have a function and pay per use.
e.g. $0.000016/GB-s (Gigabyte Seconds) and $0.20 per million executions
$20 per month for a dedicated server?

  • Flexability
    Tweak your individual functions as needed, deploy is stupid simple, etc.

  • Integrations
    Mixture of possile programming languages with all the rich libraries that they provide.
    Combined with the Clarion code we all know and love!

  • Azure ecosystem and more
    Sure you can now get easy access to the full Azure eco system but yuo also can combine that with all the API goodness out there!


If you really wanted to take this further, I wonder if you could create a function that calls ClarionCL to compile some code and execute the result… might be fun though in that case you may want to have a dedicated server as the resource usage might spike.

Also, remember that this is just one possible binding for a function, HttpTrigger. There are others like WebHook, BlobTrigger, EventHubTrigger, WebHook, TimerTrigger, etc!

How about a simple function that executes your Clarion code in the cloud on a specified schedule?
Heck, it doesn’t even need to be C# code. You can have a BAT file that runs on an HttpTrigger :smiley:

Perhaps it could be a convenient way to test or prototype something without having to worry about server infrastructure?

Webinar Project - Clarion API

Primary Goal: API Endpoint for Evaluate()
Bonus Goals:

  • Deploying additional Clarion code that can be used in Evaluate, via Bind() and/or specific “routes” that can be triggered from functions.
  • Looking at other Azure Function bindings e.g. TimerTrigger, BlobTrigger, etc and how these could be useful with Clarion code
  • Developing functions locally or in the Web IDE
  • Deploying changes, VSTS/GitHub integration and CI
  • Static file, SPA (Single Page App) that can consume the API.
  • Performance testing
  • Instrumenting with Application Insights

Some good links

Other notes:

Develop locally or online?


  • faster change/test cycle
  • better once production is implemented, test locally before deploy
  • good fun to see the deploy/CI process
  • More direct
  • Kinda fun

My initial local dev testing:

Ok, so the seems to be a bit special but it just might work well enough for starters.

Install CLI:
npm i -g azure-functions-cli

Prepare project:

cd c:\Dev\Projects
mkdir ClarionApi
cd ClarionApi

Init func app:
func ClarionApi init

Init Function:
func function create -l C# -n evaluate -t HttpTrigger

Run Function (server):
func function run evaluate

Now, develop and test.
Commit/Push to VC
Let CI take it from there to deploy.
Test “live”

After talking with Arnold and John here were some other ideas:

Good talk, thanks guys.

So what I will look at doing, as well as the above, is:

  • Find a way to be transparent about costs and what this can save
    • Why use functions at all when I have to run a database server anyway?
    • How much does Azure cost anyway?
    • How can I keep track of costs in the cloud?
  • How to access a data/database(s) from azure functions?
    • TPS
    • SQL
  • Demo - function accesses a database on premises
  • Graphs are good, dashboards even better!
  • Function that pulls something from the Clarionhub API?
  • Need to engage people on “how can this help me”?
  • Analytics and how they can help to know what users want before the users do! :slight_smile:
  • If there is any “hard stuff” that I am going to gloss over here then make sure to mention I am available for consulting work if anyone wants help!

Edit: More ideas

  • A function might be a super easy way to do a “license check”.
  • Monitor a location for file changes, e.g. someone uploads a TPS file, and then a function “does something” with that file.
  • Serverless OCR Service
  • Monitor a location containing images and make thumbnails?

General Use Cases for Functions
(ideas from )

  • Operating serverless websites - host static content on a CDN, api is functions
  • Automated backups and everyday tasks - e.g. preparing reports in the background
  • Watermarking images/reports in the background
  • pre-processing
  • validation
  • alarms, notifications
  • IoT endpoint?
  • Async batch processing. Client makes a request to a function that triggers a bunch of different actions.
  • Nice post and good look at pricing -

I will update the original topic here as I develop the presentation. When we are ready to go I will move the topic to a public location for people to reference.