- Release Notes
- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- The Diagnostic Tool
- Workflow Analyzer
- About Workflow Analyzer
- ST-NMG-001 - Variables Naming Convention
- ST-NMG-002 - Arguments Naming Convention
- ST-NMG-004 - Display Name Duplication
- ST-NMG-005 - Variable Overrides Variable
- ST-NMG-006 - Variable Overrides Argument
- ST-NMG-008 - Variable Length Exceeded
- ST-NMG-009 - Prefix Datatable Variables
- ST-NMG-011 - Prefix Datatable Arguments
- ST-NMG-012 - Argument Default Values
- ST-NMG-016 - Argument Length Exceeded
- ST-DBP-002 - High Arguments Count
- ST-DBP-003 - Empty Catch Block
- ST-DBP-007 - Multiple Flowchart Layers
- ST-DBP-020 - Undefined Output Properties
- ST-DBP-023 - Empty Workflow
- ST-DBP-024 - Persistence Activity Check
- ST-DBP-025 - Variables Serialization Prerequisite
- ST-DBP-026 - Delay Activity Usage
- ST-DBP-027 - Persistence Best Practice
- ST-DBP-028 - Arguments Serialization Prerequisite
- ST-USG-005 - Hardcoded Activity Arguments
- ST-USG-009 - Unused Variables
- ST-USG-010 - Unused Dependencies
- ST-USG-014 - Package Restrictions
- ST-USG-020 - Minimum Log Messages
- ST-USG-024 - Unused Saved for Later
- ST-USG-025 - Saved Value Misuse
- ST-USG-026 - Activity Restrictions
- ST-USG-027 - Required Packages
- ST-USG-028 - Restrict Invoke File Templates
- Variables
- Arguments
- Imported Namespaces
- Control Flow
- Object Repository
- Logging
- The ScreenScrapeJavaSupport Tool
- Studio testing
- Extensions
- Troubleshooting
To exemplify how you can work with a date and time variable, we are going to build an automation that gets the current date and time, subtracts a specific amount of time and writes the result to a Microsoft Excel spreadsheet.
-
Create a new sequence.
-
Create two DateTime variables,
TodayandLastTime. -
Create a TimeSpan variable, called
Span, and in the Default field type1.02:10:04.Note:The default value attributed to the
Spanvariable uses the day.hh:mm:ss format. -
Add an Assign activity to the Designer panel.
-
In the Properties panel, in the To field, add the
Todayvariable. -
In the Value field, type
Now. This gives you the date and time when the project is executed, in thedd/MM/yyyyandhh:mm:ssformats. -
Add another Assign activity under the previous one.
-
In the Properties panel, in the To field, add the
LastTimevariable. -
In the Value field, type
Today.Subtract(Span). This is going to subtract the default value of theSpanvariable from the current date, stored in theTodayvariable. -
Add an Excel Application Scope activity under the last Assign one.
Note:Use the Manage Packages feature to download the Excel activities, if you do not already have them installed.
-
In the Properties panel, in the WorkbookPath field, type the path of the Excel file you want to write to, between quotation marks. In our case,
"%HOMEPATH%\Desktop\urgent_invoice.xlsx".Note:If the file does not exist at the provided path, it is going to be created.
-
Add a Write Cell activity in the Excel Application Scope activity.
-
In the Properties panel, in the Range field, type the coordinates of an Excel cell between quotation marks. In our case,
"E3". -
In the Sheet Name field, type the name of the sheet in which you want to write. In our case,
"Invoice". Note that if the sheet does not exist, it is going to be created. -
In the Value field, type
LastTime.ToString. This transforms the value of theLastTimevariable to a string and writes it to the coordinates previously given.The final project should look as in the following screenshot:
-
Press F5. The automation is executed.
-
Navigate to your Excel file and double-click the cell in which you added the date. Note that the time and date information is displayed in the cell you pointed towards.