saucepleez / taskt

taskt (pronounced 'tasked' and formely sharpRPA) is free and open-source robotic process automation (rpa) built in C# powered by the .NET Framework
http://www.taskt.net/
1.11k stars 354 forks source link

The "Data Commands - Format Data" command treats some date formats as arithmetic #191

Closed shugyosha89 closed 4 years ago

shugyosha89 commented 4 years ago

When using the Data Commands' Format Data command, placing an arithmetic operator between the date and time components results in arithmetic operations being performed.

Example input Variable: 2020/02/07 19:12:24 Data type: Date Output format: yyyy-MM-dd-HH-mm-ss

Expected output: 2020-02-07-19-12-24 Actual output: 1956

Using a non-arithmetic character such as "_" between "dd" and "HH" produces the expected output.

I couldn't find a method to produce the wanted output, though maybe there's a workaround.

In terms of a solution, maybe adding an escape character would work.

Thank you for your hard work.

saucepleez commented 4 years ago

Hello,

To resolve this, you can take a look at Engine Commands > Set Engine Preference and select Disable Automatic Calcuations. This command should run before you attempt to output the variable.

If you wish to change this default behavior entirely, you can view Engine Settings from the Settings screen and uncheck "Calculate Variables Automatically".

The feature to automatically perform math calculations was implemented early on to help make it easier for users to perform math and other operations, albeit with some edge-case issues. So in this case, since you did not specify a preference or disable automatic calculations, when the Message Box command is used, it validates that the string contains math operands and attempts to perform a math operation on the string so it is going to calculate 2020-2-7-19-12-24 which equals 1956.

Additionally, we have implemented a specific Math Calculation command so we have created the flexibility to either continue using automatic calculations and use a command to temporarily turn the behavior off, or turn the automatic calculation behavior off entirely and explicitly use the Math Calculation command when needing to perform math operations.

saucepleez commented 4 years ago

Closing as no other reply has been received.