Skip to main content
Version: v6.1.0

Template structure

In short, the template consists of default Process diagram variables, Process diagram and configuration file( Config.xlsx (documents) organized.

Process chart variables

In this template, several Process diagram variables are preset and certain naming conventions are followed:

  • When adding the main process variables, the naming convention can be followed: G_ +Variable type (abbreviation + structure name)
  • When adding sub Process diagram variables, you can follow the naming convention: in_ /out_ +Variable name (initial capital)

Main flow chart variable

main flow var

g_ dicConfigData——Configuration data (Dictionary), that is, read the local configuration file Config.xlsx The data in the (self expandable and self defined configuration data) can be used as the global public configuration in the global Process diagram (the sub Process can only be used after input assignment); the variable is used and assigned in the "configuration initialization" Process block, and is also used in other Process blocks and Zi Liu processes Yes.

g_ dicTransactionItem——Transaction item (the default value is Null). The template runs in the same steps to cycle through transaction items. The transaction items have the same structure but different values. For example, cycle through multiple table files with the same structure, one of which is a transaction item. Use this variable in the "get new data" Process block and assign a value, and pass it to the "execution flow" Process "sub Process.

g_ iRetryNumber——The number of repeated retries is generally 3 by default. If an exception occurs while processing a transaction item, the processing step can be retried, but it cannot exceed the number of repeated retries. This variable is used and assigned in the "configuration initialization" and "retry count" Process blocks.

g_ iCount——Retry counter, the initial value is 0. If the transaction item fails to be processed and retried once, the count will be accumulated. If it is greater than or equal to g_ IRetryNumber is cleared to 0; the variable is used and assigned in the "configuration initialization" and "retry count" Process blocks.

g_ bRetryStatus——The retry status is False by default. The retry judgment component will check the retry status of the current transaction item. If it is True, the branch condition is established and points to the "Process execution" sub Process component, and the current transaction item will start to retry. If it is False, the branch condition is not established and points to the "get new data" Process block component to start the execution of the new transaction.

g_ bFirstRun——For the first run, it defaults to True; the variable is used and assigned in the "configuration initialization" and "get new data" Process blocks.

Sub Process diagram variables

subflow var

inTransactionItem——The transaction item used to receive the input of the main process and used within the subprocess.

inConfig——It is used to receive the public configuration of the main process input and is used within the sub process.

BusinessException——Sub Process global custom business exception, combined with Try/Catch block, can be distinguished from the use of "exception dotted line" and system variable ($BlockInput).

    Try
Log.Info("Started executing transaction process!")
//todo something



Catch Exception
BusinessException = Exception
Log.Error("Failed to execute [execution process]:"&CStr(Exception))
End Try

Flow chart

The template includes 2 layers of Process diagram, one layer of main Process diagram, Process diagram organized by "6 Process blocks", 3 "judgments", 1 "sub Process" and "end" components, one layer of sub Process diagram, and Process diagram organized by "1 Process block" components; Main flow chart

Main flow chart

main flow

The "main flow chart" above will be described later in this section.

  • Configuration initialization In the source view of the Process block, the overall steps are listed in the top note: initialize the Process diagram variables, set the global log level, and load Config.xlsx File configuration information, custom Extension.

Initialization Code Comments

This Process block is the first step of the main process execution. Common practices such as "declaration before" and "initialization" are all concentrated here. The key operation is to assign values to the global public configuration data of the main Process (that is, read the local or remote configuration data and assign values to the Process diagram variable G_ DicConfigData), and these public configuration data must be passed into the "execution Process" sub Process as the input value; when an exception occurs inside the Process block (not handled by Try/Catch), such as the local configuration file( Config.xlsx )If it is lost, the Process will go to the "exception handling" Process block, and finally enter the "Process end" Process block to stop the whole Process execution.

  • Object program initialization It is defined as the starting point of the dependent environment of the transaction Process to ensure that the target application software informed in the public configuration data is in the starting point (ready for execution) state. When an exception occurs in the "execution Process" sub Process (not processed by Try/Catch), it will return to this starting point under the retry mechanism to ensure that the transaction retry is feasible. Of course, if an exception occurs within the Process block (not processed by Try/Cat) Ch processing), the Process will go to the "exception processing" Process block.

  • First run Read flow chart variable G_ The value of bFirstRun is used to judge whether the overall cycle in the Process is the first run. If it is true, the Process points to the "get new data" Process block component to get new transaction items. If it is false, the Process points to the "retry" judgment component to make a logical judgment on the current transaction items.

  • Retry Read flow chart variable G_ The value of bRetryStatus is used to judge whether the current transaction item needs to be retried. If it is true, the Process points to the "execute Process" sub Process and continues to run; if it is false, the Process points to the "get new data" Process block and continues to run. This "judge" component is used to skip the failed transaction item and continue to run the new transaction item.

  • Get new data Obtain new data from the specified transaction source, i.e. event item; the transaction source can be the data queue specified in the commander, the specific row in the excel table, the specific field data in the database, the specific mail in the mailbox inbox, the webapi that can return data with the same structure or others; if a new transaction item can be obtained, it should be assigned to the flow Graph variable G_ DicTransactionItem, at the same time, the new transaction item will be passed into the "execution Process" sub Process as the input value; if the new transaction item cannot be obtained, that is, "g"_ DicTransactionItem = Null "status. After the Process is judged by the" data "component, it will point to the" Process end "Process block. Transaction item is essentially a "dictionary". If there is a process scenario, multiple accounts need to enter the same system to download report data every day, and the download steps are the same. Only the account passwords of each login are different. At this time, these account information can be gathered together (ensuring security) as the transaction source. If one of the transaction items is:

    {"UserName" : "Laiye RPA", "Pwd" : "!@#QaWSZ2021qeWRrer2Dq2w4oL"}

Then get the transaction item and give the Process variable G_ Assign value to dictransactionitem:

    g_dicTransactionItem = {"UserName" : "Laiye RPA", "Pwd" : "!@#QaWSZ2020"}

In this Process block, only 2 commands are prefabricated: “g_ Bfirstrun = false "and" g "_ dicTransactionItem = Null”

Special instructions are needed here. The above 2 commands cannot be deleted. Otherwise, the running logic of the "template" will be broken. At the same time, after the new transaction items are obtained, the Process diagram variable g will be given_ When dictransactionitem is assigned, the order must be under the above two commands.

  • Have data Read conditional expression "(not isnull (g)_ The value of "dicTransactionItem)" is used to judge whether a new transaction item has been obtained. If it is true, the Process points to the "execute Process" sub Process and continues to run; if it is false, the Process points to the "Process end" Process block, and finally ends the whole Process gracefully.

  • Implementation process In this template, the specific business operation steps are agreed to be carried out in this sub Process, such as user login, home page navigation, report query and download and other business automation logic, which is also the place where UiBot developers need to put the most effort into the template.

subflow input output

This subprocess defines 2 input value parameters: inTransactionItem and inConfig, which are respectively determined by the main Process variable G_ dicTransactionItem、g_ The dicconfigdata assignment is passed in. If an exception occurs in this sub Process (not processed by the Try/Catch block), the Process will continue to run from the "exception dotted line" to the "retry count" Process block, and the retry logic will be executed on the current transaction item (the default retry is 3 times, and if the 3 times are unsuccessful, the Process will jump to the new transaction item to continue to run).

  • Exception handling It is used to uniformly handle the exceptions in the 3 key Process blocks involved in the Process. If an exception occurs in the "configuration initialization", "target program initialization" and "get new data" Process block, the exception information can be obtained in the Process block through the system variable ($BlockInput), which also represents that the dependent environment (precondition) of the RPA does not meet the requirements or the environment itself is damaged, The Process cannot continue.

When an exception occurs in a Process block and a sub Process, if it is not handled by a Try/Catch block, the exception information can be obtained through the system variable ($BlockInput) in the Process block pointed to by the "exception dotted line"; when it is necessary to handle the exception by one or more commands in the flow process block, the Try/Catch block is recommended.

There is no preset exception information processing in this Process block, and the repair or solution of such problems requires manual intervention. If you want to notify the RPA maintenance and management personnel of the exception, the UiBot developers can use the commands in the "HTTP", "SMTP/POP", "Outlook" and other modules to achieve.

  • Retry count If the Process runs to the "execution Process" sub Process and its internal exception occurs (not handled by Try/Catch), the Process will point to this Process block to continue running, that is, for the Process diagram variable G_ Icount is incremented, that is, the counter of transaction item retry. If "g"_ iCount >= g_ Iretrynumber ", then the counter is cleared, i.e. G_ The Icount is reassigned to 0, G_ BRetryStatus is reevaluated as False to count again when the next transaction item is abnormal; in this Process block, the current screenshot and upload can be combined with the command of "upload screenshot" (enterprise version is required) to record the abnormal scene, which is convenient for analysis and investigation in Commander.

  • End of process The operation of this template will eventually be gathered into this Process block. Currently, 2 general information are preset to record the version information of UiBot and the running time of Process, and then point to the "end" component to complete the end of Process. UiBot developers can expand some statistical work at the end of Process or some other output in this Process block to meet the requirements of specific RPA scenarios.

Sub flow chart

subflow

The "sub Process diagram" above will be described later in this section.

  • Process block This Process block is a preset original "Process block". Only a simple example is used to obtain the incoming transaction items and the data in the public configuration. The specific business automation operation needs to be implemented by the RPA developers themselves through Extension.
    Dim configField1 = ""
Dim configField2 = ""
Dim itemField1 = ""
Dim itemField2 = ""
Try
Log.Info("Started executing transaction process!")
Rem Start the specific RPA business operation here

configField1 = inConfig["key1"]
configField2 = inConfig["key2"]

itemField1 = inTransactionItem["itemA"]
itemField2 = inTransactionItem["itemB"]
//todo something



Catch Exception
BusinessException = Exception
Log.Error("Failed to execute [execution process]:"&CStr(Exception))
End Try

Configuration file

After creating a Process in the way of "Enterprise process template", the configuration file can be found in the res/Data directory of the Process Config.xlsx ——It contains 3 worksheets (global settings, constant settings and local parameters), and has preset several configuration items, which can be added according to the project situation.

config.xlsx

The files in the res directory of the Process will be automatically packaged into the BOT file when the Process is published Config.xlsx If you want to control and maintain files independently locally, you can move them outside the res directory, such as C: \ data\ Config.xlsx At this time, modify the document reading operation corresponding to the "configuration initialization" Process block:

    Excel.OpenExcel("C:\\Data\\Config.xlsx",True,"Excel","","")

Although the configuration file relies on the common office software Excel/WPS, it is convenient for business personnel to adjust the setting value at the maintenance stage of the Process, and can reduce the input of maintenance personnel.

The three worksheets in the configuration file have agreed formats, which are composed of name, value and description. If the format needs to be adjusted, it should also be adjusted in the template. It is recommended to name them with English nouns.

  • Global settings The preset commanderqueuename and loglevel correspond to the data queue name and global log level in the commander; usually, the data queue is used as the transaction source, and the uibot developer can fill in the setting value according to the actual situation.
  • Constant setting Default MaxRetryNumber and ExScreenshotsFolderPath. For the maximum number of retries when processing transaction items in the template and the save path after screenshot of the current screen when the Process is abnormal, UiBot developers can fill in the setting value according to the actual situation. When processing transaction items, if necessary, log information related to internal analysis and audit of the business should be recorded, usually these log messages In this case, the prefix and the suggested prefix are set to the same part for easy maintenance.
  • Local parameters Preset appsname and ukeysetuppath, corresponding to the process name of the target program and the installation path of the target program. Uibot developers can fill in the setting values according to the actual situation.

Summary

After understanding the basic structure of the Enterprise process template, it will be found that it is mainly used in the automation scenario of transactional Process; the new transaction items are obtained by the "get new data" cycle, which are independent of each other and handle exceptions and manage logging in a transaction level manner, so as to provide more detailed information about each processed transaction item and make it easier to retry or finally Skip failed transactions.

If the template is run directly, it will be found that the operation will end soon. Because there is no preset transaction source in the "get new data" Process block, the status of the current transaction item is "g"_ DicTransactionItem = Null ", so the Process points to the" Process end "Process block and ends the entire Process.

The main flow (main flow chart) is mainly used to load the global configuration, provide the transaction items circularly, call the sub Process to process the transaction items circularly, and control the retry according to the configuration requirements after the execution of each transaction item fails; the role of the sub Process (sub Process chart) is to receive the data (public configuration, transaction items) and execute the specific Process steps, and has the independent operation ability.

In addition, the structure description of this template has been built into the RPA Creator application as a PDF file - Laiye RPA Enterprise process template - User Guide.Pdf.