Open Menu

Synergex Blog


How “easy” can easy be – Google it!

By Richard Morris, Posted on May 24, 2017 at 4:45 am

The post conference workshop developed from the ground up a vinyl record collection catalogue system that allowed the management of your favourite records. The workshop stepped through the various aspects of the system including a desktop WPF maintenance program and remote management of your cloud based catalogue using the Synergy DBMS manager.

Having all your vinyl discs catalogued is great – but when I’m in the record shop browsing through all the latest available titles I often wonder – have I got this one? I’ve got a lot of vinyl’s and many more CD’s so remembering all the one’s I have can be difficult, and there is nothing worse than buying a duplicate.

So our OnVinyl app we built at the conference allows us to scan the barcode of the album in the store and check it against our catalogue – if we have it then the details are displayed and we don’t go and buy it again.

Getting all the album information into our catalogue would have been a long and rather boring job – especially having to trawl the web looking for the artwork to associate with each album we have. We need an easier solution – and so to Google we turn.

We all know how good Google is at searching for basically anything you can think of really, but did you know you can use this powerful searching capability from within your Synergy programs? Google provide a search API that allows you to simply and very easily perform any search you require. This is the facility we added into our OnVinyl Album Maintenance program – enter (or scan if you have a barcode scanner to hand) the barcode on the album and pass this through to the Google search API. Our implementation retrieved the album name, artist, cost and artwork so we are able to populate all the fields in the maintenance form – without any typing!

The Google search API provides a REST API that you can call directly from within your Synergy program. For full details visit https://developers.google.com/custom-search/json-api/v1/using_rest. To use the API you need a Google account. The first step is to create an “API key” which allows you access to various Google API’s and identifies you to those API’s. Visit the Google API Manager console to create an API Key. Once you have an API key then you can set up a custom “search engine” that allow you to customize how your searching is performed. You can limit the results to certain web sites for example. This is all configured using the Google control panel (https://cse.google.com/all). To begin you create a new “search engine” and name it. Once created it will be assigned a unique search engine ID – you’ll need this!

In your Synergy code define some constants;

The API is a REST implementation that has a defined URI;

And then make the required REST call to retrieve the search results;

And that’s the call to your custom search engine complete. The response from Google will be in the form of a JSON string which you need to parse and out and extract the individual elements you require. The code for that is available in the OnVinyl project.

And the results in your application;

Easy really is easy with Synergy and Google searching!

On a side note – I’ve been wondering where Jodah had got to, and then this appeared in my inbox;

I’m sure I recognise those eyes…. Have you seen or got a picture of Jodah’s identifying name tag?

 

 

 


Code Gremlins?

By Richard Morris, Posted on May 17, 2017 at 8:27 am

This year’s DevPartner conference was held in Atlanta, Georgia and was a blast. I guess I say “the best ever”” each year, so I won’t this time – but it was. The whole conference ran flawlessly, although throughout the week I did see a few strange things in the corner of my eye – but you know how it is. You think you are seeing things… But maybe not.

We had lots of new faces in the audience seeing what Synergy has to offer which is always great, and they got to see a few new faces presenting at the DevPartner conference for the first time.

Although Phil could be considered a veteran now – his third conference – he was joined on stage by first-timer Tate, a fellow support engineer. They presented a cool session on BOTS – not those things you sit on, the automated robots that answer whatever questions you have. There are loads of bots around and the duo showed us what it’s all about and how to build you own!

Another new face was Jacklin who presented all the ways to get fully up to speed with Synergy today including all the various media feeds and the cool YouTube channel we have that’s being loaded with great training videos – and of course you can always re-watch all the conference sessions.

At the beginning of March I blogged about “Physio My Way” which is an app to monitor a patients compliance to perform their prescribed upper limb exercises. Ashley presented the full Physio My Way story and received great feedback – if you get the time check out the Synergex YouTube channel in the coming days to see the full video! It’s a complete mobile solution written end to end in Synergy.

And so to my post-conference workshop. The goal was to write, from scratch, a complete application called “On Vinyl”. “On Vinyl” is a vinyl collection management and inquiry system. The system is written entirely in Synergy .Net and uses the Symphony Framework.

We started off by code generating the base data objects – the classes that expose the Synergy Repository structures as classes with full get/set properties for the fields. We also code generated classes to provide complete data management using Symphony Harmony.

Next we built a simple maintenance program to allow us to manage our collection of vinyl albums. To save typing we also implemented the ability to perform a Google search passing in the album barcode and returning/displaying all the album information, including the cover artwork. I’ll blog about just how easy it was to implement Google searching soon.

Next we hosted all the server logic on a remote cloud server behind Symphony Bridge and showed how to manage the data remotely using the Synergy DBMS Manager (available on the download page at www.symphonyframework.net).

Next we moved to the client portion of the project – to build and deploy an app on the Android and iOS platforms to enable us to check if we have a particular vinyl in our collection. We built up the technology stack. First layer was the client data layer – code generated data objects built into a portable class library. Next we created the connection library which used commands to search for vinyl details using the barcode:

If we didn’t have the album in our collection we could call our stored procedure to perform the required Google search:

And if we chose to buy the album we could insert it into our collection directly from the device:

Our final portable library was the common UI code – using Xamarin Forms. This provides the ability to write the UI once and deploy to different target devices such as Android and iOS.

Up to this point, although there were a couple of “what was that…” moment’s things all built and ran just fine.

The final piece of the puzzle was to write the device specific code – and our first target was Android. We created the project, added the required resource (images, etc.) and after a couple of minor typo’s the project built. But something was not quite right and we could not get the program to successful deploy and run.

We’d hit the end of the day so aborted the attempt and regrouped to try to find out what had gone wrong.  Once we have the solution I’ll post the entire project to GitHub and blog about it!

Now I don’t really believe in code gremlins, ghosts or phantoms, but throughout the week there were some strange goings-on, and to be honest I was having flash-backs to conference time 2009! Surely he was not back to try to mess up my workshop again?

And where did Jodah get to……?


I didn’t know you could do that!

By Richard Morris, Posted on March 23, 2017 at 2:34 pm

Working with the many customers we have is a great opportunity to advance the software we write. Some time ago I blogged about Symphony Bridge – a server based utility that allows you to expose Synergy data and logic through Symphony Harmony using an SQL-like syntax. In essence you can write queries on the client like “select * from part” and the bridge server will return a collection of part objects that are based on a structure you have created in your repository. You can then bind these to grids or input controls on you windows or mobile applications or display them in web pages. In fact you can use the data in any Synergy .Net or non-Synergy application.

Another aspect of Symphony Harmony/Symphony Bridge is the ability to call a remote procedure using the syntax “exec @MyNameSpace.MyClass.MyMethod”. You can pass in arguments and again a data object or a collection of data objects are returned.

During a recent visit with one of our customers who is currently utilizing symphony Harmony and Symphony Bridge to provide third-party access to their systems to allow enquiries on orders, etc. I was asked about “providing the ability to return a standard object that contains the call status AND the response data”. Simple, no problem: Create an RPS structure that defines your response details – call status, error codes, and error message for example. Code generate the required data object and then customize it by exposing a collection of <DataObjectBase> (the base class of all data objects!) As I said – simple.

But the customer was not overly impressed – and they had an idea! Oh dear me thinks – these are seasoned C# developers and I’m not convinced I’ll be able to implement their ideas in Synergy .Net! But how wrong I was…. and without any changes to the Symphony Framework. The basic requirement is to have a “response” class that they can extend with any serializable “type” – be that a single instance or a collection of “type” – without any restrictions.

The starting point was the same – create the required response structure in the repository and code-generate the “response” class. This is the resulting class definition;

public partial class Server_response_Data extends Symphony.Conductor.Model.DataObjectBase

The code generation process creates all the required properties and the logic to serialize the data into JSON or BSON.

The next step was to create a second class with the same name as the response class but this time it will accept a generic – generics are quite cool and allow you to defer the specification of a type until that type is instantiated. So our generic response class definition looks like this;

public class Server_response_Data<T(new)> extends Server_response_Data

By extending the base code-generated class we get all the required Symphony capabilities. The “T” denotes the generic “type”. The (new) ensures that any type you provide must have a parameter-less constructor which ensures that this class can creates an instance of it. We can expose the property so it’s serializable;

{JsonProperty}
public property Result, T
       method get
       endmethod
       method set
       endmethod
endproperty

And in the constructor we can ensure there is an instance (to prevent null object exceptions);

public method Server_response_Data
       endparams
proc
       Result = new T()
endmethod

And that is about it. You can then write your server methods to create an instance of your response class, populate the generic “response.Result” with the required “type” and set the response properties accordingly. For example;

data response = new Server_response_Data<Part_Data>()

Will create a response class with the “Result” as a type of Part_Data data object. If you need to return a collection of Part_Data objects;

data response = new Server_response_Data<List<Part_Data>>()

It’s really as easy as that. On the client you simply make the remote EXEC call through Symphony Harmony;

result = DataExecute.RunDataExecute(connector,
       &      "exec @MyNameSpace.MyClass.MyMethod",
       &      new Server_response_Data<List<Part_Data>>()).Result

You can also await the call on a separate thread.

Big shout-out to Gareth for the idea and his persistence to make me get it working!

I’ll be using these techniques in my DevPartner 2017 post conference workshop as we build a mobile app from start to finish using Symphony Harmony/Symphony Bridge to access remote data and logic.


Examining and modifying Synergy data

By Richard Morris, Posted on September 5, 2016 at 11:41 pm

The Symphony Framework provides the ability to expose Synergy data as “Data Objects”. A “Data Object” or DO for short, is a class that exposes the fields of your repository structure as properties that can be accessed using Get and Set methods. These DO’s also provide access to the “raw” synergy record data through a property called SynergyRecord. The SynergyRecord property is the basic way to put record data into or get record data out of your DO. There are a lot of additional properties associated with DO’s, like its validity based on repository and custom validation rules, but those are for another blog. By exposing the individual field elements as Get/Set properties this allows us to bind to them from code (Synergy or C#/VB.Net) and in the WPF world the UI layer in XAML.

The Symphony Harmony framework allows you to select data from a Synergy DBMS file using standard SQL style syntax. Under the hood it uses the powerful SynergyDE.Select capabilities to access data in a file after parsing the SQL like query string. The data is returned as a collection of DO’s.  A simple example could be;

Select * from group

Where “group” is the name of a structure/file relationship in your repository. The Symphony Harmony returns all the located records in the form of DO’s. This means we can bind to the individual properties exposed by the DO.

Harmony can accept more complicated requests, for example;

SELECT Id ,Description ,Quantity ,Cost_price FROM part WHERE cost_price BETWEEN 10 AND 20

Is a valid query that will return only the DO’s that match the where clause.

To show the capabilities of the Symphony Data Object and Symphony Harmony I’ve put together a simple “Synergy DBMS Manager” program that allows you to interrogate and manage data in a Synergy ISAM data file. You can select data using SQL like syntax and display the results to the screen. You can also update, insert and delete records again using SQL like syntax. To show the query above using the Synergy DBMS Manager;

SDBMS1

The fields within the query can be typed in longhand or selected from the field list (retrieved dynamically from the DO). When the query is executed, the results grid is dynamically built to include only those fields selected.

As mentioned you can also modify the data in the file using an UPDATE command and you can insert new records using an INSERT command. To complete the capabilities you can also delete records using the DELETE command, but make sure you use a where clause or the whole file will be cleared.

The Synergy DBMS Manager application can be downloaded from SymphonyFramework.Net. You can also access full documentation on the same page or here. You will need a minimum of Synergy 10.3.1 runtime environment to run the Synergy DBMS Manager program. You will also need to create and build a library of Synergy Data Objects that represent your repository structure. This library is totally code-generated and full instructions are included in the documentation.

If you would like to take a look at the Synergy DBMS Manager but don’t have the time to build your library of data objects upload your repository files (zipped please) at: SymphonyFramework.Net and we’ll build it for you!

Why not take a quick look at the documentation to see how easy it is to use the Synergy DBMS Manager?

 


Symphony Framework Update 3.2.6 – File Management Capabilities

By Richard Morris, Posted on July 22, 2016 at 6:24 am

As I wrote about in my last blog the Symphony Harmony namespace provides the ability to execute select queries and stored procedure style method execution using SQL style syntax. The queries and procedures can be executed in-process or via the Symphony Bridge on a remote server via industry standard HTTP/HTTPS/TCP protocols as well as via a Service Bus Relay protocol. In the 3.2.6 release we have added the ability to fully manage the data in the SDBMS files via SQL this style syntax.

Accessing or selecting data through the Symphony Harmony namespace is simple. First you need to define your “connection” to the database. To do this you create an instance of the DBConnector class. For example;

data connector = new DBConnector(“SymLocal:user/password!SimpleHarmonyTestLibrary.TableMapper.MapTableToFile”)

The connection string defines how you want to access the data: SymLocal indicates that it’s in-process and specifying SymRemote indicates it’s via Symphony Bridge. If you are using Symphony Bridge you must include the “server” you wish to connect to – I’ll include an example shortly. The username and password allow you to provide authentication but that’s for another blog. The “SimpleHarmonyTestLibrary.TableMapper.MapTableToFile” is the named method that Symphony Harmony uses to translate the table name to a physical SDBMS filename, and it’s something you can code generate.

Here is an example of a remote access connection;

data connector = new DBConnector(“SymRemote:user/password@localhost:8081!SimpleHarmonyTestLibrary.TableMapper.MapTableToFile”)

Notice the server name and the port the Symphony Bridge server is listening on. Other than the connection string the usage of Symphony Harmony is identical regardless if it’s local or remote data access. Although here we are talking about local and remote data access – we are referring to where the code to perform the query is being executed, either locally in-process or via Symphony Bridge. We are not referring to the physical location of the SDBMS data files which may be local or remote and accessed via xfServer. Both local (in-process) and remote connections via Symphony Bridge can access data locally or via xfServer.

To select records from a file you use the SQL style SELECT syntax and call the DataSelect.RunDataSelect method. You need to instance the Symphony Data Object that will define the response data structure. For example;

data partItem = new Part_Data()

foreach partItem in DataSelect.RunDataSelect(connector, “SELECT * FROM part”, partItem).Result

begin

                Console.WriteLine(“Created ID = ” + partItem.Id + “, ” + partItem.Description + ” Qty = ” + %string(partItem.Quantity) + ” Cost = ” + %string(partItem.Cost_price))

end

Note here that the case of the command is not important however the case of string values within a where clause is. You can limit the fields returned, filter the data and order the results as you require. All of these are valid;

DataSelect.RunDataSelect(connector, “SELECT id, description, quantity FROM part WHERE quantity > 10”, partItem).Result

DataSelect.RunDataSelect(connector, “SELECT description, id FROM part WHERE description like ‘BRAKE’”, partItem).Result

DataSelect.RunDataSelect(connector, “SELECT cost_price, id, description FROM part WHERE cost_price < 1.99 ORDER BY cost_price “, partItem).Result

The order of the fields list is not important. You also don’t have to hard-wire the filter values as you can pass positional arguments. For example;

Data qtyValue   ,int         ,10

DataSelect.RunDataSelect(connector, “SELECT id, quantity, description FROM part WHERE quantity > :1”, partItem, qtyValue).Result

data descValue ,string   ,”BRAKE”

DataSelect.RunDataSelect(connector, “SELECT id, description FROM part WHERE description like :1″, partItem, descValue).Result

Data qtyValue   ,int                         ,10

Data costValue  ,decimal               ,1.99

DataSelect.RunDataSelect(connector, “SELECT id, description, cost_price FROM part WHERE cost_price < :1 AND quantity > :2 ORDER BY cost_price “, partItem, costValue, qtyValue).Result

All of the above will return a collection of data objects of type Part_Data().

As I mentioned above you can now maintain the data in your SDBMS files through Symphony Harmony. We have added the ability to insert data into an SDBMS file using Symphony Harmony. The DataInsert.RunDataInsert() method accepts an INSERT command and a data object and stores the passed-in data object data to the appropriate file. For example;

data partItem = new Part_Data()

partItem.Id = “ID1”

partItem.Description = “this is the description for part 1”

partItem.Technical_info = “lots of additional information for part 1”

partItem.Quantity = 5

partItem.Cost_price = 12.34

DataInsert.RunDataInsert(connector, “INSERT INTO part”, partItem).Wait()

The data in the partItem data object is extracted, placed into a Synergy record and stored into the SDBMS file. Any errors, like duplicate key, will be thrown on the client.

We have also added the ability to update the data in an SDBMS file using Symphony Harmony. The DataUpdate.RunDataUpdate() method accepts an UPDATE command, which should include a WHERE clause, and a data object, and updates the file with the passed data object data. You can optionally pass a list of fields that restrict the data to be updated. So for example if you application wants to simply update a field for a given record;

data numUpdated          ,long

partItem.Cost_price = 999.99

numUpdated = DataUpdate.RunDataUpdate(connector, “UPDATE part SET cost_price where QUANTITY = 13”, partItem).Result

Will update ALL records that have a quantity value of 13 with the updated cost_price value of 999.99. The resulting numUpdated field will contain the number of records that were updated in the file.

The field list is optional, but it’s recommended! If you don’t specify the field list then the whole record is updated, so you must ensure that the data object contains all the required information otherwise you may get exceptions if key values that are defined none-modifiable are changed. You may also inadvertently overwrite changes made by other processes.

And to provide the fully SDBMS data management capabilities we have added the ability to delete data from an SDBMS file using Symphony Harmony. The DataDelete.RunDataDelete() method accepts a DELETE command, which should include a WHERE clause, and a data object and deletes the matching records from the file.

data numDeleted            ,long

numDeleted = DataDelete.RunDataDelete(connector, “DELETE FROM part WHERE id = :1”, partItem, “ID1”).Result

Removes the required records from the file. There is no need to first select or lock them. The numDeleted field will contain the number of records that were deleted from the file. The where clause is optional so the following is valid;

numDeleted = DataDelete.RunDataDelete(connector, “DELETE FROM part”, partItem).Result

And will result in clearing the entire file – you have been warned!!

All this capability is now available in version 3.2.6 of the Symphony Framework, Symphony Harmony and Symphony Harmony Unplugged packages on Nuget.


Symphony takes a REST

By Richard Morris, Posted on July 6, 2016 at 3:08 am

The Symphony Harmony namespace allows access to data and logic through an SQL like syntax. For example you can select records from a file using a query such as “SELECT ID, DESCRIPTION FROM PART WHERE QUANTITY > 12 ORDER BY QUANTITY”. All matching records are returned from the query in the form of Symphony Data Objects. The data can be local or accessed via Synergy xfServer. The Symphony Bridge utility allows you to expose your query-able database via a standard Windows Communication Foundation (WCF) web service. So far so good.

Steve Ives and I recently had the opportunity to spend a week working together in the UK to “bang” heads together. Steve has always been an exponent of providing RESTful services to access logic and data which can be consumed by just about anything. So we set about using CodeGen to build a standard Restful service that will utilize the Symphony Framework to enable dynamic access to data and ultimately logic.

We soon had the basic service up and running. Out first implementation handled the standard GET verb – and returned all the records in the file. No filtering, no selection, just all the records retuned as a JSON collection. This is the standard API;

rest_1

Now remember that Symphony Harmony allows you to filter the data you are requesting, so we next implemented the ability to provide the “where” clause to the query. So for example;

rest_2

And using ARC (Advanced Rest Client which is a Google Chrome plug-in) we can test and query the service;

rest_3

And we get back just the selected customer details – all those customers where CUSTST has value of CA.

As well as being able to filter the data we can also limit the results returned by Harmony to just the fields we need; this has the benefit of reducing the data being brought across the wire. But how can our REST server build the required data objects to just include the fields we select? By doing runtime code generation! Within our code generated data objects we added the ability to dynamically build the response data object to only include those fields requested by the client. The calling syntax, as provided by the API, is;

rest_4

And again using ARC to test our server we can issue a command like;

rest_5

This is requesting all records from CUSMAS where the CUSNM2 field contains the word “LAWN” and limiting the response data object to just three fields. The response JSON looks like;

rest_6

Two perfectly formed data object that are limited by the fields in the selection list. If your Symphony Harmony connection to your data is via xfServer then only those selected fields will have been loaded from the file, again improving performance.

We also added the ability to limit the amount of data retuned by adding a “maxrows” option;

rest_7

We have already added the ability to the Symphony Harmony namespace to perform inserts, updates and deletes using standard SQL syntax and we’ll be adding these capabilities to the appropriate rest verbs POST, PUT and DELETE. Watch this blog feed for more information.


Drilling for Data

By Richard Morris, Posted on April 20, 2016 at 5:44 am

One cool aspect of a Synergy UI Toolkit program has been list processing. When we introduced the concept of a list load method to populate the list as items were required was a huge step towards decoupling the program logic from the user interface. Because of this separation of concerns it’s actually very easy using the Symphony Framework to load a modern WPF data grid using an existing UI Toolkit list load method.

Our starting point has to be the UI, and that’s being rewritten in XAML. XAML allows data binding between class properties and the column elements of a data grid. We exposes our Synergy data by use of a Symphony Data Object. These data object classes represent your repository based data structures. The fields within your structures are exposed as the properties that the data grid will data-bind to.

Once we have the data grid defined we need to define the hooks between the collection of data we are going to expose to the data grid and the host programs list load method. First we call a generic method that will allow us to signal the required list loading requirements back to the host program. This snippet is going to call a generic method that will then raise the event back to the host:

d1

We are passing the load method name and then various parameters that define the actual data we are going to load and any additional list load method data. Now we can raise the load method request to the host DBL program:

d2

In the host DBL program we need to handle the event so we register an event handler:

d3

The following code snippet dispatches the load request to the existing UI Toolkit load method. There are two formats to the request depending if the list has associated list method data:

d4

So now we need to change the load method. If you have coded your list load method according to the standards laid out in the UI Toolkit manual there should only be a single line of code to change:

d5

The DoingTK test is a flag we have set to indicate if the program is running with the traditional UI Toolkit or our new WPF UI.

We shall be drilling down into the ability to handle list loading during the DevPartner 2016 pre-conference workshop as we all migrate an existing UI Toolkit program to a modern WPF user interface.


STOP! Validation Alert

By Richard Morris, Posted on April 12, 2016 at 12:00 pm

It’s the tried and trusted way to get the users attention. At the slighting hint of an issue with their data entry you put up a big dialog box complete with warning icons and meaningful information.

c1

We’ve all done it, and many programs we write today may still do it. Writing code using the Synergy UI Toolkit its common practice to write a change method to perform field level validation. When the user has changed the data and left the field – either by tabbing to the next or clicking the “save my soul” button – the change method executes and validates the entry. It is here were we stop the user in their tracks. How dare they give us invalid data – don’t they know what they should have entered? It’s an ever so regimented approach. The user must acknowledge their mistake by politely pressing the “OK” button before we allow them to continue. Users are usually not OK with this interruption to their daily schedule so there must be a nicer way to say “hey there, this data is not quite as I need it, fancy taking a look before we try to commit it to the database and get firm with you and tell you how bad you are doing at data entry?”

When migrating to a new Windows Presentation Foundation UI we can do things a little different and guide the user through the process of entering the correct data we need to complete a form or window. We will still use the same change method validation logic however as there is no reason to change what we know works.

When using the Symphony Framework you create Symphony Data Objects – these classes represent your repository based data structures. The fields within your structures are exposed as properties that the UI will data-bind to. These data objects are a little bit cleverer that just a collection of properties. Based on the attributes in the repository it knows what fields have change methods associated with them. Because of this the data object can raise an event that we can listen for – an event that says “this field needs validation by means of this named change method”. Here is a snippet of code registering the event handler:

c2

The event handler simply raises the required “change method” event back to the host DBL program;

c3

Back in the DBL program we can now listen for the change method events. Here is the event handler being registered:

c4

Remember, we are now back in the host DBL code so we can now dispatch to the actual change methods registered against the field. This is a code snippet and not the complete event handler code:

c5

We are calling into the original change method and passing through the required structure data and method data. Inside the change method we will have code that validate the entry and then, as this snippet shows, we can perform the error reporting:

c6

If the code is running as a UI Toolkit program the normal message box dialog is used to display the message. However, when running with the new WPF UI the code provides the required error information against the field. No message boxes are displayed. To the user they will see:

c7

The edit control background is coloured to indicate an issue with the data and the tooltip gives full details of the problem. When the user has entered valid data, the field reverts back to the standard renditions:

c8

We shall be exploring the ability to handle field change method processing during the DevPartner 2016 pre-conference workshop as we all migrate an existing UI Toolkit program to a modern WPF user interface.

 


What’s on the menu today?

By Richard Morris, Posted on April 6, 2016 at 5:51 am

Menu processing is a fundamental requirement in any UI Toolkit program. Without menu columns and entries your program would not function. You also signal menu events from toolbars, and buttons placed on windows and lists. Once a menu entry of any sort is fired, even if it’s signalled from within the DBL code, there is usually a using statement that dispatches to the required segment of logic. When configuring a new Windows Presentation Foundation UI this technique is still valid.

The Symphony Framework UI Toolkit assists the developer to bridge the connection between the DBL host program and the commands associated with menu bars, toolbar, and buttons – basically any WPF control that can bind to a command, and that includes selecting an item within a data grid!

Before we head into how the Symphony Framework UI Toolkit helps let’s first look at some simple UI Toolkit script and code snippets. Firstly we can create menu entries in scripts:

m1

Here we have a menu column called “mfile” with an entry called “f_new”. The important element is the entry name “f_new” as this is the menu signal name that is used within the DBL code. You can create toolbars in code that will signal a menu event, for example:

m2

Here we have the same menu event name of “f_new” being signalled when the toolbar button is selected. We can also add buttons to tab containers;

m3

Windows and lists can also have buttons added to them both in scrip and in code;

m4 m5

If we need to enable or disable the “f_new” capability within the UI Toolkit application we need to do this for all instances, for example;

m6

The Symphony Framework UI Toolkit removes the verbosity of this structure of programming while retaining the same logical concept. Using the Symphony.UIToolkit.Menu.MenuController class allows you to create a command;

m7

Now we have the command we can bind it to any WPF control that accepts a command binding. So for a menu;

m8

We can utilise the same command on, for example, an Infragistics ribbon control;

m9

Using a regular tool bar;

m10

And of course as a regular button on an input form or data grid view;

m11

In the host DBL code we can now simplify the control of the commands. By enabling the single command it changes the executable status of the all UI controls that it is bound to;

m12

When the command is executed the toolkit menu entry is signalled to the host program. We need to define an event handler;

m13

This is a code snippet and not the complete event handler code:

m14

This code is setting up the required menu entry name and then calling into the host DBL code to process the menu select. In the host program we need to ensure that we dispatch to the menu processing code segment. In this example the original toolkit code was processing an input form. We continue to process the input window using the i_input() routine if the toolkit is still the active environment. If we are running using the new WPF UI then we simple process the menu event;

m15

We shall be covering menu, toolbar and command processing during the DevPartner 2016 pre-conference workshop as we all migrate an existing UI Toolkit program to a modern WPF user interface.

 


Covers? Better than the original?

By Richard Morris, Posted on March 21, 2016 at 9:51 am

I’m sometimes sceptical when somebody covers a song I know and love as I’m worried that their version may not bring with it the true spirit of the original track. If it’s not done right it just won’t be pleasing to the ear, and music should always invoke passion. When customers ask us to demonstrate how to put a new User Interface over an existing program I’m always conscious that our “cover” needs to retain the proven logic of the original program while offering the user a new and pleasing, easy to use and navigate, user experience.

In recent weeks I’ve been developing the Symphony UI Toolkit, which as the name suggests, helps you to migrate your Traditional Synergy UI Toolkit programs to a modern Windows Presentation Foundation (WPF) based UI. This new member to the Symphony ensemble provides a number of simple techniques for connecting between the WPF UI and the existing “event” driven DBL code.

One recent engagement where I utilise the whole Symphony Framework, including the new Symphony UI Toolkit, was to add a modern UI to an existing UI Toolkit program. The basic solution was to write the new UI in Synergy .NET using XAML for the UI components. Then host this in the existing Toolkit program using the DOTNET API. We started off with:

old

The program presented a list of items from which the user could select from. Other than the slightly dated look and feel the main problem with the application was that the user was restricted to seeing only the information on a single tab page at a time. The brief for the new UI was simple – make the pages dock-able.

Utilizing a number of core features within the Infragistics UI control set I was able to retain all the logic from the original program and bring a fresh new UI to the user:

new

Now as the user navigated the main list of items, while the docked panels display the relevant information. The grid provided the required filtering and grouping capabilities and selecting an item changed the fields on the input panels to edit mode so changes and additions could be made.

The Microsoft styled ribbon control replaced the traditional menu columns and button toolbar. Additional options were made available within an Outlook style navigation bar – which can be hidden with a single click.

The original program code was modified in a way that we can swap between running the traditional UI Toolkit UI and the new WPF UI by changing a single setting in the synergy.ini configuration file:

ini

Although targeting the UI Toolkit the steps involved in migrating to a new WPF UI with the Symphony Framework will work just as well with almost any style of DBL program, and you can try it for yourself at DevPartner 2016. Join me in the recording studio for the Monday pre-conference workshop where together we’ll make a great new cover version of an old Toolkit program. The day will start relaxed as you write code to handle menu, toolbar and button commands. Then we’ll up the tempo and you’ll code event handlers to execute list load methods. Then we’ll jazz things up a little handling change methods and field validation. By the end of the day we’ll have a number 1 hit on our laptops.


CodeGen 5.1.2 Released

By Steve Ives, Posted on January 28, 2016 at 9:55 am

We have just released a CodeGen update that includes a fix for a problem that was discovered recently related to the processing of enumerated fields. If your repository includes enumerated fields and you use the field selection loop token <SELECTION_VALUE> (or the Symphony Framework custom token <SYMPHONY_SELECTION_VALUE>) then we recommend that you update to the new version and re-generate your code. As a reminder CodeGen recently moved to GitHub, you can find the new release at https://github.com/Synergex/CodeGen/releases.


All Selective

By Richard Morris, Posted on May 29, 2015 at 8:39 am

During DevPartner 2015 a number of people ran through the Utilizing the Repository tutorial which sets out to demonstrate how the meta-data stored in the repository describing your Synergy database can be utilized when building a modern Windows Presentation Foundation desktop application using Synergy and the Symphony Framework.

Using your repository, CodeGen and the associated Symphony Framework templates you can build, from the ground up, a complete WPF application, and this is exactly what you do during the tutorial.

Using the Model-View-View Model pattern you code-generate the model elements as repository based data objects that extend the base Symphony Framework DataObjectBase – this provides field level properties with validation and data bindings. Then we code generate the view – the UI element the user interacts with. The view comprises of windows containing the individual edit controls which in turn use code generated styles. These styles define the visual attributes and data bindings of each field in the repository.

Great – you would think. But I’ve been asked about a default behaviour of a WPF application a number of times and again at the conference, and that is the fact that edit controls, specifically text boxes, don’t auto-select all content when they receive focus. I also find it frustrating but thus far have been unable to think of a solution. “It’s a deal breaker” according to Gayle – who’d just completed the tutorial. Well considering Gayle is a rather fine chap I guess it’s time for me to look at the problem again. I spoke with Jeff @ Synergex who pointed me to a blog by Oliver Lohmann which addresses just this problem.

The solution is to register a behaviour against the TextBox control and handle the GotFocus event – and in the event handler force the selection of the data in the TextBox control. Simple!

And simple it was – and it usually is when you are looking for that “complex” answer. I’ve not done much with behaviours so far, but I think that is about to change! The Symphony Framework has been updated (did that on the plane home) and I’ll be releasing that to GuGet very shortly. The Symphony Framework “style” template will be updated – it’s now released as part of CodeGen – to reflect the new capabilities and normal “behaviour” will be resumed.


DevPartner 2015 – WOW!

By Richard Morris, Posted on May 15, 2015 at 6:37 pm

That was the week that was the DevPartner 2015 conference in Philadelphia. Ok, so I’m biased but I really have to say this was one of the best conference weeks I’ve had the pleasure to be part of for many years. There were some really great sessions: The HBS customer demonstration rocked! They came to a conference a couple of years ago, did a tutorial on xfServerPlus and with this new found knowledge (and some PSG guidance) created a cool web bolt-on to their existing Synergy app.

We saw some fresh new faces from Synergex: Marty blasted through the Workbench and visual Studio development environments we provide and showed some really great tools and techniques. Phil gave us a 101 introduction to many of the “must know” features and capabilities of Synergy SDBMS – and of course was able to address mine and Jeff’s performance issues – you had to be there:). Roger demonstrated his wizardry to enlighten everyone as to the issues you need to consider when transferring your data within local and wide area networks – I was the bad router!

Bill Mooney set the whole tone of the conference with a great opening presentation showing just how committed Synergex are to empowering our customers with the best software development capabilities available.

My first day’s session followed and gave me the opportunity to demonstrate how you actually can bring all our great tools together to create true single-source, cross-platform applications which run on platforms as diverse as OpenVMS, UNIX and Microsoft Windows and onto a Sony watch running Google Wear!

Steve Ives went 3D holographic with videos from his recent trip to the Microsoft Build conference that showed just how amazing the Microsoft platform is becoming – and we aim to continue to be a first class player in that arena.

So many of our products are reaching a level of maturity that blows the competition away. Gary Hoffman from TechAnalysts presented a session showing how to use CodeGen and Symphony in the real world and showed just what you can achieve today in Synergy.

Jeff Greene (Senior .NET engineer @ Synergex) and I presented a rather informal (read written the night before) presentation showing the performance and analysis tools in Visual Studio 2015 that you can use to identify problem area and memory leaks in your application. Within minutes Brad from Automated System forwarded me an email he’d just sent to his team:

“At the Synergex conference just this morning, they just showed fantastic new diagnostics tools in Visual Studio 2015.  I just put the Team on the trail of potential memory issues with these new tools in a Virtual PC environment so we don’t alter our current developer stations. This could both reduce the memory footprint and improve performance.” – You can’t beat such instant feedback!

The tutorial time gives attendees the opportunity to play with the latest tools on a pre-configured virtual machine – plug in and code! And we continued the hands-on theme with Friday’s post conference workshop – where we built the DevPartner 2015 App from the ground up!

nexus_working

Thanks to everyone for coming and making the conference such a great success. It’s our 30th conference next year so keep your eyes and ears open for dates and details – it will be a conference not to miss!


Build your own CLR

By Richard Morris, Posted on March 26, 2015 at 1:54 pm

Open source code is all the rage these days, everyone is doing it, even Synergex.  For some years now CodeGen and Symphony Framework have been open source.  They are both available on www.codeplex.com.  What this gives you is the ability to see inside the classes and programs to see, if you are interested, exactly how they are doing what they do. Even Microsoft are joining the open source band wagon – the .NET Framework is open source and the CLR is following!  Where PSG lead, others will follow (LOL – I think that means laugh out loud, so my kids tell me).

Does this mean you are going to grab all the code, build your own CLR and tweak it to make the blue windows green? No, not at all.  What it does mean is that people can now see what’s happening inside the ocne “black box” and move this code to other platforms.  And this obviously helps us Synergy .NET developers.  We can already take advantage of other platforms because of the availability of the .NET framework and CLR components on non-windows platforms.  It’s how we can deploy your next application to that fancy new Android or iOS phone.  It’s how you can take your good received code you wrote 10 years ago, bundle it up into a tablet application with signature capture and have real time “proof of delivery” built into your systems.

Aside from the conference topics there was an interesting question on the Synergy-l list last night.  The request was to display multiple coloured boxes on the screen.  Sounds simple – and using Synergy.Net inside Visual Studio it was!  20 minute later….

boxes

 

 

 

 

 

 

All the UI elements (colour, values, images) come from a data bound repository based structure so you could load the contents directly from your ISAM files.  The actual colours and images are selected through switches inside the XAML code based on the values of your synergy data.  I don’t think I’ll be demonstrating this simple example at the DevPartner 2015 conference, but there will be lots of great examples to see, and of course tutorials to step you through how it’s done.  It’s the last day of DevWeek tomorrow which means I’ll be driving my car around the M25 car park trying to get out of central London for hours.  So I’ll make this my last blog from the conference.  As always the conference has been enlightening.

 


Symphony Bridge

By Richard Morris, Posted on March 19, 2015 at 1:51 pm

For more than 30 years Synergex has enabled developers to take advantage of many different computer operating systems, hardware environments and networking topologies.  Today there are a number of different options to enable connectivity between client applications and services and the Synergy application logic and data.

If it’s a simple case of data on one machine and Synergy application on another then xfServer is the technology of choice.  One quick change to your environment variables and off you go – data being served on a plate.

If you want to move the execution of Synergy logic onto the server where the data is to improve performance while doing complex data searching and analysis, or need to access the application logic from non-Synergy environments like C#/ASP.NET/Java, then xfServerPlus is the perfect fit.  It takes a little more configuring, but is proven and reliable.

Both of these “server” technologies required a certain configuration of your network and are only recommended for use on your internal LAN.  So getting data and logic accessible to clients on the wrong side of your firewall, in a standard and secure way, requires the use of other tools or software.  The general approach is to create a web service to expose all the methods you would like the client to be able to consume.   Once you’ve written this web service you then need to run the Synergy application logic and data access.  You can call back into your traditional ELB’s via xfServerPlus or you could write the server in Synergy.Net and use xfServer to access the data – but stop!  If you do this you run the risk of running out of channels, different processes crashing your common data and other issues. 

Welcome to the Symphony Bridge Server and the Symphony Harmony namespace.  Symphony Bridge provides a RESTful web service layer that allows you to execute your native Synergy.Net application logic and data access from any Synergy supported client consumer.  The Symphony Harmony namespace provides the ability to access your applications database files using SQL syntax and to make remote procedure calls to execute Synergy application logic, without the need to build a web server of your own, because it uses the Symphony Bridge.

We’ll be presenting the new Symphony capabilities at DevPartner 2015 and you’ll get your chance to try them out by working through one of the self-paced tutorials.  You can also sign up for the post-conference workshop to utilise these new capabilities to build a complete client-server application end-to-end.


Page 1 of 212
Don't miss a post!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts Tag Cloud Archives