Customize

Calculate String Bytes

Summary

Calculate the number of bytes when a character string is represented by the specified character code.

How to use

To set the result of the calculation to another field, enter the target field into the parameter “Target Field (Optional)”.

Use formulas when using the result for other actions without setting it immediately.

For example, if the action of “Calculate String Bytes” is the first action, set the value in the parameter “Set Field Value” as follows:

=$1

By specifying it like this, you can extract it.

Parameters

Set String, Character Code, and Target Field (Optional).

String

Specify the string for which you want to calculate the byte size. You can specify both directly and by expression.

To specify the value of the field, use an expression as shown in the example below.

=Text_1_1

When specified in the formula, the entire string will be subject to calculation. For example, if it is the value in a rich editor, HTML tags will also be included in the calculation.

If the string contains control characters, such as newline codes, they are included in the byte count.

Character Code

Specify which character code to use when counting the number of bytes.

Target Field (Optional)

Use this parameter to set the results to another field. You can omit this parameter if you do not set the results directly in the field but use it in another action.

This parameter accepts the following field types:

  • Number

If you select a field inside a table, all rows of that table will be processed. For exceptions: See (*1)

*1: If you set a Condition that only applies to some table rows (such as the Condition “When Fields Value Changed”), the value will be set only for those affected by that Condition.

Compatibility with krewSheet

This action is designed to work seamlessly with krewSheet.

However, the following restrictions apply to the parameter “Target Field (Optional)”:

  • This parameter cannot be set to a field obtained by a Lookup field.
  • The following field types can be set when a record is saved (e.g. when you select the Condition “Before Record Saved Excluding Deleted"): If you want to gain more technical knowledge, refer to the krewSheet documentation .
    • Fields not included in the krewSheet view’s columns
    • Fields set to read-only in krewSheet

Restrictions

  • Character encodings other than Shift-JIS and UTF-8 are not supported.

  • When Shift-JIS is selected for “Character Code”, there is a possibility that the “String” contains characters that cannot be represented in Shift-JIS. For example, emojis cannot be represented in Shift-JIS. The specification does not guarantee the result of byte count calculation for characters that cannot be represented in Shift-JIS.