Phone800.366.3472 SupportGet Support DocumentationDocumentation Resource CenterResource Center
search
close
Open Menu

Synergex Blog


New string features coming with Synergy/DE 11

By Jerry Fawcett, Posted on August 19, 2019 at 8:58 am

Avatar

Synergy/DE 11 is bringing many new features, and among those additions are some exciting new abilities within the String class. All of these powerful new features are available in both traditional and Synergy .NET.

When dealing with strings, keep in mind that a string is immutable (fancy word for unchangeable), so any time a string variable is changed, a new string variable is created.

First, let me list the new methods added, along with existing methods that include new overloads to the String class: 

String.IsNullorEmpty(@string) , boolean
  • Parameter: String to interrogate for null or empty value
  • Return value: Boolean value indicating whether the string is null or empty
String.IsNullorWhitespace(@string) , boolean
  • Parameter: String to interrogate for null or white-space characters
  • Return value: Boolean value indicating whether the string contains null or white-space characters

New overloads to give precise control on how a string is trimmed:

String.Trim() ,string			(exists prior to version 11)
  • Parameter: None
  • Return value: String with leading and trailing white-space characters removed
String.Trim(@string) ,string 
  • Parameter: Character(s) to be removed from the string’s beginning and end
  • Return value: Returned string with passed-in character(s) removed from the beginning and end
String.TrimStart(@string) ,string
String.TrimEnd(@string) ,string
  • Parameter: Character(s) to remove from either the string’s start or end
  • Return value: String with all instances of character(s) removed from start or end

New methods to control how characters are removed or inserted into a string:

String.Remove(N) ,string
  • Parameter: Starting position in the string to remove all characters until its end
  • Return value: String with all characters from passed starting position to end removed
String.Remove(N) ,string
  • Parameter: Starting position in the string to remove all characters until its end
  • Return value: String with all characters from passed starting position to end removed
String.Insert(N, @string) ,string
  • Parameters:
    1. Starting position to insert string passed as parameter 2
    2. String to be inserted
  • Return value: Returned string with sting passed in parameter 2 inserted

New overloads to give more control on concatenating strings together:

String.Concat(@string, @string) ,string	(exists prior to version 11)
String.Concat(@string, @string, @string) ,string
String.Concat(@string, @string, @string, @string) ,string
String.Concat([#]@string) ,string
  • Parameters:
    1. Two strings to concatenate together
    2. Three strings to concatenate together
    3. Four strings to concatenate together
    4. Dynamic string array to concatenate all elements together
  • Return value: Returned string after concatenation operation

New overloads to locate the position of a substring in a string:

String.IndexOf(A1) ,int			(exists prior to version 11)
String.IndexOf(A1, N) ,int
String.IndexOf(A1, N, N) ,int		(exists prior to version 11)
  • Parameters:
    1. Character(s) to find in string
    2. Character(s) to find in string starting at position specified in parameter 2
    3. Character(s) to find in string starting at position specified in parameter 2 for the length of parameter 3
  • Return value: Integer value with first position of passed character(s)

New overloads to find the last occurrence of a substring in a string:

String.LastIndexOf(A1) ,int		(exists prior to version 11)
String.LastIndexOf(A1,N) ,int
String.LastIndexOf(A1,N,N) ,int		(exists prior to version 11)

Parameters:

  • Parameters
    1. Numeric value of the starting position to begin returning the substring
    2. Numeric value of the length of the substring to return
  • Return value: Returned substring with value from the specified starting and length values

New methods to create an array from a delimited string:

String.Split(A1) ,[#]string
String.Split(A1, StringSplitOptions) ,[#]string (see below for the StringSplitOptions enumeration)
  • Parameters:
    1. Character(s) to use a delimiter
    2. Enumeration StringSplitOptions to control if empty elements are created
    3. Return value: Dynamic string array to be populated with the contents of the passed string

New overload to use the replace method on alphas:

String.Replace(A, A) ,string
  • Parameters:
    1. Alpha value to be replaced by parameter 2
    2. Alpha value to replace all occurrences of parameter 1 in string
  • Return value: Returned string with all occurrences of parameter 1 replaced by parameter 2
String.Replace(@string, @string) ,string 	(exists prior to version 11)
  • Parameters
    1. String value to be replaced by parameter 2
    2. String value to replace all occurrences of parameter 1 in string
  • Return value: Returned string with all occurrences of parameter 1 replaced by parameter 2

And finally, the enumeration StringSplitOptions, which is used with the Split method to control if empty elements are created when creating the string array:

public enum StringSplitOptions
    None		,0
    RemoveEmptyEntries	,1

You can find details on all String members in the System.String topic in the Synergy/DE documentation.

As I mentioned earlier, some of the above are brand new methods (Insert, IsNullorWhitespace, Remove, Split, TrimEnd, TrimStart) added to the System.String class, while others are new overload methods added to existing methods to provide additional functionality. Interestingly, the runtime itself will make use of the String.Concat method when strings are added together (e.g., string1 + string), as it is efficient and generates fewer temporary variables.

Now let’s take a look at one of the new methods. Using the new Split method, we can populate a dynamic array from a delimited string. Say we have a string containing the following:

mystring = “Bob, Mary, Joe, Jack,,,, Fred, Henry, Tom”

We’d like for the values between the commas to be elements in an array, but we don’t want the commas without values between them to become empty elements in the array. This can easily be accomplished with the String.Split method using the syntax below:

stringarray = mystring.split(“,” , StringSplitOptions.RemoveEmptyEntries)

Passing the quoted comma as the first parameter tells the Split method that a comma is the delimiter to look for in the string. Also, for even more control, the delimiter can consist of any number of characters.  There is no need to instantiate the dynamic array, as the dynamic array will automatically be instantiated by the Split method. The result of the above operation will be that the dynamic array stringarray will contain elements with the names that are separated by commas in the string mystring and no empty elements (due to passing StringSplitOptions.RemoveEmptyEntries as the second parameter) for the commas with no values between them:

stringarray[1] = “Bob”
stringarray[2] = “Mary”
stringarray[3] = “Joe”
stringarray[4] = “Jack”
stringarray[5] = “Fred”
stringarray[6] = “Henry”
stringarray[7] = “Tom”

As you can see, the enhancements to the String class are more than enough reason to upgrade to Synergy/DE 11 when it’s released. If you can’t wait and want to try these new capabilities now, the version 11 beta is available in the Resource Center for download. Don’t forget to set your Synergy/DE documentation to the “Beta” version in the version drop-down near the top of the screen.

And wait, there’s more! Now that you’re aware of the new and powerful methods added to the String class, be sure to also check out the new StringBuilder class added to version 11.


Are you protecting yourself and your customers from upcoming security threats?

By Roger Andrews, Posted on August 1, 2019 at 10:07 am

Avatar

Thanks to those of you who joined us last week for our security webinar. We talked about some of the big security threats we all face today, such as ransomware/malware, endpoint attacks, and phishing, and how to protect ourselves from them. Keeping current with security updates is one important step, and this includes operating systems, applications, firewalls, and other components. Also, if you’re using HTTPS or SSL communication, you may need to encrypt your data between computers and when writing to disk (as well as when transferring externally).

Security webinar, July 24, 2019

If you use Windows, make sure you have a plan to upgrade any Windows 7 or Server 2008R2 systems. Microsoft is ending support for these at the end of this year (and for some of their other products soon). This means there will be no more security patches, which will increase the likelihood that your systems will be compromised with ransomware. Also, if you’re using OpenSSL on Windows, you’ll need to upgrade to Synergy/DE 11 (scheduled for release later this year) as it supports the new OpenSSL requirements. Synergy/DE 11 has other security updates, including the ability for services to be configured to run as a user other than system/root.

Here’s an article from our last Synergy-e-News for additional security information. And our Synergy/DE 11 beta page has for more information about our upcoming release. We’ll continue to provide you with information about these security topics and others. In the meantime, please contact us if you have questions or if you would like more information.


An open letter to Synergy developer hiring managers

By Jacklin Garcia, Posted on May 2, 2019 at 12:58 pm

Jacklin Garcia

Dear Hiring Manager,

Congrats on your new Synergy developer hire! Recruiting isn’t easy, but now that you’ve found the right person for the job, the real hard work begins. The onboarding period should be used for training your new hire and setting their expectations about the job. This time is crucial, not only to ensure a smooth transition for your team, but also to make your new employee feel welcome. So where do you start?

Tell your Synergex account executive about your new hire

New Synergy developers in the DevPartner program are entitled to a welcome box full of goodies. This box contains educational materials like laminated cheat sheets as well as some fun Synergex-branded items. Don’t forget to mention the new hire’s T-shirt size when you reach out.

Download and modify the suggested 90-day plan

At Synergex, we use 90-day plans for all of our new hires. They are a key part of our onboarding strategy. We’ve created a template plan for you to download and modify from our education library. At the very least, we suggest grabbing the link for the new hire onboarding playlist on YouTube that is referenced in the plan and reviewing the other materials available in library.

Send your new hire to a Synergy DBL Language Essentials class

The best way to learn Synergy DBL is to take this class. Many developers prefer hands-on learning, and in this class, students will build a simple application in Synergy. You can either send developers to our headquarters for the standard five-day training or request a custom class at your location. If a class at HQ isn’t being advertised when you need one, that’s ok! Reach out to classes@synergex.com and we’ll see what we can do.

Have your new hire subscribe, join, or follow us on various platforms

We don’t like to bombard our customers with emails, so connecting with us on sites like YouTube and GitHub is the best way to stay in the know about new educational content. The Synergex Community is also the place for Synergy developers to get advice from their peers and make suggestions for Synergy/DE enhancements.  Bookmarking our online documentation is also a great idea!

Call support early and often

Our support team is incredible, and their services are free with your Synergy DevPartner subscription. Encourage new hires to call in (toll-free from the US and Canada 800.366.3472 or +1.916.635.7300 for all other countries) or email (support@synergex.com) with any Synergy-related problems they may encounter. Our support team is made up of engineers who are more than capable of troubleshooting issues and helping you track down bugs in your codebase. They are also happy to report any product bugs you may encounter directly to our development team. 

Attend a Synergy DevPartner conference

Our conferences provide a dedicated time to learn and immerse yourself in the latest and greatest in the Synergy/DE ecosystem. It’s free for DevPartner subscribers, and it’s a unique opportunity for your new developers to get face-to-face interaction with their Synergy developer peers and the Synergex team.

If you need help identifying any additional educational materials, please reach out to us! Congratulations again on your new Synergy developer, and best of luck with the onboarding process.

Sincerely,

The Synergex Education Team


Highlights from the 2018 Synergy DevPartner Conference

By Synergex, Posted on January 14, 2019 at 3:26 pm

Synergex

As we head into 2019, we reflect back on one of our favorite events of the year: the 2018 Synergy DevPartner Conference in New Orleans.

 

Packed with sessions on topics ranging from modern and agile development practices to RESTful web services to QA and learning culture, not to mention an engaging and illuminating keynote presentation from Microsoft’s Donovan Brown, the conference offered a plethora of info, ideas, tips, tricks, and plans for the future. Case studies and customer demos provided insight into practical implementations of technical concepts, and we were jazzed to introduce our new open source RESTful web services project, Harmony Core. Bourbon Street wasn’t too bad either! The legendary food, music, and culture of one of America’s most historic cities provided a great backdrop to a fun and productive week.

Here are some key takeaways from the conference:

  • Improve your productivity and practices by adopting more efficient development methodologies.
  • Enhance years of Synergy data and code with new technologies, including enabling connectivity through RESTful web services.
  • Security and disaster recovery are important for compliance—stay up to date with Synergy SSL and operating system security patches.
  • Use traditional Synergy in Visual Studio (it’s not as hard as it seems!) to significantly boost productivity, lower the barrier to continuous code integration, and improve your processes and software quality.
  • Move to the cloud. Developing and running your Synergy application in the cloud is relatively easy and provides a convenient path to expand your infrastructure to meet demands.
  • Education in the workplace is important—create an onboarding program that includes presentations, videos, and discussion.

The Synergex team came back to the office energized and ready to implement big plans for Synergy in the new year. We look forward to seeing you at the 2020 conference!

You can check out videos and slides of conference sessions Synergy DevPartner Conference Website.

(more…)


Using the Power of PowerShell with Synergy

By Jerry Fawcett, Posted on November 30, 2018 at 1:56 pm

Avatar

Like it or not, change is inevitable. Now that you’ve mastered the command prompt, it’s slowly but surely being replaced by PowerShell. Actually, this process was started by Microsoft way back in 2002, which is how PowerShell came about in the first place.

Starting with Windows 10, the PowerShell command prompt has replaced the Command Prompt as the default. (To control this, toggle the Taskbar setting “Replace Command Prompt with Windows PowerShell in the menu when I right-click the start button or press Widows Key+X.”)

Comparing Command Prompt and Windows PowerShell

PowerShell Up

So you opened a PowerShell window and now everything you try results in copious output in ominous red text? Luckily for those of us who are learning PowerShell from the ground up, PowerShell comes with very complete and verbose help. Just type

get-help cmdlet

For example, you’d use “get-help where” to learn about the powerful where object. However, if you’re familiar with any OO language you’ll probably find PowerShell quite natural.

One would think PowerShell is a Windows-only tool, but surprisingly, Microsoft has made it open source, and it’s also available on macOS, CentOS, and Ubuntu.

You can use PowerShell together with Synergy in many ways, and I’d like to share some of what I’ve learned. Using the power (pun intended) of PowerShell can be helpful in getting information on Synergy products from a machine. Getting this information without PowerShell would be difficult—especially for a non-technical person—and potentially error prone.

By preceding a PowerShell command with “powershell” you can actually run it from a DOS command line without opening a PowerShell console, as the command is passed to the PowerShell processor as a parameter. However, by doing this, you’ll lose the awesome power of tab completion available in the PowerShell console. Try it: Open a DOS command window and type “powershell /?”.

A demo of get-help cmdlet

The PowerShell is Yours!

(At this point, I feel I must tell you that Synergy tools are currently not supported in a PowerShell environment. Ideas post, anyone?)
To list all Synergy products:

Get-WmiObject -ComputerName COMPUTERNAME -Class Win32_Product | sort-object Name | Select-Object Name |where{$_.name -like "*Synergy*"}
Output –
Name
----
Synergy DBL Integration for Visual Studio 10.3.3f
Synergy/DE (X64) 10.3.3f
Synergy/DE 10.3.3f
Synergy/DE Online Manuals 10.3.3
Synergy/DE xfNetLink .NET Edition (X64) 10.3.3f

To list all Windows updates on a machine:

(New-Object -ComObject "Microsoft.Update.Session").CreateUpdateSearcher().QueryHistory(0,(New-Object -ComObject "Microsoft.Update.Session").CreateUpdateSearcher().GetTotalHistoryCount()) | Select-Object Title, Description, Date

If you need to retrieve all events from the Windows Event viewer that deal with the runtime, simply have the end user double-click on a batch file containing the command below and send you the file it creates (C:\temp\SynEventViewerEntries.txt).

powershell Get-EventLog -logname application -source dbr^|Format-List MachineName, Message, TimeGenerated ^|out-file C:\temp\SynEventViewerEntries.txt

To list all installed software on a machine,

Get-WmiObject -ComputerName FAWCETT -Class Win32_Product|Sort-Object name| Select-Object Name, Version

Just so you’re aware, when you get started, you may find no script will successfully run, because script execution is disabled by default. You can enable it as follows:

First, to verify the PowerShell’s execution policy, type

Get-ExecutionPolicy

You’ll probably see

Default is Restricted

To enable execution, you must open the PowerShell command prompt as an Administrator and type

Set-ExecutionPolicy Unrestricted –Force

And just for fun, if— like me—you miss the Windows Experience score that was first introduced with Windows Vista but is now removed, you can use PowerShell to get your machine’s Windows Experience score. The Windows Experience score is a benchmark that measures your PC’s performance in five categories: processor, memory, graphics, gaming graphics, and hard disk performance. The score is the lowest of these benchmarks. To get your machine’s score, run

Get-WmiObject -Class Win32_WinSAT

If you want to learn more, you can search online. Every PowerShell topic I searched for resulted in a wealth of information.

More Power(Shell) to you!

Some good resources:

Microsoft Official PowerShell documentation

Getting Started with Windows PowerShell

PowerShell: The smart person’s guide


Big Code

By Richard Morris, Posted on April 13, 2018 at 7:13 am

Avatar

If you have large (and I mean LARGE) blocks of code in single source files – and by large I mean 20k lines plus – then you may be having compiler issue with “SEGBIG” errors: “Segment too big”. This issue arises because your code segment is just too big for the compiler to handle and is usually the result of many man years of development to a single routine that has just grown over time.

If you encounter SEGBIG issues, as a customer I have recently worked with did, then this quick blog will give you some practical ideas of how to manage the issue and modify the code to allow for future development and expansion, without having to rewrite the world.

First off, it’s not the physical number of lines of code in the source file that’s the issue, it’s the lines of code and data definitions within each routine block: subroutine or function. Developers have encountered the problem for many years and the resolution has previously been to chop out a section of code, make it into a subroutine or function, and somehow pass all the appropriate data to it – usually by large numbers of arguments or common/global data blocks.

The “today” way is not too dissimilar but is a little more refined: turn the code block into a class. The first major advantage is class-based data. This removes the need to create subroutines or functions that accept large numbers of arguments, or to create large common or global data blocks. As an example:

subroutine BigRoutine

endparams

.include ‘AppCommonData.inc’

record localData

localRoutineData      ,a10

endrecord

proc

call doSomeLogic

call doOtherLogic

xreturn

doSomeLogic,

return

doOtherLogic,

return

end

Obviously this code will not give us a SEGBIG issue, but its an example of the structure of the code. The routine has a common data include and private data. In the routine body we make multiple local label calls. When there is too much data and too many lines of code added we will encounter a SEGBIG error.

So to address this, in the same source file, we can create a class with class-level data (the routine level data) and methods for the local call labels. So, for example:

namespace CompanyName

public class BigRoutineClass

private record localData

localRoutineData      ,a10

endrecord

public method Execute, void

endparams

proc

doSomeLogic()

doOtherLogic()

mreturn

endmethod

method doSomeLogic, void

.include ‘AppCommonData.inc’

proc

mreturn

endmethod

method doOtherLogic, void

.include ‘AppCommonData.inc’

proc

mreturn

endmethod

endclass

endnamespace

In this code, the Execute method becomes the entry point. All the existing code that made the label calls is moved into this routine and the calls changed to method invocations;

doSomeLogic()

doOtherLogic()

Then we can change the existing BigRoutine code;

subroutine BigRoutine

endparams

record

routineInstance       ,@CompanyName.BigRoutineClass

endrecord

proc

routineInstance = new BigRoutineClass()

routineInstance.Execute()

xreturn

end

Simple!

Although the code changes I’ve described here sound monumental, if you use Visual Studio to develop your Traditional Synergy code the process is actually quite simple. Once you have created the scaffolding routine and defined the base class with class level data (which really is a case of cutting and pasting the data definition code), there are a few simple regex commands we can use that will basically do the work for us.

To change all the call references to class method invocations you can use:

Find: ([\t ]+)(call )([\w\d]+)

Replace: $1$3()

 

To change the actual labels into class methods, simply use the following regex:

Find: ^([\t ]+)([a-zA-z0-9_]+)[,]

Replace: $1endmethod\n$1method $2, void\n$1proc

 

And to change the return statements to method returns, use:

Find: \breturn

Replace: mreturn

 

These simple steps will allow you to take your large code routines and make manageable classes from them which can be extended as required.

If you have any questions or would like assistance in addressing your SEGBIG issues, please let me know.


A Winning Formula

By Richard Morris, Posted on February 15, 2018 at 3:28 am

Avatar

For a recent project I’ve worked with a customer who wished to provide their users with an engaging desktop application that would allow management of product formulations.  They had a Synergy UI Toolkit version and also elements of the required application in a third-party system. However, neither met the needs of the users.  After a review and discussions about their requirements we agreed on a Synergy .NET Windows Presentation Foundation based application using Infragistics tooling for the User Experience.

The basic requirements of the application where to allow the creation and maintenance of formulations.  A formulation contains the components required to make a finished product.  For this customer the final product is an aerosol. 

Let’s take a look

The basic interface is built using the Infragistics control to handle navigation (Ribbon menu control), listing and selection of data (powerful DataGrid), hierarchical representation of the formulation components (TreeView) and management of finished product details (Property Grid);

Of course, using the Infragistics DockManager allows the user to drag and reposition all the available windows to their liking.

There are powerful searching facilities, or QBE (Query By Example) controls.  These allow the user to provide snippets of information and the application will query the Synergy DBMS database using Symphony Harmony and the Synergex.SynergyDE.Select class;

The top line of the QBE controls allow the user to enter the data in the columns they wish to search for and so only select the data they require and not have to filter through a list of thousands of formulations.

Because the application is written in Synergy, the existing printing capabilities from the original UI Toolkit application have been retained without change;

The whole application is written in Synergy .NET and utilises the Symphony Framework for controlling the data access and presentation.  If you would like more details, or would like to know how you can build modern applications with Synergy .NET please drop me an email.


What a Cracking Idea

By Richard Morris, Posted on February 9, 2018 at 5:52 am

Avatar

The Synergex Resource Center Community site has a number of great features including the Answers and Ideas portals. Ideas is the place to post your ideas for improving Synergy and related products. You can vote for ideas and provide comment and feedback to help the whole community be more successful. The Synergex community site had an idea posted recently:

You can read the full idea at the Synergex Resource Center.

Synergy DBMS Manager

The Synergy DBMS Manager allows you to query and manage data in your Synergy data files using Symphony Data Objects.

Code generating Symphony Data Objects for your files is a simple process.  Ensure you have your Synergy Repository configured. You need to define the structure and associated file definition for each file you wish to be able to manage using the utility.  There are full instructions at the Symphony Framework page which walk you through the few simple steps to building your data object assembly in Synergy .Net.  Not sure how to build Synergy .NET assemblies – then send me your repository and I’ll do it for you!

To query data you simply issue the required select command and define the response data object;

Simple, and you can scroll through the results.  The idea posted was to be able to then export the selected data to Microsoft Excel so that further review and analysis can be performed.

A new toolbar button has been added and the GemBox Spread assembly used to easily create the Excel document.  Now you can export all the selected rows to an Excel document:

If you’d like more details, please visit the Symphony Framework page or contact me directly.

 

 

 


Code Gremlins?

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

Avatar

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……?


Let’s get Physical – at DevPartner 2017!

By Richard Morris, Posted on March 8, 2017 at 8:38 am

Avatar

The DevPartner 2017 conference is rapidly approaching and so I thought I’d follow on from Steve’s recent blog about the conference and what a content packed agenda we have this year. As usual we have the hugely successful customer demonstrations – always great to see how developer are making the most from Synergy today. There are guest speakers taking about testing your software – and I thought if it compiled it was tested, so I’ll be glued to that one. We also have a student Physiotherapist guest speaker – not your usual topic for a Synergy software conference I must agree!

Way back in 1981 a certain blond bombshell by the name of Olivia Newton-John hit our screens in tight pink leggings telling us all to “get physical”. For many around my age she was the pin-up of our times. I’m sure I can recite all the lyrics today! Although we won’t be seeing Miss Newton-John at the conference (sorry) we will be “getting physical”!

As part of an undergraduate degree I’ve developed an interactive mobile app:

Exercise compliance is one of the most important parts in patient rehabilitation, and yet it is given minimal consideration. The Chartered Society of Physiotherapists (CSP) detail that the first step in rehabilitating a patient back to their pre-injury function lies with their Physiotherapist’s ability to educate and motivate their patient through a clear and concise home exercise program. Patients can regularly expect to receive a printed sheet of generic exercises laden with hand-written amendments which look to tailor the exercises to the patient’s needs. Given that more than 70% of adults in the U.K. own a smartphone, there has never been a better time to take the technological leap and focus of connecting with and engaging patients much more remotely. That’s where Physio My Way comes in.”

And so Physio My Way was born. Written entirely in Synergy .Net it’s a true mobile application that is designed to educate patients to perform the correct exercises and monitor their compliance with the exercise schedules defines by their therapist. In-app options include the ability to review the various assigned exercises and stream videos that show just how they should be performed. Guidance is provided through spoken instructions and monitoring patient compliance is recorded using the devices accelerometer.

Movement patterns and screen activity can provide a clear and detailed account of every single repetition that a patient completes. Their Physiotherapist will have secure access to all of their patients’ data through their own personal log in. Specifically, this means that all exercise progressions or regressions will now be based on objective outcome markers, rather than a patient’s subjective recollection of their exercise completion. This gives superior reliability of patient feedback and is based on key Physiotherapy findings such as severity, intensity and frequency of pain and rate of perceived exertion at every interval.”

Our guest student Physiotherapist , Ashley, will be presenting an interesting session on his design and the theory behind the Physio My Way app and the results from his studies – did it improve people’s compliance with their prescribed exercise plan? And I’ll be dissecting the technologies used to develop and deploy data in the cloud and the app to Google Play Store and the Apple App Store:

At the post conference workshop on 12th May I’ll be building, from the ground up, a cross-device mobile application through lecture and demonstration. The session will target both Android and iPhone devices. Using the latest Synergy tools, Xamarin forms and Visual Studio.  We will initially build and deploy a simple cloud based server. From here we will build a client connection module to communicate to our server and also implement the required code to manage Synergy device licensing. Next we will layer on the UI – XAML based cross device compliant forms. We’ll include some cool Xamarin components and finally build and deploy to both iPhone and Android. It’s a not-to-be-missed day if you are interested in expanding your Synergy applications capabilities onto the mobile device platforms.

Make sure to sign up and bring your exercise gear as we “get physical” at DevPartner 2017!


CodeGen 5.1.6 Released

By Steve Ives, Posted on November 7, 2016 at 4:31 pm

Steve Ives

I am pleased to announce that we have just released a new version of CodeGen with the following enhancements:

  • We modified the way that key loops are processed so that if a repository structure has a mixture of access keys and foreign keys defined, the foreign keys are ignored when processing key loops.
  • We added a new key loop expression <IF FIRST_SEG_NOCASE>.
  • We added four new field loop expressions <IF AUTO_SEQUENCE>, <IF AUTO_TIMESTAMP>, <IF AUTO_TIMESTAMP_CREATED> and <IF AUTO_TIMESTAMP_UPDATED> which can be used to determine if fields are defined as auto sequence or auto time-stamp fields.
  • We added two new key loop expressions <IF AUTO_TIMESTAMP_CREATED> and <IF AUTO_TIMESTAMP_UPDATED>.
  • We added two new key segment loop expressions <IF SEG_AUTO_TIMESTAMP_CREATED> and <IF SEG_AUTO_TIMESTAMP_UPDATED>.
  • We changed the behavior of the field loop expansion token <FIELD_TYPE_NAME> when used in conjunction with auto-sequence and auto-time-stamp fields.

This version of CodeGen is built with Synergy/DE 10.3.3a, requires a minimum Synergy runtime version of 10.1.1, and can be downloaded from here.


Examining and modifying Synergy data

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

Avatar

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

Avatar

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.


Drilling for Data

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

Avatar

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

Avatar

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.

 


Don't miss a post!

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

Recent Posts Categories Tag Cloud Archives