Loading GST Billing Software
header image

Kushal Help : Apply Business Logic using Expressions

Erachana Line


Expression

Expression editor enables you to write your own code or logic and assigns it to the particular events of Controls or forms.

To open the Expression editor window, select a form and click on the Expression Button. Please note that each expression created is tightly associated with the selected form.




To Create the Expressions

To add a new expression click on the Add Button.



The Add button opens a window, where the user can choose to name the expression and decide whether the expression needs to return a Boolean value (True, False) as the return parameter. A new expression gets added to the Expression list.




To rename the Expression name Click on Edit button



To get a return value from the expression, check the checkbox Return True/False. By choosing this option, an expression has to return either true or false. A compilation error message will be generated if the given expression does not return any value when the user has explicitly checked in the checkbox.



Click Save.




Write the code on the right-side window, where you can use IntelliSense to aid in writing the program logic.

To check the compilation errors in the user-defined code, click on the Compile Expression Button. If any errors are found in the written code, the Compiler will list those errors. After solving the errors user gets this message.



To associate the expression on particular Control event, select the Set Control/Form Expression.

The Expression Association window is shown



All the Controls which are used in the particular form are displayed.

Select the Control from List of Controls list box.

When you select the Control from the list, all the Controls related events are listed in the Control Events Listbox.

Select the events to be associated with the expression, by using the arrow buttons -

>> Button will choose all events of the given Control and

<< Button will remove the events from the Selected Events list box.

You can reorder the event’s sequence.

Select an event from Selected Event list.

Click on Update Association Button.



Select the Expressions from Choose Expression list.

To select multiple expressions at a time, hold the Ctrl (Control) key, then select the Expressions.

In addition to this, the user can also change the order of execution of expressions.

Associate Expression to events list displays all associated expressions to the particular Control Event.

Click Close.



Then click Save.


References

This option is used to add external references to your project.

To add an external reference, Click on the Add Reference Button. Select a *.dll file from system path.



The selected References file displays all the methods and functions which are listed in the Reference window.

To add an external reference, Click on the Add Reference Button, Select *.dll file from system path and click Open.

Then you can use the DLL functions in Expressions that you build.

Report File

Click on Reports tab and Click Add Report to add reporting files to the Kushal project.





Selected files are automatically copied to project path\bin\Reports folder when output project is compiled.

Kushal contains a set of Classes with built-in functionality. Following are the few important classes with their functions.

Aggregate Functions

These Functions or Methods are used to calculate the sum, count, max, min values in the Data Grid.

  1. AggregateFunctionEvaluator.CalculateAvg

Eg: AggregateFunctionEvaluator.CalculateAvg (DataGrid Name, "Column_Name");
Description: Returns the average value of the column, resulting in positive or negative value.

  1. AggregateFunctionEvaluator.CalculateCount

Eg: AggregateFunctionEvaluator.CalculateCount (DataGrid Name, "Column_Name");
Description: Returns the Number of rows in the Data Grid, always resulting in a positive number.

  1. AggregateFunctionEvaluator.CalculateMax

Eg: AggregateFunctionEvaluator.CalculateMax (DataGrid Name, "Column_Name");
Description: Returns the Maximum value of the column. The result is a positive or negative value.

  1. AggregateFunctionEvaluator.CalculateMin

Eg: AggregateFunctionEvaluator.CalculateMin (DataGrid Name, "Column_Name");
Description: Returns the Minimum value of the column. The result is a positive or negative value.

  1. AggregateFunctionEvaluator.CalculateSum

Eg: AggregateFunctionEvaluator.CalculateSum (DataGrid Name, "Column_Name");
Description: Returns the total of the column, resulting in a positive or negative value.

  1. AggregateFunctionEvaluator.Equals

Eg: AggregateFunctionEvaluator.Equals (object A, object B);
Description: Returns a Boolean value. It checks both objects and if they are equal, returns True, otherwise returns False.

  1. AggregateFunctionEvaluator.FirstValue

Eg: AggregateFunctionEvaluator.CalculateFirstValue (DataGrid Name, "Column_Name");
Description: Returns the First Value of the Data Grid column, resulting in a String.

  1. AggregateFunctionEvaluator.LastValue

Eg: AggregateFunctionEvaluator.CalculateLastValue(DataGrid Name, "Column_Name");
Description: Returns the Last Value of the Data Grid column, resulting in a String.



ControlAdapter

These Functions or Methods are used to associate Controls to Grids and update the SQL Statement that fills the list of content displayed on the Controls. While most ControlAdapter functions contain an aspect of Control placed on a Form, not all functions are associated explicitly with Controls or SQL while serving to still update some aspect of the Form.

  1. ControlAdapter.AssociateSelectAllListbox

Eg: ControlAdapter.AssociateSelectAllListbox(CheckBox,CheckedListBox)
Description: It is used to associate all items selected in the Listbox Control

  1. ControlAdapter.CalculatedColumn

Eg: ControlAdapter.CalculatedColumn(Action<DataGridView>, DataGridView obj)
Description: It is used to calculate the column values in the Grid. It creates the delegate function to a particular Grid column and returns the result.

  1. ControlAdapter.ClearGridRows

Eg: ControlAdapter.ClearGridRows(DataGrid name)
Description: Clears all the rows in the given Data Grid.

  1. ControlAdapter.CloseContainerForm

Eg: ControlAdapter.CloseContainerForm(Control Name)
Description: Closes the form by associated Control.

  1. ControlAdapter.Filter

Eg: ControlAdapter.Filter(dataGrid name, “dataGrid column name”)
Description: Filters the result of given Control (Data Grid, list box, Combo Box) based on the condition given.

  1. ControlAdapter.GetColumnName

Eg: ControlAdapter.GetColumnName(dataGrid name, “dataGrid coloumn name”)
Description: Returns the name of the Data Grid column.

  1. ControlAdapter.LoadTreeView

Eg: ControlAdapter.LoadTreeView();
Description: Loads Treeview Control and updates associated Grid and Controls.

  1. ControlAdapter.MoveNodeDown

Eg: ControlAdapter.MoveNodeDown();
Description: Moves selected tree node down and updates associated Grid and Controls.

  1. ControlAdapter.MoveNodeLeft

Eg: ControlAdapter.MoveNodeLeft();
Description: Moves selected tree node left and updates associated Grid and Controls.

  1. ControlAdapter.MoveNodeRight

Eg: ControlAdapter.MoveNodeRight()
Description: Moves selected tree node right and updates associated Grid and Controls.

  1. ControlAdapter.MoveNodeUp

Eg: ControlAdapter.MoveNodeUp()
Description: Moves selected tree node upwards and updates associated Grid and Controls

  1. ControlAdapter.ProcessColumnValidation

Eg: ControlAdapter.ProcessColumnValidation();
Description: Handles Grid column events and performs Grid column validations given.

  1. ControlAdapter.ProcessDropdownColumns

Eg: ControlAdapter.ProcessDropdownColumns()
Description: Handles few events of dropdown Control and process their values based on the conditions provided.

  1. ControlAdapter.RearrageNode

Eg: ControlAdapter.RearrageNode()
Description: Rearranges tree nodes based on the direction provided and also updates associated Grid and Controls.

  1. ControlAdapter.ResetControl

Eg: ControlAdapter.ResetControls();
Description: Resets Controls and set their values to a default value if provided.

  1. ControlAdapter.SaveTreeView

Eg: ControlAdapter.SaveTreeView();
Description: Save Treeview Control and updates associated Grid and Controls.

  1. ControlAdapter.ShowDialog

Eg: ControlAdapter.ShowDialog(Form Name)
Description: Display the Form as a dialog box.

  1. ControlAdapter.ShowImage

Eg: ControlAdapter.ShowImage(“Imagepath”, picturebox_name)
Description: Display the Image in a particular image box.

  1. ControlAdapter.ShowTooltip

Eg: ControlAdapter.ShowTooltip("Message",Control name)
Description: Shows tooltip to the particular Control.

  1. ControlAdapter.ValidateDateTime

Eg: ControlAdapter.ValidateDateTime()
Description: Validates the given date from the input.



SqlInterpreter

This is used to directly execute SQL statement to affect Database Table entries with no ties to any Controls.

  1. SqlInterpreter.ExecuteSQL

Eg: SqlInterpreter.ExecuteSQL(“query”)
Description: Execute the SQL query which does not return any value. It is used in cases where we are not interested in the output of Insert or Update queries.

  1. SqlInterpreter.GetData

Eg: SqlInterpreter.GetData(“Query”)
Description: Get data in data table format for the given query.

  1. SqlInterpreter.GetScalarData

Eg: SqlInterpreter.GetScalarData("String");
Description: Returns set of values for the given query. Returns single set of values (null by default).



<< Previous
Home
Next >>