Loading...
 

Specification

Overview

On Application Settings there are now multiple trees:

  • Process Events (which are what we now call process controls, the queries you can run to interrupt events)
  • Agent Jobs (which are the tickle reports that are run by the Agent and generate results sets)
  • Settings (which are overridable settings, defaults set in Application Settings and then overrides used in individual programs such as Customers, Suppliers. Users has now been added to this list.)

Set up

In the System Options program there is a Settings tab with an Agent Jobs tree, which shows the monitors set up grouped by Categories, and also Classification which is user defined. The Category chosen defines which Program it will appear in to be overridden at a record level.

For example, if you had a Query set up to cycle through customers and email the ones that were over their credit limit, and defined this in the Customer Category, you could then turn on or off the emailing for each customer via the customer screen. Also you can override the email address for each customer in the same way.

Settings

You can add system overridable settings in Application Settings. These are split into different categories that can be overridden by the program specified by the category. For example if you add a setting to the Customers category then this value can be overridden for an individual customer in the Customers program.
You can specify the default value for the system as a whole, as well as possible values for the override, for example
Set the “Options” field to Text to use a free text item. Set the “Options” field to Y,N is you wish to limit the options to Y or N.

Agent Jobs

These items are for reporting against data tables and reporting the results via email, bookmarks etc.
The result of the queries should generally be a select statement, this can then be used to determine who to email and what to say, by using {n} to pick up the nth column (zero based), i.e. in the credit examples {0} = CustomerId, {1} = Customer Email.

Process Events

Process Events have been extended to be able to interrupt many more events now including validation and value changed of individual form controls, as well as at the time of printing program reports. These are all available from the drop down list of events, reports are listed in the programs menu if you wish to use an event of a report printing.
Helper Wizard
There is a helper wizard available to guide you through the type of placeholder you want to insert, accessed by the plus icon next to the SQL text box.

Report parameters and report parameters for batch prints can be set using this wizard, as can Edit Controls.

The wizard will provide you with a list of all the valid controls for each form, if you have chosen to retrieve a value from a control or set a value for a control. (Note that we can’t list wizard controls due to the way wizards are written, so you will have to identify the name of wizard controls yourself. The easiest way to do this is to add a validated control event to the wizard and then use a:

select ‘information’,’ControlName

to retrieve the name of each control you step through.)

Control Events

When using the individual control events (e.g. After Control Validated) you are able to interrogate the control name or value by using ControlName or ControlValue

Print Events

When using the print events (eg. Before Print Report) you can access the parameters of the report by using ReportParameters.ParameterName eg. ReportParameters.SalesOrderId will retrieve the SalesOrderId of the current print. If part of a batch print this event would fire before each report was printed.
There are also before & after batch print events.


Control Actions

From any event you can now access any edit control (controls on the entry forms) in any events with the following syntax EditControls.ControlName by replacing ControlName with the name of the control eg. EditControls.txtProduct

You can also update any edit controls on the entry form by using the syntax:

Select ‘SetControl’,’ControlName’,ValueToSet,’FocusControl’

So running:

Select ‘SetControl’,‘txtProduct’,25,’1’

Would set the value of the Product control to 25 and then set focus on the control.

Print Actions

You are also able to fire off prints by using the syntax:
Select ‘Report’,’ReportKey’,’TableName’,’PrintTarget’,’ShowDialog’,’PrinterName’,’PaperName’,’PaperSourceName’
Then you need to provide the data for the report to map to as another select statement.

So on an after RemittanceAdvice print event, running
select ‘Report’,’RemittanceAdviceExtra’,’Cash’, ‘Printer’,’0’,null,’Letter’,’Tray1’
select Supplier,CashId,SystemType,Cash from Cash where CashId = ‘ReportParameters.CashId
would print a RemittanceAdviceExtra (an alternative RemittanceAdvice report set up in the ProgramReports table) to the printer without showing the print dialog, to the default printer with letter format paper from paper Tray 1.

The 2nd select statement will pull all the info needed for the report based on the CashId of the report parameters of the report that fired the event.

Requests

You can now display a dialog to get the user to enter data and then save it away to wherever you want by using an SP, using comma separated values of the arguments
select ‘Request’,’ParameterNames’,’Field labels’,’Datatypes’,’Defaults’,’zzzwsp_TestOutput’
for example:
select ‘Request’,’Parameter1,Parameter2’,’Enter 1st parameter,Enter text’,’decimal,string’,’1.56,default’,’zzzwsp_TestOutput’
would display a dialog asking for 2 values, with defaults, and then upon saving call the SP zzzwsp_TestOutput with parameters of @Parameter1 decimal, @Parameter2 nvarchar.

Select statements

You can now have multiple select statements in one event. This makes it possible to do much more in one event. For example you could prompt using a select ‘question’ and then if they hit cancel the event will be finished, else the event will continue to process the remaining selects.
For instance
Select ‘Question’,’Do you want to print an acknowledgement?’
select ‘Report’,’SalesOrder’,’SalesOrders’,’Printer’,’0’,null,’Letter’,’Tray1’
exec wsp_SalesOrdersSelect SalesOrders.SalesOrder
would print an acknowledgement only if the user says yes.

You could also use the set control select to update multiple controls in one event eg
Select ‘SetControl’,‘txtProduct’,25,’1’
Select ‘SetControl’,‘txtCustomer’,12,’1’
Would set the product & customer controls and re focus on both controls in turn (forcing the control validation to occur again when leaving the control)

Monitoring

There is a WinMan Agent included in the release as a separate executable (WinManAgent.exe)

When you run this it will execute actions based on the Agent Jobs you set up from within WinMan, sending emails, reports, bookmarks and writing text files to your network.

    • You will need a config file for the Agent in the WinMan directory, you should be able to copy the Winman.exe.config file used for WinMan and rename it WinManAgent.exe.config for the Agent **

Process Control – Step by Step


General Tab
• Process Id – Free text identifier for the process control item
• Description – The description to appear on the tree view
• Enabled – Whether the item is active
• Category – Top level category for the item. The section it is relevant to.
• Program – The program the process control relates to.
• Process Control – The process to be actioned upon. You need to select the program first.

Query Tab

The plus button gives you example templates of SQL code specifically designed for use in process control. For example Information will give you the template code to provide an information box back to the user.

To provide access to the data values in the SQL query use the Table.Column syntax. i.e. SalesOrders.SalesOrder to obtain the sales order key from the SalesOrders table. Note that this syntax retrieves the first row of the selected table only.

Place holders (the {} brackets) can be used to replace information from the returned results set. This uses a zero based index. So zero is the first column, one is the second and so on.
In this example;
select ‘Information’,’This order has been shipped {2}’,’SalesOrders.SalesOrderId
{2} indicates that it will be replaced by the third column of the results set. In this case ‘SalesOrders.SalesOrderId’ – the sales order number.

Querying new data added

There are events called “Before Record Saved”, “Before Record Modified”, “Before Record Added” that you can use to interrogate the data after it has been entered into the entry table and before it has been committed to the database.

For example, to use the quantity of a sales order item record on the entry dialog you would set up a process control for SalesOrders with the event Before Record Saved. This will get run for header & detail so we need to the use the TableName property to identify the fact that we only want to action this on the detail table.

The SQL would be as follows for this:

if ‘TableName’ = ‘EntrySalesOrderItems’
begin
select ‘Information’,’New Item quantity is {2}’,’EntrySalesOrderItems.Quantity
end

When using data from the table before it is committed to the database the table name is prefixed with Entry to distinguish between the old and the new data.

If you wish to compare against the existing SQL data you can use this:

if ‘TableName’ = ‘EntrySalesOrderItems’
begin
select ‘Information’,’Old quantity is {2} and the new quantity is {3}’,Quantity,’EntrySalesOrderItems.Quantity’ from SalesOrderItems where SalesOrderItem = EntrySalesOrderItems.SalesOrderItem
end

which will pull Quantity from the SQL SalesOrderItems table based on the primary key of the EntrySalesOrderItems table in memory.

Querying Custom Fields

It’s also possible to query custom fields added to a particular program. The syntax for which is “CC_” + the identifier of the field (which you can see as the name of the tabpage in the custom fields dialog)

So for example to query a Sales Order with a custom field called Custom1 you would use SalesOrders.CC_Custom1 to get the required data.

Loading Custom Forms

You may now load custom forms using the following syntax:

select ‘CustomForm’,’CustomFormId’,’Title’,UseMasterRecord(1 or 0),Identifier

where the UseMasterRecord parameter specifies whether the system will attempt to load the current view record into your custom form dialog and the Identifier specifies a specific identifier of the record to load into the custom form dialog

so for example:

select ‘CustomForm’,’BFRM_Products’,’Quick product add’,1

would load a custom form call BFRM_Products from the CustomForms & CustomFormItems tables, and attempt to load the master record of the current form into the entry dialog, based on the primary key. If you change the 1 to a 0 then the entry dialog will always be creating a new record instead of modifying an existing record.

select ‘CustomForm’,’BFRM_Products’,’Quick product add’,0,23007

would load the same dialog, but always attempt to load record number 23007 into the dialog, regardless of the current view record.

Setting Errors on form controls

You can now set error icons on controls. The following command :

if ‘EditControls.txtProductDescription’ = ‘’
begin
Select ‘SetControlError’,’txtProductDescription’,’You must enter a description’
end
else
begin
Select ‘SetControlError’,’txtProductDescription’,’’
End

Would set an error on the product description control. The event to run this command is the before record saved event. The command will automatically stop the save if any of the controls have an error message <> ‘’, so you need to make sure you clear the errors off all the controls that you set an error on (using else statements as above).

Custom Forms

You can now use events on custom forms as you would any other form in the system.

Plugins

You can now call plugins from process controls. An example of this would be the following run on a “before row modify” event, to replace the row modify dialog with a bespoke one:

Select ‘Plugin’,’ConfigureDoor.dll’,’WinMan.WinUI.ConfigureDoor’,Identifier
Select ‘Stop’

This would run the selected ConfigureDoor form from the configuredoor.dll plugin found in the Winman plugins folder. It would hand over the identifier of the event, which in this case is the recordnumber of the row you are modifying.

After the plugin has finished running the process control would then stop the event from running the standard row modify code.

The question select has now changed syntax to enable code to only be run if the user says yes to the question. For example, the old method:

Select ‘Question’,’Do you want to run this SP?’

EXEC wsp_emailsendttw ‘1’

Would have always sent an email regardless of the answer to the question. We now have a new way of branching the code. You can add process controls without an event now (leave the event drop down on general). Then the new syntax for the select question will enable you to call this code depending on the event. So the following code will only send the email if the user says yes.

Select ‘Question’,’Do you want to run this SP?’,’emailanswer_yes’,’emailanswer_no’

Then add a new process control with Id of emailanswer_yes, event General, and put in the query

EXEC wsp_emailsendttw ‘1’

You can either not provide an emailanswer_no or create one to do whatever you want when the user says no.

Run actions

You can now run any actions on a form from a process event, with the following code:

Select ‘RunAction’,’Convert Quote’

You can use either the key of the action or the text displayed on the screen for the action to determine which action to run.

Populate combobox source

You can also now populate a combobox source table from any SQL statement.

EG. On control validated:

select ‘PopulateCombo’,’txtCC_new’,’select purchaseorderitem, product, quantity from purchaseorderitems where product = ControlValue

would populate a custom control called new which is set up as a long integer with related choice of:

select purchaseorderitem, product, quantity from purchaseorderitems where purchaseorderitem is null

Focus Control

You can now set focus on a control from a process event with the following code for example to focus upon the txtCustomer control:

Select ‘FocusControl’,’txtCustomer’



Validate Control

You can now validate a control from a process event with the following code for example to validate the txtCustomer control:

Select ‘ValidateControl’,’txtCustomer’

Validation will provide the effect of tabbing off a control, so in effect will cause any calculations dependant upon the value of the control to be recalculated. For example in sales order items if you validated the quantity control it would cause all the values to be recalculated.

In addition to this there is an extra parameter to SetControl, which will let you set the value of a control and then validate it.

Select ‘SetControl’,’ControlName’,ValueToSet,’FocusControl’,’ValidateControl’



So running

Select ‘SetControl’,‘txtProduct’,25,’0’,’1’

Would set the value of the Product control to 25 and then validate the control.


Retrieving values

You can now retrieve or set values of grids when doing an action upon a grid (e.g. Detail modify)
For instance on a Before Row Modify you could use:

select ‘Information’,’GridActiveRow.ItemNumber

to give you the value in the ItemNumber column of the active row of the grid.

You can also use:

select ‘Information’,’Grid(row).column

where row is a 0-based number to give you the column value for a specific row of the grid.

If it is a grid with multiple bands (header & detail rows) then you can specify the band0 (top level row) and the band1 (detail level row) like this:

select ‘Information’,’Grid(band0)(band1).column

You can also use:

select ‘Information’,’GridActiveParentRow.column

to give you the value of the column in the parent row of the active row of the grid.

Setting Values


Select ‘SetGrid’,Column,ValueToSet,RowIndex

Will let you set the value of a column of a row in a grid.

If it is a multi band grid then use the syntax:

Select ‘SetGrid’,Column,ValueToSet,Band0RowIndex,Band1RowIndex

If you don’t give it any RowIndexes then it will set the value of the ActiveRow.


You can now retreive additional values from grids.

GridNumberOfRows


You can now use:

SELECT ‘Information’, GridNumberOfRows

To find out the number of rows in the top band of the grid.

OR

SELECT ‘Information’, GridNumberOfRows(1)

To find out the number of the rows in the child band of the row number included in the brackets.

Emailing


There is a new event “Before Report Emailed” which will let you add additional attachments to emails. To do this use the select command ‘AddAttachmentToEmail’

An example for how to add attachments from a product on a line of a shipment is below:

declare @Product bigint
select top 1 @Product = Product from Inventory where Shipment = ‘Identifier’ and itemtype = ‘P’

SELECT ‘AddAttachmentToEmail’,
Document
FROM
Documents
WHERE (Identifier = @Product AND TableName = ‘Products’)

The 2nd argument of the select statement is either an actual file (e.g. c:\test.txt) or a primary key of a document from the documents table, as in this case. If a document primary key is used then the document will be automatically retrieved if it is embedded in the SQL.

AddRecipientToEmail
This action is utilised to add recipients to an e-mail during the ‘Before_Report_CreateEmail’ event. The format of this action is:

SELECT ‘AddRecipientToEmail’, ‘EmailAddress’, ‘Override’,’RecipientType
Replace ‘EmailAddress’ with the e-mail address you wish to add. ‘Override’ is an optional boolean variable which determines whether or not the system will replace all existing addresses.

-MS 17-Oct-2011
RecipientType’ New functionality has been added to allow you to add another option to choose which recipient box it is placed in (To, CC, BCC), also

SELECT ‘AddBodyToEmail’, ‘Hello World’, ’ Override

Allows you to alter the email body.

Running Commands

There is also a new RunCommand you can use to run any program on the client’s system. The full syntax is:

Select ‘RunCommand’,’FileName’,’Verb’,’Arguments’,’WindowStyle’,’CreateNoWindow’,’UseShellExecute’

Where FileName is either an actual file or a document primary key. The other arguments are all for the processStartInfo class, found at http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo_members.aspx

For example if you wanted to print out the documents as per the above example in the “After Print Report” event you could use:

declare @Product bigint
select top 1 @Product = Product from Inventory where Shipment = ‘Identifier’ and itemtype = ‘P’

SELECT ‘runcommand’,
Document,
‘Print’,
‘’,
‘maximised’,
‘1’
FROM
Documents
WHERE (Identifier = @Product AND TableName = ‘Products’)

This would print out all the documents for that product, so long as windows can find appropriate programs to use to print them.

Alternatively you can run whatever you want as per the command line by just using the filename and arguments properties to specify the program to use and arguments to use with it.

Hiding Controls

We have added the ability to hide controls.
The syntax for this is:

SELECT ‘HideControl’,’ControlName’,’Hide’

e.g. to hide txtProduct use:

SELECT ‘HideControl’,‘txtProduct’,’1’

To show txtProduct (after previously hiding it) use:

SELECT ‘HideControl’,’txtProduct’,’0’


Similarly we have also added the ability to disable controls as follows:

SELECT ‘DisableControl’,’ControlName’,’Disable’

If you wish to use these you will probably want to reset the controls to their default state upon entering a form. The best event to use for this is After Set Form Defaults.

There is also the ability to use proxy security to allow certain functions to proceed.
To use enter a select as follows:

SELECT ‘RequestSecurity’,’SecurityAreaToCheck’,’SecurityLevelRequired’

where SecurityAreaToCheck and SecurityLevelRequired are integers, SecurityArea being the the order of areas on the levels tabs of the SecurityProfiles program, e.g. SystemAdministrator is 1, Sales is 11 and Purchasing 12.

SecurityLevelRequried is 0=None, 1=View, 2=Add, 3=Modify, 4=Full, 5=Admin

so to restrict access to the Sales Area to Modify or above you would use:

SELECT ‘RequestSecurity’,4,3

If the user info that is entered is below that level then it will return false and stop the action. If the current user already has access to that level for that area then the request box will not be shown as it is not needed.

Wizards

There is now another placeholder called WizardActionKey. This can be used in Inventory Review to determine which action the wizard is for, as many actions use the same wizard.

There is now another placeholder called SelectedToolKey. This is used on wizards with a tree menu (generally tools wizards) which will determine the action selected.

‘After Wizard_SelectedToolNode’

‘Before Wizard_SelectedToolNode’

i.e CRM Companies tools wizard – Promote to new Customer, SelectedToolKey would be ‘CRMCompanies_Tools_PromoteCompanyNew’.
Before gets fired when next button is clicked, after gets fired after the finish button is clicked.

Bookmark Workflow

This functionality centers around the ‘SendBookmark’ action. The starting format is as follows:
SELECT ‘SendBookmark’, ‘MessageType’, ‘Identifier’, ‘Program’, ‘Description’
‘Identifier’ is the record number you wish to send.
‘Program’ is which program the ‘Identifier’ is related to.
‘Description’ is the message assigned to the bookmark.
There are additional variables which are determined by the ‘MessageType’. There are 3 variables that appear under multiple ‘MessageType’:
‘Recipients’ is a list of the users who are to receive the bookmark.
‘Priority’ is an integer relating to the urgency of the bookmark.
‘URL’ is as it says.
Here is a list of ‘MessageTypes’ and their additional variables:
‘Alert’
This is a message that is sent to the system admins. Additional variables:

,‘Priority’, ‘URL’

‘MailMessage’
This is message that is sent to a specific set of recipients. Additional variables:

, ‘Recipients’, ‘Priority’, ‘URL’

‘Reminder’
This is reminder that is sent to a specific set of recipients. Additional variables:

, ‘Recipients’, ‘Reminder’, ‘Priority’, ‘URL’

‘Reminder’ is the date and time that you wish the reminder to alert the user at.

‘Workflow’
This is the workflow style bookmark, which is sent to a specific set of recipients. Additional variables:

, ‘Recipients’, ‘Priority’, ‘URL’, ‘AcceptProcessID’, ‘RejectProcessID’

This new message type differs from the usual bookmarks because it has Accept & Reject buttons. These buttons activate a process event dictated by the additional variables AcceptProcessID & RejectProcessID.

In order to stop the accept & reject events from interfering with the usual system operations, set their event to After_Evn_Workflow.

There are example process controls on the ftp site in the Backed Up\Examples\Process Controls\Workflow folder.

Running Another Program

This functionality allows you to launch a program from within another, and even loading a specific record or launching an Action.
The here is an example followed by an explanation version:
SELECT ‘RunProgram’,’ManufacturingOrders’,’WCMO002140’,’WorkInProgress’,’Process’,0
SELECT ‘RunProgram’,’ProgramName’,’Identifier’,’TabToShow’,’ActionToRun’,RunInvisible

ProgramName

This is the name of the program you wish to run and it corresponds to the value found in the ‘Program’ column of the Programs table.

Identifier

This can either be the bigint of the record you wish to load or it can be the Text ID of the program you want to launch (In the example above it relates to the ManufacturingOrderID column). Set to NULL to not load a record.

This Variable is optional; however using it will need you to provide values for all the variables leading up to it.

TabToShow

This defines the tab which you wish to show once the program has loaded. You need to provide the tab’s key, which does not always relate to name you see on screen. Setting this to NULL will simply launch the main page. The example provided would set the program to the ‘Work in Progress’ tab after launching the Manufacturing Orders program.

This Variable is optional; however using it will need you to provide values for all the variables leading up to it.

ActionToRun

This determines which actions from the side bar will be launched when the Program is run. In example provided it will run the ‘Process’ action, which launches the Process Wizard. Set to NULL to not fire an action.
This Variable is optional; however using it will need you to provide values for all the variables leading up to it.

Invisibility

This allows you to determine whether or not to hide the form you are loading. This is most useful if you only want access the program to launch one of the actions mentioned in the previous variable.
This Variable is optional; however using it will need you to provide values for all the variables leading up to it.

Data Encryption & URL Encoding
By wrapping some text in the <$$ $$> tags will encrypt the data within the tags.
By wrapping some text in the <%% %%> tags will URL Encode the data enclosed.
Form Action
FormAction’ returns ‘Add’, ‘View’ or ‘Modify’ depending on the action chosen.

E.g. IF ‘FormAction’ = ‘Add’ BEGIN …

Loading Free Forms
You can now load free forms using the following syntax:
select ‘FreeForm’,’FreeFormId’, ‘Entity Type assigned to * this is an optional field’, ‘Entity Key assigned to* this is an optional field’
so for example:
select ‘FreeForm’,’User Details’, ‘Users’, ‘9999’
would load a free form with an Id of User Details from the FreeForms table. The table would be assigned to user 9999 with an entity type of ‘users’
select ‘FreeForm’,’User Details’
would load a free form with an Id of User Details from the FreeForms table. The table would be assigned to the current entity type where the process event is created.

Entering any of the following:
select ‘FreeForm’,’User Details’, ‘’, ‘9999’
or
select ‘FreeForm’,’User Details’, ‘Users’, ‘’
or
select ‘FreeForm’,’User Details’, ‘Users’
would ignore the last two field, would become (select ‘FreeForm’,’User Details’) and would be assigned to the current entity type where the process event is created.

When adding a free form process event a wizard allows you to choose from a list of available forms (these are shown by their description ‘FreeFormDescription’).

Accessing Form Data in Plugins

You can access form data within a plugin, for instance one called from a process event. The following example shows you how to change the product description on the entry dialog.
Dim frmActive As WinMan.WinUI.ProductsEntryUI = CType((From forms In Application.OpenForms Where forms.GetType Is GetType(WinMan.WinUI.ProductsEntryUI) Select forms).FirstOrDefault, WinMan.WinUI.ProductsEntryUI)
Dim c As Control = frmActive.ControlList(“txtProductDescription”).Control

c.Text = f.txtDescription.Text