Expose a Vidyano query to other tools

Yesterday, a customer had a question regarding the use of reports on a query. The customer wanted to expose a few specific columns of a query to an external tool. The GetReport hook was exactly the thing that was needed. All the steps were taken to create the report (as explained here)

The result however was not completely what was expected. So let’s go over some specific details that you need to know when working with the reports query


First things first: When creating a report query , you need to specify a user. This user will be used to get the query and it’s items. It is very important to understand this, because Vidyano will use this user to determine the rights for executing the query. This means that, if the selected user doesn’t have query rights on the query, you won’t get any result. In the same way, if the user has some denied rights on a specific column, that column will never be included in the report query.


There are 2 ways to specify the rights:

    • You can give query rights on the whole persistent object and deny rights on specific column. This way, new columns will be automatically added to the report query result.
    • You can give query rights only on the specific columns you want to expose. if you do this, new columns will never be automatically added to the report query result.

The second thing you need to know, is how null values are handled. The report query will expose the query as xml and will exclude all properties with null values. This means that the number of elements can change for every data row inside the xml. Also important to understand is the difference between null values and empty string values. Empty string values use the empty element syntax. the difference is shown in this small example.


<Adres Id=”84f01aaa-4c5b-435f-8fb5-8408c8106a65″>
<Adres Id=”d50f68d9-e0a8-4dc5-ad12-e62a73ea8b95″>
    <Straat>Avenue de la Gare</Straat>


the third and last thing you have to remember when working with query reports, is that you are using the query and the underlying persistent object to get and expose the data. This means that every attribute of you persistent object that doesn’t show on the query, will not be included in the query report. This also means that every column that is set to invisible on the query itself, will not be included in the query report. These last two are very handy to remember and can save you a lot of time searching why a specific column isn’t shown in your report query!



Posted in Service Vidyano.


Have you guys seen the latest tweet from the Vidyano Team?

Posted in Uncategorized.

Vidyano 4.0.7103

An update for Vidyano is now available. Steve made a list of the most important changes here!

This commit is a bit more special than usual. For the first time, it contains code that was submitted to us! It is really wonderful to see that making our client open source is providing everyone an opportunity to make Vidyano even better! For those that haven’t found our client code yet:

Speaking about open source, Entity Framework 6 is getting some really nice speed improvements from the community. It is really awesome to see that something as “simple” as this can improve speed so much. At the other side, it’s a bit sad to see that the Entity Framework teams spends so much time on new features when the existing code contain so much space for improvement…

Posted in Vidyano.

Vidyano 4.0

Vidyano 4.0 was released last week! The release took us some time to complete, but I think the feature list explains it all! I think it is looking very impressive and I would like to congratulate the whole team with this release!

One of the major things in this release is the Vidyano webclient. This is a complete rewrite of the client in html5 and JavaScript. If you want to know what this new client is capable of, let’s state it like this: You can do everything(!) you could with the WPF client and much more! For example, we rewrote the whole Vidyano website with Vidyano and have put a demo website online.

To end this post, I will give a list where you can find more information about this release.

Posted in Uncategorized.

Refreshing the Vidyano cache on a production service in 6 steps

I have been working on a project where we use a SQL database to develop on, while we have a database and service running in production on azure. This has been working very well and with the azure staging deployments, we are able to update our service without any downtime. Updating the Vidyano data is also easy and you can do this without any downtime too. You just have to follow these easy steps:

Step 1

Generate all the scripts you need. To update the Vidyano data without downtime, you have to exclude the CacheUpdate table from the scripts! also, if you haven’t synchronized your users, be sure not to drop/create the following table either: Users, Groups, User_Group. These are the two scripts you need to generate:

  1. The script that creates all the Vidyano tables and their data. You can generate this script with the SQL Server Management Studio on your development database.
  2. The script to drop the existing Vidyano tables. You can generate this script with the SQL Server Management Studio on your production database.

Step 2

Make sure your production service is running. As you know, IIS recycles your application when it isn’t used for some time. You can be sure the service is running by logging in into the application and executing a query. Depending on how many instances you have running, you may need to execute multiple requests to be sure.

Step 3

Clear the data inside the CacheUpdate table if there is any. This makes sure the service won’t try to update any Vidyano data while you are recreating the schema and data.

Step 4

Execute the 2 scripts created in step 1. Off course you have to use the drop script first.

Step 5

Now we have to tell the service to reload the data stored in the Vidyano tables. We use the CacheUpdate table to do this. Execute the following script on the production database:

insert into [Vidyano].[CacheUpdates] ([Id], [Timestamp], [Data]) values (newid(), sysdatetimeoffset(), cast('' as varbinary))

Step 6

You can now test the service to see if all changes where made correctly

Posted in Vidyano.

Adding persistent objects attributes that do not exist on the database

Adding extra attributes to persistent objects (PO’s) is something that can be very easily done from the Vidyano Management. That’s as far as Vidyano can help you. Since the data doesn’t exist in the database table, that is something that you have to do yourself.

Displaying extra attributes on the PO screen

When displaying extra attributes on a PO, you have to set the data in code. The OnLoad overload should be the starting point

Posted in Uncategorized.

Setting a Vidyano WPF application in “busy” mode

Today I will show you how you can disable all actions in a WPF application by using something called the IBusyService.


Notifying the application that you are busy performing some logic is needed in some cases. In a traditional application, the UI is automatically locked when you are preforming logic on the UI-thread. This leads to an application that doesn’t respond to user input very fast. Something that can be very frustrating for your users. In order to be able to work around this problem, you want to do as much processing on a different thread as possible. Both the WPF and the HTML5/JS interface make heavy use of this “async” way of working. There is one thing however, that you should be very aware of. When you move all the work off the UI-thread, the UI will become way more responsive, but also available for your users to perform actions. this is something that is not always wanted.

Let me give you an example: You display a list of items in a query. When you click on an item, the item will be opened in a new page. When this opening happens on a background-thread, the user could click on another item in the query. This item will then also being opened. And that is only if the responses come in the same order as the requests, something that is not guaranteed!

If you find yourself in this or any similar case, that you need what we named the ‘IBusyService.’


How to use

Using the IBusyService is very simple. The following sample shows how to use it:

using (ServiceLocator.GetService<IBusyService>().Push())
	var responsePO = ServiceLocator.GetService<IServiceGateway>().ExecuteAction("YourAction",obj.Parent, null, null);

In this simple sample, I used the ServiceLocator to get the IBusyService. Calling Push will push the busy status onto the IBusyService. This client will then automatically disable all actions on the client. Mind that this will not block the UI, simply making sure the user cannot perform any action while the service is busy. Make sure to wrap the Push call inside a using clause, to automatically enable all actions on the UI again. Inside the using you can perform any code you want, including making calls to the Vidyano Service.

Posted in Vidyano.

Using the Vidyano Manager

The Vidyano Manager is an important object. It is available at the service side and exposes a lot of functionality. Let’s see what information the Object Browser gives us:image

Let’s explain the most common uses:

  1. User operations: In a lot of applications, you want to give the users of the application the ability to create users. All the functionality to create users at runtime is exposed by the Vidyano Manager. Following operations are available:
    1. Creating users (with or without group)
    2. Deleting users
    3. Getting users
    4. Getting groups
    5. Getting current user (the user executing the request)

    It is important to use these methods to create users. Vidyano caches these entries very aggressively in order to speed up the service.

  2. Client information: Following client information can be accessed:
    1. Current Client Culture
    2. Current Culture
    3. Environment with easy Boolean based properties like IsDesktop, IsMobile and IsWeb
    4. Session: the current Session object (the object itself can be configured in the management part of Vidyano.
  3. Settings
  4. Translations


Now that the most common uses are explained, let’s see how to use this to execute various user operations. Please note that the Manager object lives in the Vidyano.Service.Repository namespace.

var newUser = Manager.Current.CreateNewUser("test", "test", "user");
var currentUser = Manager.Current.CurrentUser;
var allUsers = Manager.Current.GetUsers();
var group = Manager.Current.GetUserOrGroup("Group");

Posted in Vidyano.

Refreshing the parent query after a specific action

When a Persistent Object (PO) gets saved/edited, Vidyano will automatically refresh the parent query of the PO is there is one. This is very handy and ensures that you never see ‘old’ data.

Sometimes however, you want more! What if I also want to refresh the parent query of the parent query of the PO? This is not something that is done automatically because, in 95% of the cases, this has no use and will not result in different data. Then there is the other 5%.

The solution

Let’s quickly head to the code to solve this problem. Very important is that this has to be solved at the client side. More information about why can be found in the background. I will show the code to solve this in the WPF client, but it can be done in the same way using the Web client.

  1. Add a ClientActions class to the client project. Make sure to name the class ‘YourPoName’ClientActions and make it inherit from the ClientActions class.
  2. Add the following code to the class
  3. public override bool OnAction(ExecuteActionArgs args)
               if (args.Action == "PersistentObject.Save")
                    if (args.PersistentObject.OwnerQuery != null)
                        var parent = args.PersistentObject.OwnerQuery.Parent;
                        if (parent != null && parent.Type != "ProgramUnit" && parent.OwnerQuery != null)
                    args.IsHandled = true;
                    return true;
                return base.OnAction(args);

So, what does this do. First of all, this code will be triggered when an action will be executed on the service. In this example, I override the Save behaviour. When the Save action is executed, I will first of all execute the Service request. This way, I’m actually saving the PO. When the request is done, I will lookup the parent query I need and make it search again. As last, I return true, to indicate that I don’t want any other default behaviour to be executed.

Off course, in a production environment, you want to do more type checking to make sure you have the correct query!


When Vidyano receives a query at the client side, then it actually receives the definition of the query. The actual results will be retrieved from the service when needed. This way, the service will not retrieve data that will never be shown on the screen. After receiving the actual data, the client will cache the results. The method shown above will perform a new search and will refresh the actual data.

Posted in Vidyano.

Client action for the Vidyano Web Client

The Vidyano web client allows for the same level of customisation as the WPF client. Perhaps even more given the nature of JavaScript en how the language handles object. Let’s see how we can create a custom client action.

When you create a Vidyano web application, you solution should look like this:


The starting point to start writing your own custom JavaScript code should be AWDemoWeb.js. By default, this file only contains 2 samples that are commented out.

//app.settings.useDefaultCredentials = true; 
//app.postQueryRender = function(query) { 
//    $('#CustomerQuery').vidyanoGrid(query); 

As you can see in the (very) small sample, the app object is the starting place to write your own custom query. This object will allow you to replace default settings, add custom logic to specific parts of your application and important for this example: you can change the default execution of actions.

The app object exposes a property “onAction.” On this object you can change the way your action will be executed. If you want to customize an action, then the skeleton will look like this:

app.onAction[“youraction”] = {
completed = function(po, onCompleted){},
execute = function(actionBase, executeAction){},
fail = function(error, onFail){}

You can see there are three extension points available.

    1. Completed: When you add a function to this property, then this action will be executed after successfully executing the “execute” method. The method has 2 parameters:
      1. a PO object: This is the object that was returned from the service.
      2. an onCompleted function: This function allows you to execute the default behaviour of the onCompleted method. This is handy when e.g. you want to execute the default behaviour after checking for a specific condition.
    2. Execute: This is the “core” functionality of an action. By default, this method will execute the service call to execute this action. When adding a function to this property, you can completely change this behaviour. The 2 parameters are as follows:
      1. actionbase: This is the “base” action object used by the Vidyano web client. This object gives you access to everything there is to know about the action, as well as giving you extra helper methods to do some specific tasks. An in depth look will be for another post, since this is an interesting object but there is so much to say about it. As always, you can see in the developer JavaScript files if you want to lookup some specific details.
      2. executeAction: this method gives you access to the default logic. Executing this action will perform this default logic and execute the service request.
    3. Fail: this method will be called when an error occurs while executing the service request. The parameters are quiet easy to understand:
      1. error: this is the error that occurred.
      2. onFail: as with the previous 2 methods is the last parameter the hook to call the default logic.

an important note is that it is not necessary to override all three  extension points. If you only want to change the “completed” part, you set the other two part to null.  This way, Vidyano will execute the default logic for these parts.

app.onAction[“youraction”] = {
completed = function(po, onCompleted){},
execute = null,
fail = null

as always, you can leave more questions in the comments!

Posted in Vidyano.