Activities
latest
false
Banner background image
Workflow Activities
Last updated Apr 22, 2024

Format Value

UiPath.Core.Activities.FormatValue

Associates a specific format to a generic value that can be used with .ToString and Parse operations. The available formats are Number, DateTime, Currency, and Percentage.

Properties

To
  • Value - The value to be formatted. This field supports only GenericValue variables.
Input
  • Format - Specifies the format to be applied to the value.
Common
  • DisplayName - The display name of the activity.
Misc
  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

Example of Using the Format Value Activity

The example below explains how to use the Format Value by processing assigned values and formatting them as desired.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.

    • Create the following variable:

      Variable Name

      Variable Type

      Default Value

      formattedValue

      GenericValue

       
  3. Drag an Assign activity inside the Sequence container.

    • Add the variable formattedValue in the To field.
    • Add the expression DateTime.Now in the Value field in order to receive the actual date.
  4. Drag a Format Value activity below the Assign activity.

    • Add the variable formattedValue in the Value field.
  5. Click the Set Format button from the Format Value activity to configure the data format.

    • Select the DateTime option from the Format Type drop-down list.
    • Select the desired display date style from the Pattern drop-down list.
    • Click the OK button for closing the configurator.
  6. Place a Log Message activity under the Format Value activity.

    • Select the Info option from the Level drop-down button.
    • Add the expression "Today is: "+formattedValue in the Message field. This displays the message Today is and the actual date, using the previously selected format.
  7. Drag an Assign activity below the Log Message activity

    • Add the variable formattedValue in the To field.
    • Add the value 19000.1234 in the Value field. This represents the actual value used for formatting.
  8. Drag a Format Value activity below the Assign activity.

    • Add the variable formattedValue in the Value field.
  9. Click the Set Format button from the Format Value activity to configure the data format. This formats the value added in the previous Assign activity and determines the used number of decimals.

    • Select the Number option from the Format Type drop-down list.
    • Add the value 2 in the Decimal Digits field.
    • Select the . option from the Decimal Separator drop-down list.
    • Add the value , in the Group Separator field.
    • Click the OK button for closing the configurator.
  10. Place a Log Message activity under the Format Value activity.

    • Select the Info option from the Level drop-down list.
    • Add the expression "This decimal number is: "+formattedValue in the Message field. This displays the message This decimal number is and the actual number.
  11. Drag an Assign activity below the Log Message activity.

    • Add the variable formattedValue in the To field.
    • Add the value 1.142 in the Value field. This value represents the today's parity between euro - dollar.
  12. Drag a Format Value activity below the Assign activity.

    • Add the variable formattedValue in the Value field.
  13. Click the Set Format button from the Format Value activity to configure the data format.

    • Select the Currency option from the Format Type drop-down list.
    • Add the value 3 in the Decimal Digits field.
    • Select the . option from the Decimal Separator drop-down list.
    • Select the $ option from the Symbol drop-down list.
    • Add the value , in the Group Separator field.
    • Click the OK button for closing the configurator.
  14. Place a Log Message activity under the Format Value activity.

    • Select the Info option from the Level drop-down button.
    • Add the expression "1 euro is: "+formattedValue in the Message field. This displays the message 1 euro is and the actual value of one euro converted in dollars.
  15. Drag an Assign activity below the Log Message activity.

    • Add the variable formattedValue in the To field.
    • Add the value 0.6666 in the Value field. This value is used to display the percentage after the data is formatted.
  16. Drag a Format Value activity below the Assign activity.

    • Add the variable formattedValue in the Value field.
  17. Click the Set Format button from the Format Value activity to configure the data format.

    • Select the Percentage option from the Format Type drop-down list.
    • Add the value 2 in the Decimal Digits field.
    • Select the . option from the Decimal Separator drop-down list.
    • Add the expression % in the Symbol field.
    • Add the expression , in the Group Separator field.
    • Click the OK button for closing the configurator.
  18. Place a Log Message activity under the Format Value activity.

    • Select the Info option from the Level drop-down list.
    • Add the expression "2/3 is: "+formattedValue in the Message field. This displays the message 2/3 is and its percentage equivalent.
    • This is how your workflow should look:



  19. Run the automation process. The provided data is processed and displayed, as per the specifications, in the Output panel.

  • Properties
  • Example of Using the Format Value Activity

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.