通知を受け取る

UiPath Studio

UiPath Studio ガイド

GenericValue 変数

GenericValue 変数は、テキスト、数値、日付、または配列といった種類のデータを格納することができる変数型であり、UiPath Studio 特有のものです。

GenericValue 変数は、特定のアクションを実行できるように自動的に他の型に変換されます。ただし、これらの変数の型はプロジェクトに対して常に正しく変換されるとは限らないため、使用には十分な注意が必要です。

UiPath Studio には GenericValue 変数の自動変換メカニズムがあり、式を正しく定義することで、目的の結果を得ることができます。式の最初の要素は、Studio から操作するガイドラインとして使用されることを考慮してください。たとえば、2 つの GenericValue 変数を追加し、式の最初の変数が String として定義されてた場合、最初に代入された値を元に 2 つの値を結合し、文字列となります。 Integer として定義した場合の結果は、合計の値となります。

.NET メソッドのサポート

Name/SyntaxDescription
CompareTo
Function GenericValue.CompareTo(other As GenericValue) As Integer

Function GenericValue.CompareTo(obj As Object) As Integer
Click here for details.
Contains
Function GenericValue.Contains(other As String) As Boolean
Click here for details.

Used to check whether a string variable contains a certain substring or not. For example, if you want to check if a sentence contains a specific word, the expression should be [SentenceVariable].Contains("term"), where [SentenceVariable] is the GenericValue variable containing the sentence and "term" is the word to be searched for.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Equals
Function GenericValue.Equals(other As GenericValue) As Boolean

Function GenericValue.Equals(obj As Object) As Boolean
Click here for details.
GetHashCode
Function GenericValue.GetHashCode() As Integer
Click here for details.
GetType
Function Object.GetType() As Type
Click here for details.
GetTypeCode
Function GenericValue.GetTypeCode() As TypeCode
Click here for details.
IndexOf
Function GenericValue.IndexOf(value As String) As Integer

Function GenericValue.IndexOf(value As String, comparisonType As StringComparison) As Integer

Function GenericValue.IndexOf(value As String, startIndex As Integer) As Integer

Function GenericValue.IndexOf(value As String, startIndex As Integer, comparisonType As StringComparison) As Integer
Click here for details.

Used to return the index of a substring contained inside a string variable. For example, if you want to find the index of the word "locate" inside the sentence "Find 'locate' in this sentence", the expression should be [SentenceVariable].IndexOf("locate"), where [SentenceVariable] is the GenericValue variable containing the sentence and "locate" is the term to be searched for.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Length
Function GenericValue.Lenght() As Integer
Click here for details.

Used to return the number of characters in a string variable. For example, if you want to find out how many letters a word has, the expression should be [WordVariable].Length, where [WordVariable] is the GenericValue variable containing the word.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Replace
Function GenericValue.Replace(oldValue As String, new value As String) As String
Click here for details.

Used to replace data contained inside a string variable. For example, if you want to change a local file path C:\ExampleFolder\Main.xaml into the corresponding server file path C:/ExampleFolder/Main.xaml, the expression should be [PathVariable].Replace("\","/") where [PathVariable] is the GenericValue variable containing the file path, "\" is the character to be replaced and "/" is the character used as replacement.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Split
Function GenericValue.Split(ParamArray separator As Char()) As String()

Function GenericValue.Split(ParamArray separator As String()) As String()

Function GenericValue.Split(separator As Char(), options As StringSplitOptions) As String()

Function GenericValue.Split(separator As String(), options As StringSplitOptions) As String()
Click here for details.

Used to return individual components from a string variable. For example, if you want to extract the year from a MM.DD.YYYY date format, the expression should be [DateVariable].Split(".".ToCharArray)(2), where [DateVariable] is the GenericValue variable containing the date, "." is the character used as a separator, .ToCharArray is a method that creates an array with the elements delimited by the separator and (2) represents the index of the element to be returned, in our case, the year.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Substring
Function GenericValue.Substring(startIndex As Integer) As String

Function GenericValue.Substring(startIndex As Integer, length As Integer) As String
Click here for details.

Used to return a substring contained in a string variable. For example, if you want to extract a word from the "There are 100 machines available" sentence, the expression should be [SentenceVariable].Substring(10,3), where [SentenceVariable] is the GenericValue variable containing the sentence, 10 is the index of the first character to be returned, and 3 is the length of the substring starting from the first character. In this example, the resulted substring would be "100".

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
ToBoolean
Function GenericValue.ToBoolean(provider As IFormatProvider) As Boolean
Click here for details.
ToByte
Function GenericValue.ToByte(provider As IFormatProvider) As Byte
Click here for details.
ToChar
Function GenericValue.ToChar(provider As IFormatProvider) As Char
Click here for details.
ToDecimal
Function GenericValue.ToDecimal(provider As IFormatProvider) As Decimal

Function GenericValue.ToDecimal(format As NumberStyles) As Decimal
Click here for details.
ToDouble
Function GenericValue.ToDouble(provider As IFormatProvider) As Double

Function GenericValue.ToDouble(format As NumberStyles) As Double
Click here for details.
ToInt
Function GenericValue.ToInt(culture As IFormatProvider) As Integer?

Function GenericValue.ToInt() As Integer?
Used to convert a specified value to a nullable integer.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToInt16
Function GenericValue.ToInt16(provider As IFormatProvider) As Short
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToInt32
Function GenericValue.ToInt32(provider As IFormatProvider) As Integer
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToInt64
Function GenericValue.ToInt64(provider As IFormatProvider) As Long
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToLower
Function GenericValue.ToLower() As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
ToLowerInvariant
Function GenericValue.ToLowerInvariant() As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
ToSByte
Function GenericValue.ToSByte(provider As IFormatProvider) As SByte
Click here for details.
ToSingle
Function GenericValue.ToSingle(provider As IFormatProvider) As Single
Click here for details.
ToString
Function GenericValue.ToString(formatProvider As IFormatProvider) As String

Function GenericValue.ToString(format As String, formatProvider As IFormatProvider) As String

Function GenericValue.ToString() As String
Click here for details.
ToType
Function GenericValue.ToType(conversionType As Type, provider As IFormatProvider) As Object
Click here for details.
ToUInt16
Function GenericValue.ToUInt16(provider As IFormatProvider) As UShort
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToUInt32
Function GenericValue.ToUInt32(provider As IFormatProvider) As UInteger
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToUInt64
Function GenericValue.ToUInt64(provider As IFormatProvider) As Ulong
Click here for details.

Note: When using this method with a GenericValue variable of data type Boolean, the "True" and "False" values are converted to 1 and 0, respectively.
ToUpper
Function GenericValue.ToUpper() As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
ToUpperInvariant
Function GenericValue.ToUpperInvariant() As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
Trim
Function GenericValue.Trim(ParamArray trimChars As Char()) As String

Function GenericValue.Trim() As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
TrimEnd
Function GenericValue.TrimEnd(ParamArray trimChars As Char()) As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.
TrimStart
Function GenericValue.TrimStart(ParamArray trimChars As Char()) As String
Click here for details.

Note: When using this method with a GenericValue variable of data type Int, Float or Boolean, the data is automatically converted to String and handled accordingly.

[値を書式化] アクティビティ本体で Ctrl + K、Ctrl + M、Ctrl + Shift + M のいずれかを直接使用すると、作成される変数または引数の型が GenericValue になります。その他のアクティビティでは、アクティビティに必要な型と同じになります。

GenericValue 変数の使用例

GenericValue 変数の動作を確認するためには、式の定義方法によって結果が変わるような操作をするオートメーションを作成する必要があります。異なるデータ型の 2 つの GenericValue 変数を作成し、結果を [出力] パネルに表示します。

  1. 新しいプロジェクトを作成します。
  2. 3 つの GenericValue 変数 IntStr、および Result を作成します。
  3. Int 変数の [既定値] 列に 12 を入力し、Str 変数に "34" と入力します。最初の変数は整数として処理され、2 番目の変数は文字列として処理されます。
940
  1. デザイナー パネルに [代入] アクティビティを追加し、Start ノードに接続します。
  2. [プロパティ] パネルの [左辺値 (To)] フィールドに、Result 変数を入力します。
  3. [右辺値 (Value)] フィールドに、「Int + Str」と入力します。
  4. [1 行を書き込み] アクティビティを追加して [代入] アクティビティに接続します。
  5. アクティビティ カードをダブルクリックし、[テキスト] フィールドに Result 変数を入力します。
    プロジェクトは次のスクリーンショットのようになります。
266
  1. F5 キーを押してオートメーションを実行します。[出力] パネルに 2 つの数字の合計が表示されます。
253
  1. 以前追加した [代入] アクティビティに戻り、[右辺値 (Value)] フィールドを Str + Int に変更し、変数の順序を逆にします。プロジェクトは次のスクリーンショットのようになります。
266
  1. F5 キーを押してオートメーションを実行します。[出力] パネルには、2 つの数字が結合され、文字列として表示します。
253

UiPath Studio は、式で定義された最初の要素を実行する操作のガイドラインとして使用します。式の最初の要素が整数、または整数として入力されたジェネリック値変数の場合、UiPath Studio は要素を合計します。
式の最初の要素が文字列、または文字列として入力されたジェネリック値変数の場合、UiPath Studio は要素を連結します。

サンプルをダウンロードする

5 か月前に更新


GenericValue 変数


改善の提案は、API リファレンスのページでは制限されています

改善を提案できるのは Markdown の本文コンテンツのみであり、API 仕様に行うことはできません。