{"id":6143,"date":"2025-10-31T11:58:48","date_gmt":"2025-10-31T08:58:48","guid":{"rendered":"https:\/\/help.bothelp.io\/?p=6143"},"modified":"2026-03-26T12:49:26","modified_gmt":"2026-03-26T09:49:26","slug":"shag-formula","status":"publish","type":"post","link":"https:\/\/help.bothelp.io\/en\/shag-formula\/","title":{"rendered":"Step formula"},"content":{"rendered":"<p><strong data-start=\"0\" data-end=\"22\" data-is-only-node=\"\">The \u201cFormula\u201d Step<\/strong> is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.<br data-start=\"148\" data-end=\"151\" \/>With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp.<\/p>\n<h2 data-start=\"0\" data-end=\"41\"><strong data-start=\"0\" data-end=\"41\">Where to Find It and How to Enable It<\/strong><\/h2>\n<ol>\n<li data-start=\"43\" data-end=\"94\">In the flow builder, select <strong data-start=\"71\" data-end=\"93\">Add Step \u2192 Formula<\/strong>.<\/li>\n<li data-start=\"43\" data-end=\"94\">A code editor will open inside the step.<\/li>\n<\/ol>\n<p data-start=\"138\" data-end=\"213\" data-is-last-node=\"\" data-is-only-node=\"\">For convenience, you can use <strong>the expanded editing mode<\/strong> (the \u201cexpand\u201d icon).<\/p>\n<h2 data-start=\"0\" data-end=\"32\"><strong data-start=\"0\" data-end=\"32\">How the \u201cFormula\u201d Step Works<\/strong><\/h2>\n<ol>\n<li data-start=\"34\" data-end=\"65\">The subscriber enters the step.<\/li>\n<li data-start=\"67\" data-end=\"147\">The code in the \u201cFormula\u201d editor is executed (from top to bottom, line by line).<\/li>\n<li data-start=\"149\" data-end=\"299\">If the execution is successful, the values are written to the selected variables, and the bot continues along the configured <strong data-start=\"274\" data-end=\"287\">Next Step<\/strong> transition.<\/li>\n<li data-start=\"301\" data-end=\"667\">If an error occurs during execution (for example, division by zero, an empty value, or incompatible types), the execution stops at the line where the error occurred.<br data-start=\"466\" data-end=\"469\" \/>The results from the lines that were successfully executed are saved, and the remaining code is not executed.<br data-start=\"578\" data-end=\"581\" \/>After that, the subscriber proceeds to the next step via the <strong data-start=\"642\" data-end=\"655\">Next Step<\/strong> transition.<\/li>\n<\/ol>\n<div class=\"text-base my-auto mx-auto pb-10 [--thread-content-margin:--spacing(4)] thread-sm:[--thread-content-margin:--spacing(6)] thread-lg:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)\">\n<div class=\"[--thread-content-max-width:40rem] thread-lg:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn\" tabindex=\"-1\">\n<div class=\"flex max-w-full flex-col grow\">\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-1\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"c0dcbd50-bb22-47a7-a557-219a9a9b8987\" data-message-model-slug=\"gpt-5-mini\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[1px]\">\n<div class=\"markdown prose dark:prose-invert w-full break-words dark markdown-new-styling\">\n<h2 data-start=\"0\" data-end=\"28\"><strong data-start=\"0\" data-end=\"26\">Working with Variables<\/strong><\/h2>\n<p data-start=\"30\" data-end=\"166\">Inside the step, you can use variables of different types. They allow you to store and transfer values between steps, users, and bots.<\/p>\n<p data-start=\"0\" data-end=\"38\">There are three types available:<\/p>\n<ol>\n<li data-start=\"40\" data-end=\"197\"><strong data-start=\"40\" data-end=\"56\">User Fields:<\/strong> available for reading and writing.<br data-start=\"91\" data-end=\"94\" \/>Used with the prefix <code data-start=\"115\" data-end=\"124\">client.<\/code> or via <code data-start=\"132\" data-end=\"151\">{%variable_name%}<\/code>.<br data-start=\"152\" data-end=\"155\" \/>Examples: <code data-start=\"165\" data-end=\"179\">client.price<\/code>, <code data-start=\"181\" data-end=\"195\">{%Position%}<\/code><\/li>\n<li data-start=\"199\" data-end=\"363\"><strong data-start=\"199\" data-end=\"220\">Global Variables:<\/strong> available for reading and writing.<br data-start=\"255\" data-end=\"258\" \/>Used with the prefix <code data-start=\"279\" data-end=\"289\">globals.<\/code> or via <code data-start=\"297\" data-end=\"316\">{@variable_name@}<\/code>.<br data-start=\"317\" data-end=\"320\" \/>Examples: <code data-start=\"330\" data-end=\"345\">globals.order<\/code>, <code data-start=\"347\" data-end=\"361\">{@discount@}<\/code><\/li>\n<li data-start=\"365\" data-end=\"548\"><strong data-start=\"365\" data-end=\"385\">Local Variables:<\/strong> used as helper variables and work only within a specific \u201cFormula\u201d step. Available for reading and writing.<br data-start=\"493\" data-end=\"496\" \/>Used without a prefix.<br data-start=\"518\" data-end=\"521\" \/>Example: <code data-start=\"530\" data-end=\"546\" data-is-only-node=\"\">age_years = 25<\/code><\/li>\n<li data-start=\"550\" data-end=\"726\"><strong data-start=\"550\" data-end=\"568\">System Fields:<\/strong> <code data-start=\"569\" data-end=\"577\">UserId<\/code>, <code data-start=\"579\" data-end=\"590\">BotHelpId<\/code>, <code data-start=\"592\" data-end=\"598\">CUID<\/code> are read-only. Writing to them will cause an error.<br data-start=\"650\" data-end=\"653\" data-is-only-node=\"\" \/>Accessible both with the <code data-start=\"678\" data-end=\"687\">client.<\/code> prefix (if applicable) and via macros.<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"0\" data-end=\"27\"><strong data-start=\"0\" data-end=\"25\">Variable Naming Rules<\/strong><\/p>\n<p data-start=\"29\" data-end=\"51\">1. General Rules<\/p>\n<ol>\n<li data-start=\"54\" data-end=\"136\">A variable name <strong>can only start with a letter<\/strong>, not a number.<br data-start=\"113\" data-end=\"116\" \/>\u2705 <code data-start=\"118\" data-end=\"124\">Sum1<\/code>\u2003\u2003\u274c <code data-start=\"128\" data-end=\"134\">1Sum<\/code><\/li>\n<\/ol>\n<ul>\n<li>Allowed characters: <strong>Latin letters, Cyrillic letters, numbers, and underscores.<\/strong><\/li>\n<li data-start=\"222\" data-end=\"243\">Names <strong>cannot<\/strong> match:<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul data-start=\"246\" data-end=\"432\">\n<li data-start=\"246\" data-end=\"309\">\n<p data-start=\"248\" data-end=\"309\"><strong>system field<\/strong> names (<code data-start=\"268\" data-end=\"277\">user_id<\/code>, <code data-start=\"279\" data-end=\"291\">bh_user_id<\/code>, <code data-start=\"293\" data-end=\"299\">cuid<\/code>, etc.);<\/p>\n<\/li>\n<li data-start=\"312\" data-end=\"352\">\n<p data-start=\"314\" data-end=\"352\"><strong>the prefixes<\/strong> <code data-start=\"327\" data-end=\"335\">client<\/code> and <code data-start=\"340\" data-end=\"349\">globals<\/code>;<\/p>\n<\/li>\n<li data-start=\"355\" data-end=\"432\">\n<p data-start=\"357\" data-end=\"432\">reserved programming language words, e.g., <code data-start=\"400\" data-end=\"407\">print<\/code>, <code data-start=\"409\" data-end=\"415\">true<\/code>, <code data-start=\"417\" data-end=\"424\">false<\/code>, etc.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p data-start=\"434\" data-end=\"532\">2. Spaces in Names<br data-start=\"456\" data-end=\"459\" \/>If you need spaces in a name, access the variable using <strong>index notation<\/strong>:<\/p>\n<p><code class=\"whitespace-pre!\"><span class=\"hljs-keyword\">globals<\/span>[<span class=\"hljs-string\">'client's age'<\/span>] = <span class=\"hljs-number\">27<\/span> <\/code><code class=\"whitespace-pre!\"><br \/>\nclient[<span class=\"hljs-string\">'ORDER ID'<\/span>] = <span class=\"hljs-string\">'A-42'<\/span><\/code><\/p>\n<p data-start=\"603\" data-end=\"628\">3. Code Limitations<\/p>\n<ul data-start=\"629\" data-end=\"788\">\n<li data-start=\"629\" data-end=\"718\">\n<p data-start=\"631\" data-end=\"718\">Total code size: <strong>up to 50 lines and 5000 characters<\/strong> (including line breaks and tabs).<\/p>\n<\/li>\n<li data-start=\"719\" data-end=\"788\">\n<p data-start=\"721\" data-end=\"788\">String literals (text in quotes <code data-start=\"753\" data-end=\"760\">\"...\"<\/code>) \u2014 <strong>up to 1000 characters.<\/strong><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"790\" data-end=\"814\">4. Recommendations<\/p>\n<ul data-start=\"815\" data-end=\"1013\" data-is-last-node=\"\" data-is-only-node=\"\">\n<li data-start=\"815\" data-end=\"856\">\n<p data-start=\"817\" data-end=\"856\">Use <strong>Latin<\/strong> letters for variable names.<\/p>\n<\/li>\n<li data-start=\"857\" data-end=\"928\">\n<p data-start=\"859\" data-end=\"928\">For multiple words, use <strong>underscores<\/strong>: <code data-start=\"896\" data-end=\"910\">blog_webinar<\/code>, <code data-start=\"912\" data-end=\"925\">order_total<\/code>.<\/p>\n<\/li>\n<li data-start=\"929\" data-end=\"1013\" data-is-last-node=\"\">\n<p data-start=\"931\" data-end=\"1013\" data-is-last-node=\"\">Give variables <strong>meaningful and unique names<\/strong> \u2014 it simplifies debugging and teamwork.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"0\" data-end=\"17\"><strong data-start=\"0\" data-end=\"15\">Data Types:<\/strong><\/p>\n<ul data-start=\"19\" data-end=\"215\">\n<li data-start=\"19\" data-end=\"68\">\n<p data-start=\"21\" data-end=\"68\"><strong data-start=\"21\" data-end=\"31\">Number<\/strong> (integer and decimal): <code data-start=\"55\" data-end=\"59\">10<\/code>, <code data-start=\"61\" data-end=\"66\" data-is-only-node=\"\">2.5<\/code><\/p>\n<\/li>\n<li data-start=\"69\" data-end=\"93\">\n<p data-start=\"71\" data-end=\"93\"><strong data-start=\"71\" data-end=\"82\">String:<\/strong> <code data-start=\"83\" data-end=\"91\">\"text\"<\/code><\/p>\n<\/li>\n<li data-start=\"94\" data-end=\"126\">\n<p data-start=\"96\" data-end=\"126\"><strong data-start=\"96\" data-end=\"108\">Boolean:<\/strong> <code data-start=\"109\" data-end=\"115\">True<\/code>, <code data-start=\"117\" data-end=\"124\" data-is-only-node=\"\">False<\/code><\/p>\n<\/li>\n<li data-start=\"127\" data-end=\"187\">\n<p data-start=\"129\" data-end=\"187\"><strong data-start=\"129\" data-end=\"143\">Date\/Time:<\/strong> <code data-start=\"144\" data-end=\"158\">\"2025-10-10\"<\/code> or <code data-start=\"162\" data-end=\"185\" data-is-only-node=\"\">\"10.10.2025 12:00:00\"<\/code><\/p>\n<\/li>\n<li data-start=\"188\" data-end=\"215\">\n<p data-start=\"190\" data-end=\"215\"><strong data-start=\"190\" data-end=\"206\">Empty Value:<\/strong> <code data-start=\"207\" data-end=\"213\">null<\/code><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"217\" data-end=\"333\" data-is-last-node=\"\" data-is-only-node=\"\"><strong data-start=\"217\" data-end=\"226\">Note:<\/strong> Lists (<code data-start=\"234\" data-end=\"243\">[1,2,3]<\/code>), dictionaries (<code data-start=\"260\" data-end=\"269\" data-is-only-node=\"\">{\"a\":1}<\/code>), and objects (<code data-start=\"285\" data-end=\"291\">None<\/code>) are not supported in the \u201cFormula\u201d step.<\/p>\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]\" dir=\"auto\" tabindex=\"-1\" data-turn-id=\"request-WEB:120e35c5-22b5-44d8-94c7-91a85f4c58fc-9\" data-testid=\"conversation-turn-20\" data-scroll-anchor=\"true\" data-turn=\"assistant\">\n<div class=\"text-base my-auto mx-auto pb-10 [--thread-content-margin:--spacing(4)] thread-sm:[--thread-content-margin:--spacing(6)] thread-lg:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)\">\n<div class=\"[--thread-content-max-width:40rem] thread-lg:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn\" tabindex=\"-1\">\n<div class=\"flex max-w-full flex-col grow\">\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-1\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"7b56f27d-5dce-4ead-98d1-af15136b5309\" data-message-model-slug=\"gpt-5-mini\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[1px]\">\n<div class=\"markdown prose dark:prose-invert w-full break-words dark markdown-new-styling\">\n<p data-start=\"0\" data-end=\"18\"><strong data-start=\"0\" data-end=\"16\">Conversions:<\/strong><\/p>\n<ul data-start=\"20\" data-end=\"142\" data-is-last-node=\"\" data-is-only-node=\"\">\n<li data-start=\"20\" data-end=\"46\">\n<p data-start=\"22\" data-end=\"46\"><code data-start=\"22\" data-end=\"35\">str(number)<\/code> \u2192 string<\/p>\n<\/li>\n<li data-start=\"47\" data-end=\"88\">\n<p data-start=\"49\" data-end=\"88\"><code data-start=\"49\" data-end=\"60\">int(\"42\")<\/code>, <code data-start=\"62\" data-end=\"77\" data-is-only-node=\"\">float(\"12.5\")<\/code> \u2192 number<\/p>\n<\/li>\n<li data-start=\"89\" data-end=\"142\" data-is-last-node=\"\">\n<p data-start=\"91\" data-end=\"142\" data-is-last-node=\"\">Comparing different types converts them to strings.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"z-0 flex min-h-[46px] justify-start\">\n<h2 data-start=\"0\" data-end=\"16\"><strong data-start=\"0\" data-end=\"14\">Commenting<\/strong><\/h2>\n<p data-start=\"18\" data-end=\"182\">To make the code easier to read and maintain, you can add <strong>comments<\/strong>.<br data-start=\"85\" data-end=\"88\" \/>Comments do not affect the execution of formulas and are intended only to explain the logic.<\/p>\n<p data-start=\"184\" data-end=\"203\"><strong data-start=\"184\" data-end=\"201\">Comment Types:<\/strong><\/p>\n<p>Single-line Comment<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<pre class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\"># This is a single-line comment\r\na = 10 # Can also be written after an expression<\/pre>\n<\/div>\n<\/div>\n<p>Multi-line Comment<\/p>\n<\/div>\n<\/div>\n<div class=\"mt-3 w-full empty:hidden\">\n<pre class=\"text-center\">\"\"\"\r\nMulti-line comment\r\nFor example, to describe calculation logic\r\n\"\"\"<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n<div class=\"pointer-events-none h-px w-px\" aria-hidden=\"true\" data-edge=\"true\">\n<h2 data-start=\"0\" data-end=\"28\"><strong data-start=\"0\" data-end=\"26\">Hints and Autocomplete<\/strong><\/h2>\n<p data-start=\"30\" data-end=\"165\">A <strong>hints<\/strong> and <strong>autocomplete<\/strong> system is available \u2014 it helps you write expressions faster and avoid errors in variable and function names.<\/p>\n<p data-start=\"167\" data-end=\"330\" data-is-last-node=\"\" data-is-only-node=\"\"><strong>For example<\/strong>, start typing a function name, and a list of matching options will appear.<br data-start=\"253\" data-end=\"256\" \/>When you type <code data-start=\"270\" data-end=\"275\" data-is-only-node=\"\">add<\/code>, you will see options like <code data-start=\"303\" data-end=\"312\">addDays<\/code>, <code data-start=\"314\" data-end=\"324\">addMonth<\/code>, etc.<\/p>\n<\/div>\n<h2 data-start=\"0\" data-end=\"47\"><strong data-start=\"0\" data-end=\"45\">Available Functions in the \u201cFormula\u201d Step<\/strong><\/h2>\n<p data-start=\"49\" data-end=\"308\" data-is-last-node=\"\" data-is-only-node=\"\">The \u201cFormula\u201d step supports a set of built-in functions for working with numbers, strings, dates, and logical conditions.<br data-start=\"170\" data-end=\"173\" \/>They allow you to perform calculations, conversions, and validations directly within the scenario, without relying on external systems.<\/p>\n<p>For clarity, copy the template using the <a href=\"https:\/\/main.bothelp.io\/f\/465c9948d65\" target=\"_blank\" rel=\"noopener\">link<\/a> \u2014 click <strong>Copy in BotHelp<\/strong>, enter the domain of your account, and click <strong>Save bot<\/strong>. Within a few minutes, the template will be copied to your account. After that, you can edit the blocks to your needs.<\/p>\n<p data-start=\"0\" data-end=\"28\"><strong data-start=\"0\" data-end=\"26\">Mathematical Functions<\/strong><\/p>\n<p>&nbsp;<\/p>\n<div class=\"_tableContainer_1rjym_1\">\n<div class=\"group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" style=\"height: 317px;\" width=\"594\" data-start=\"30\" data-end=\"498\">\n<thead data-start=\"30\" data-end=\"66\">\n<tr data-start=\"30\" data-end=\"66\">\n<th data-start=\"30\" data-end=\"41\" data-col-size=\"sm\">Function<\/th>\n<th data-start=\"41\" data-end=\"55\" data-col-size=\"md\">Description<\/th>\n<th data-start=\"55\" data-end=\"66\" data-col-size=\"sm\">Example<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"104\" data-end=\"498\">\n<tr data-start=\"104\" data-end=\"197\">\n<td data-start=\"104\" data-end=\"117\" data-col-size=\"sm\"><code data-start=\"106\" data-end=\"116\">round(x)<\/code><\/td>\n<td data-start=\"117\" data-end=\"175\" data-col-size=\"md\">Rounds a number to the nearest integer (0.5 rounds up).<\/td>\n<td data-start=\"175\" data-end=\"197\" data-col-size=\"sm\"><code data-start=\"177\" data-end=\"189\">round(2.5)<\/code> \u2192 <code data-start=\"192\" data-end=\"195\">3<\/code><\/td>\n<\/tr>\n<tr data-start=\"198\" data-end=\"270\">\n<td data-start=\"198\" data-end=\"209\" data-col-size=\"sm\"><code data-start=\"200\" data-end=\"208\">abs(x)<\/code><\/td>\n<td data-start=\"209\" data-end=\"251\" data-col-size=\"md\">Returns the absolute value of a number.<\/td>\n<td data-start=\"251\" data-end=\"270\" data-col-size=\"sm\"><code data-start=\"253\" data-end=\"262\">abs(-5)<\/code> \u2192 <code data-start=\"265\" data-end=\"268\">5<\/code><\/td>\n<\/tr>\n<tr data-start=\"271\" data-end=\"338\">\n<td data-start=\"271\" data-end=\"282\" data-col-size=\"sm\"><code data-start=\"273\" data-end=\"281\">int(x)<\/code><\/td>\n<td data-start=\"282\" data-end=\"316\" data-col-size=\"md\">Converts a value to an integer.<\/td>\n<td data-start=\"316\" data-end=\"338\" data-col-size=\"sm\"><code data-start=\"318\" data-end=\"329\">int(\"42\")<\/code> \u2192 <code data-start=\"332\" data-end=\"336\">42<\/code><\/td>\n<\/tr>\n<tr data-start=\"339\" data-end=\"430\">\n<td data-start=\"339\" data-end=\"352\" data-col-size=\"sm\"><code data-start=\"341\" data-end=\"351\">float(x)<\/code><\/td>\n<td data-start=\"352\" data-end=\"400\" data-col-size=\"md\">Converts a string to a floating-point number.<\/td>\n<td data-start=\"400\" data-end=\"430\" data-col-size=\"sm\"><code data-start=\"402\" data-end=\"418\">float(\"12.34\")<\/code> \u2192 <code data-start=\"421\" data-end=\"428\">12.34<\/code><\/td>\n<\/tr>\n<tr data-start=\"431\" data-end=\"498\">\n<td data-start=\"431\" data-end=\"442\" data-col-size=\"sm\"><code data-start=\"433\" data-end=\"441\">str(x)<\/code><\/td>\n<td data-start=\"442\" data-end=\"474\" data-col-size=\"md\">Converts a value to a string.<\/td>\n<td data-start=\"474\" data-end=\"498\" data-col-size=\"sm\"><code data-start=\"476\" data-end=\"486\">str(100)<\/code> \u2192 <code data-start=\"489\" data-end=\"496\">\"100\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p data-start=\"500\" data-end=\"553\">Arithmetic operations supported: <code data-start=\"533\" data-end=\"536\">+<\/code>, <code data-start=\"538\" data-end=\"541\">-<\/code>, <code data-start=\"543\" data-end=\"546\">*<\/code>, <code data-start=\"548\" data-end=\"551\">\/<\/code><\/p>\n<p data-start=\"72\" data-end=\"151\">Let\u2019s look at an example of calculations. The variables must be set in advance.<\/p>\n<p data-start=\"153\" data-end=\"433\" data-is-last-node=\"\" data-is-only-node=\"\">&#8220;&#8221;&#8221;&#8221;Let&#8217;s calculate the value of the variables&#8221;&#8221;&#8221;<br \/>\nclient.A = 2 &#8211; 4 # Data type &#8220;Number, negative&#8221;<br \/>\nclient.B = 1.275 + 5 # Data type &#8220;Number, fractional&#8221;<br \/>\nclient.C = 5 * 10 \/ 2 # Data type &#8220;Number&#8221;, integer&#8221;<br \/>\nclient.D = &#8220;10&#8221; # Data type &#8220;String&#8221;<br \/>\nclient.E = &#8220;10.5&#8221; # Data type &#8220;String&#8221;<\/p>\n<p data-start=\"72\" data-end=\"233\">&#8220;&#8221;&#8221;&#8221;Working with local variables&#8221;&#8221;&#8221;<br \/>\nlocal1 = 2 # Assigned a local variable<br data-start=\"146\" data-end=\"149\" \/>local2 = 3<br data-start=\"159\" data-end=\"162\" \/>client.F = local1 + local2 # Added local variables into a user variable<\/p>\n<p data-start=\"235\" data-end=\"558\" data-is-last-node=\"\" data-is-only-node=\"\">&#8220;&#8221;&#8221;&#8221;Apply mathematical functions&#8221;&#8221;&#8221;<br \/>\nclient.discount = round(client.B) # Rounding to an integer<br data-start=\"329\" data-end=\"332\" \/>client.sum_orders = int(client.D) # Converted a string to a number<br data-start=\"398\" data-end=\"401\" \/>client.life_number = float(client.E) # Converted a string to a number with a decimal point<br data-start=\"491\" data-end=\"494\" \/>client.forecast = str(client.C) # Converted a number to a string<\/p>\n<p><a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6532\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48-1024x530.png\" alt=\"\" width=\"1024\" height=\"530\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48-1024x530.png 1024w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48-300x155.png 300w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48-768x398.png 768w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.47.48.png 1472w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a>&nbsp;<\/p>\n<p data-start=\"72\" data-end=\"176\"><strong>\u2014 Let&#8217;s calculate the value of the variables<\/strong><br data-start=\"116\" data-end=\"119\" \/>A = {%A%}<br data-start=\"128\" data-end=\"131\" \/>B = {%B%}<br data-start=\"140\" data-end=\"143\" \/>C = {%C%}<br data-start=\"152\" data-end=\"155\" \/>D = {%D%}<br data-start=\"164\" data-end=\"167\" \/>E = {%E%}<\/p>\n<p data-start=\"178\" data-end=\"220\"><strong>\u2014 Working with local variables<\/strong><br data-start=\"208\" data-end=\"211\" \/>F = {%F%}<\/p>\n<p data-start=\"222\" data-end=\"366\" data-is-last-node=\"\" data-is-only-node=\"\"><strong>\u2014 Apply mathematical functions<\/strong><br data-start=\"252\" data-end=\"255\" \/>discount = {%discount%}<br data-start=\"278\" data-end=\"281\" \/>sum_orders = {%sum_orders%}<br data-start=\"308\" data-end=\"311\" \/>life_number = {%life_number%}<br data-start=\"340\" data-end=\"343\" \/>forecast = {%forecast%}<br \/>\n<strong data-start=\"560\" data-end=\"597\"><br \/>\n<a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.49.08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6531\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.49.08.png\" alt=\"\" width=\"299\" height=\"325\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.49.08.png 750w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-15.49.08-276x300.png 276w\" sizes=\"auto, (max-width: 299px) 100vw, 299px\" \/><\/a><\/strong><\/p>\n<h4><strong>Logical and Conditional Functions<\/strong><\/h4>\n<p>&nbsp;<\/p>\n<div class=\"_tableContainer_1rjym_1\">\n<div class=\"group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" style=\"height: 534px;\" width=\"594\" data-start=\"601\" data-end=\"1169\">\n<thead data-start=\"601\" data-end=\"637\">\n<tr data-start=\"601\" data-end=\"637\">\n<th data-start=\"601\" data-end=\"612\" data-col-size=\"sm\">Function<\/th>\n<th data-start=\"612\" data-end=\"626\" data-col-size=\"md\">Description<\/th>\n<th data-start=\"626\" data-end=\"637\" data-col-size=\"md\">Example<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"675\" data-end=\"1169\">\n<tr data-start=\"675\" data-end=\"837\">\n<td data-start=\"675\" data-end=\"717\" data-col-size=\"sm\"><code data-start=\"677\" data-end=\"716\">if(condition, then_value, else_value)<\/code><\/td>\n<td data-start=\"717\" data-end=\"793\" data-col-size=\"md\">Checks a condition. Returns <code data-start=\"747\" data-end=\"759\">then_value<\/code> if true, otherwise <code data-start=\"779\" data-end=\"791\">else_value<\/code>.<\/td>\n<td data-start=\"793\" data-end=\"837\" data-col-size=\"md\"><code data-start=\"795\" data-end=\"835\">if(client.age &gt;= 18, \"Adult\", \"Minor\")<\/code><\/td>\n<\/tr>\n<tr data-start=\"838\" data-end=\"982\">\n<td data-start=\"838\" data-end=\"868\" data-col-size=\"sm\"><code data-start=\"840\" data-end=\"867\">if(condition, then_value)<\/code><\/td>\n<td data-start=\"868\" data-end=\"929\" data-col-size=\"md\">If <code data-start=\"873\" data-end=\"885\">else_value<\/code> is not specified, returns an empty string.<\/td>\n<td data-start=\"929\" data-end=\"982\" data-col-size=\"md\"><code data-start=\"931\" data-end=\"980\">if(is_null(client.phone), \"Phone not provided\")<\/code><\/td>\n<\/tr>\n<tr data-start=\"983\" data-end=\"1069\">\n<td data-start=\"983\" data-end=\"1000\" data-col-size=\"sm\"><code data-start=\"985\" data-end=\"999\">is_null(var)<\/code><\/td>\n<td data-start=\"1000\" data-end=\"1033\" data-col-size=\"md\">Checks if a variable is empty.<\/td>\n<td data-start=\"1033\" data-end=\"1069\" data-col-size=\"md\"><code data-start=\"1035\" data-end=\"1058\">is_null(client.email)<\/code> \u2192 <code data-start=\"1061\" data-end=\"1067\">True<\/code><\/td>\n<\/tr>\n<tr data-start=\"1070\" data-end=\"1169\">\n<td data-start=\"1070\" data-end=\"1091\" data-col-size=\"sm\"><code data-start=\"1072\" data-end=\"1077\">and<\/code>, <code data-start=\"1079\" data-end=\"1083\">or<\/code>, <code data-start=\"1085\" data-end=\"1090\">not<\/code><\/td>\n<td data-start=\"1091\" data-end=\"1137\" data-col-size=\"md\">Logical operators for combining conditions.<\/td>\n<td data-start=\"1137\" data-end=\"1169\" data-col-size=\"md\"><code data-start=\"1139\" data-end=\"1167\">if(a &gt; 0 and b &lt; 10, \"ok\")<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p data-start=\"1171\" data-end=\"1214\">Boolean values supported: <code data-start=\"1197\" data-end=\"1203\">True<\/code>, <code data-start=\"1205\" data-end=\"1212\">False<\/code><\/p>\n<p>In this example, we will calculate the final discount based on two parameters:<br \/>\n\u2014 the presence of past purchases,<br \/>\n\u2014 the number of completed lessons.<\/p>\n<p><strong>Important<\/strong>: before starting, make sure that all the necessary variables have been created in advance.<\/p>\n<p>1. <strong>In line 2<\/strong>, we use the logical IF condition:<\/p>\n<ul>\n<li data-start=\"98\" data-end=\"216\">if the value of the variable (for example, the number of past purchases) is greater <strong>than 3<\/strong>, we set <strong>base_discount = 20<\/strong>;<\/li>\n<li data-start=\"218\" data-end=\"255\">in all other cases (less than 3) \u2014 <strong>0<\/strong>.<\/li>\n<\/ul>\n<p data-start=\"64\" data-end=\"176\">2. <strong>In line 5<\/strong>, we create a condition for the number of completed lessons. But in this case, the condition is double:<\/p>\n<ul>\n<li data-start=\"178\" data-end=\"262\">if the value is <strong>greater than or equal to 10<\/strong> \u2014 the variable <strong>engagement_discount = 20<\/strong>;<\/li>\n<li data-start=\"264\" data-end=\"339\">if the value is greater <strong>than 5<\/strong>, then the variable <strong>engagement_discount = 10;<\/strong><\/li>\n<li data-start=\"341\" data-end=\"376\">otherwise (in all other cases) \u2014 <strong>0<\/strong>.<\/li>\n<\/ul>\n<p data-start=\"1221\" data-end=\"1243\">3. Note: <strong>base_discount<\/strong> and <strong>engagement_discount<\/strong> are variables <strong>without<\/strong> prefixes.<br data-start=\"146\" data-end=\"149\" \/>They work only within the current <strong>\u201cFormula\u201d<\/strong> step and are used for intermediate calculations.<br data-start=\"241\" data-end=\"244\" data-is-only-node=\"\" \/>These are exactly the variables we will need later.<\/p>\n<p data-start=\"64\" data-end=\"151\">4. <strong>In line 8<\/strong>, we sum the local variables:<br data-start=\"102\" data-end=\"105\" \/>discount = base_discount + engagement_discount<\/p>\n<p data-start=\"153\" data-end=\"292\" data-is-last-node=\"\" data-is-only-node=\"\">The resulting value is assigned to the user variable <strong>discount<\/strong>, which can be shown to the subscriber in the following steps of the scenario.<\/p>\n<pre data-start=\"66\" data-end=\"112\"># 1. Loyalty: 20% discount, if purchases &gt; 3\r\nbase_discount = if(client.sum_orders &gt; 3, 20, 0)\r\n\r\n# 2. Engagement: 20% for &gt;=10 lessons, 10% for &gt;=5\r\nengagement_discount = if(client.completed_lessons &gt;= 10, 20, if(client.completed_lessons &gt;= 5, 10, 0))\r\n\r\n# 3. Final discount\r\nclient.discount = base_discount + engagement_discount<\/pre>\n<p data-start=\"1221\" data-end=\"1243\"><a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6533\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56-1024x258.png\" alt=\"\" width=\"1024\" height=\"258\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56-1024x258.png 1024w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56-300x76.png 300w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56-768x194.png 768w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.18.56.png 1110w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<pre data-start=\"75\" data-end=\"88\"><strong>Calculation<\/strong>\r\n\r\nOrders: {%sum_orders%}<br data-start=\"112\" data-end=\"115\" \/>Lessons completed: {%completed_lessons%}\r\n<br data-start=\"155\" data-end=\"158\" \/><strong>Your discount is<\/strong> {%discount%} %<\/pre>\n<h4><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6534\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.26.44.png\" alt=\"\" width=\"347\" height=\"295\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.26.44.png 728w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.26.44-300x255.png 300w\" sizes=\"auto, (max-width: 347px) 100vw, 347px\" \/><\/h4>\n<h4>String Functions<\/h4>\n<div class=\"_tableContainer_1rjym_1\">\n<div class=\"group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" style=\"height: 722px;\" width=\"597\" data-start=\"1245\" data-end=\"2002\">\n<thead data-start=\"1245\" data-end=\"1281\">\n<tr data-start=\"1245\" data-end=\"1281\">\n<th data-start=\"1245\" data-end=\"1256\" data-col-size=\"sm\">Function<\/th>\n<th data-start=\"1256\" data-end=\"1270\" data-col-size=\"md\">Description<\/th>\n<th data-start=\"1270\" data-end=\"1281\" data-col-size=\"sm\">Example<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1319\" data-end=\"2002\">\n<tr data-start=\"1319\" data-end=\"1405\">\n<td data-start=\"1319\" data-end=\"1333\" data-col-size=\"sm\"><code data-start=\"1321\" data-end=\"1332\">len(text)<\/code><\/td>\n<td data-start=\"1333\" data-end=\"1381\" data-col-size=\"md\">Returns the number of characters in a string.<\/td>\n<td data-start=\"1381\" data-end=\"1405\" data-col-size=\"sm\"><code data-start=\"1383\" data-end=\"1397\">len(\"Hello\")<\/code> \u2192 <code data-start=\"1400\" data-end=\"1403\">5<\/code><\/td>\n<\/tr>\n<tr data-start=\"1406\" data-end=\"1569\">\n<td data-start=\"1406\" data-end=\"1433\" data-col-size=\"sm\"><code data-start=\"1408\" data-end=\"1432\">substring(str, n1, n2)<\/code><\/td>\n<td data-start=\"1433\" data-end=\"1525\" data-col-size=\"md\">Trims a string: <code data-start=\"1451\" data-end=\"1455\">n1<\/code> = chars to keep from the start, <code data-start=\"1488\" data-end=\"1492\">n2<\/code> = chars to remove from the end.<\/td>\n<td data-start=\"1525\" data-end=\"1569\" data-col-size=\"sm\"><code data-start=\"1527\" data-end=\"1556\">substring(\"BotHelp\", 3, -2)<\/code> \u2192 <code data-start=\"1559\" data-end=\"1567\">\"tHel\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"1570\" data-end=\"1648\">\n<td data-start=\"1570\" data-end=\"1586\" data-col-size=\"sm\"><code data-start=\"1572\" data-end=\"1585\">upper(text)<\/code><\/td>\n<td data-start=\"1586\" data-end=\"1616\" data-col-size=\"md\">Converts text to uppercase.<\/td>\n<td data-start=\"1616\" data-end=\"1648\" data-col-size=\"sm\"><code data-start=\"1618\" data-end=\"1634\">upper(\"hello\")<\/code> \u2192 <code data-start=\"1637\" data-end=\"1646\">\"HELLO\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"1649\" data-end=\"1727\">\n<td data-start=\"1649\" data-end=\"1665\" data-col-size=\"sm\"><code data-start=\"1651\" data-end=\"1664\">lower(text)<\/code><\/td>\n<td data-start=\"1665\" data-end=\"1695\" data-col-size=\"md\">Converts text to lowercase.<\/td>\n<td data-start=\"1695\" data-end=\"1727\" data-col-size=\"sm\"><code data-start=\"1697\" data-end=\"1713\">lower(\"HELLO\")<\/code> \u2192 <code data-start=\"1716\" data-end=\"1725\">\"hello\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"1728\" data-end=\"1858\">\n<td data-start=\"1728\" data-end=\"1755\" data-col-size=\"sm\"><code data-start=\"1730\" data-end=\"1754\">split(text, separator)<\/code><\/td>\n<td data-start=\"1755\" data-end=\"1816\" data-col-size=\"md\">Splits a string by a separator and returns the first part.<\/td>\n<td data-start=\"1816\" data-end=\"1858\" data-col-size=\"sm\"><code data-start=\"1818\" data-end=\"1845\">split(\"Ivan Petrov\", \" \")<\/code> \u2192 <code data-start=\"1848\" data-end=\"1856\">\"Ivan\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"1859\" data-end=\"2002\">\n<td data-start=\"1859\" data-end=\"1902\" data-col-size=\"sm\"><code data-start=\"1861\" data-end=\"1901\">match(text, pattern, ignore_case=True)<\/code><\/td>\n<td data-start=\"1902\" data-end=\"1960\" data-col-size=\"md\">Checks if a string contains a specified word (pattern).<\/td>\n<td data-start=\"1960\" data-end=\"2002\" data-col-size=\"sm\"><code data-start=\"1962\" data-end=\"1991\">match(\"buy product\", \"buy\")<\/code> \u2192 <code data-start=\"1994\" data-end=\"2000\">True<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p data-start=\"73\" data-end=\"164\">Variables of type \u201cDate\u201d and \u201cDate and Time\u201d are stored in an internal format: YYYY-MM-DD<\/p>\n<p data-start=\"166\" data-end=\"245\">For example, a user input of 11.11.2011 is stored internally as &#8220;2011-11-11&#8221;.<\/p>\n<p data-start=\"247\" data-end=\"330\">Therefore, when using <strong>substring()<\/strong>, the trimming is done according to this format.<\/p>\n<p data-start=\"332\" data-end=\"359\" data-is-last-node=\"\" data-is-only-node=\"\">To get the expected values:<\/p>\n<p data-start=\"65\" data-end=\"114\"><strong>Option 1: convert the date to a familiar format<\/strong><\/p>\n<pre data-start=\"116\" data-end=\"165\">date = format_date(client.birth_date, \"%d.%m.%Y\")<\/pre>\n<p data-start=\"73\" data-end=\"133\"><strong>Option 2: trim the date according to the YYYY-MM-DD format<\/strong><\/p>\n<p data-start=\"135\" data-end=\"176\">Use the string indices of &#8220;2011-11-11&#8221;.<\/p>\n<p data-start=\"178\" data-end=\"295\">All operations are performed in the account\u2019s time zone.<br data-start=\"234\" data-end=\"237\" \/>Multiplying or dividing dates will cause a \u201cType Error\u201d.<\/p>\n<p data-start=\"297\" data-end=\"418\" data-is-last-node=\"\" data-is-only-node=\"\">We can count the number of characters in a string using <strong>len(x)<\/strong>. Variables with the required names must be set in advance.<\/p>\n<pre data-start=\"79\" data-end=\"113\">#Count the number of characters\r\nclient.answer_count = len(client.answer)\r\n\r\n#Check that the number of characters is more than 10\r\nclient.answer_valid = len(client.answer) &gt;= 10<\/pre>\n<p data-start=\"65\" data-end=\"135\">In line 2, we count the number of characters using the len function.<\/p>\n<p data-start=\"137\" data-end=\"274\" data-is-last-node=\"\" data-is-only-node=\"\">In line 5, we perform a logical condition \u2014 if it\u2019s more than 10, the value 1 is assigned to the variable <strong>answer_valid<\/strong>. If it\u2019s less \u2014 0.<br \/>\n<strong data-start=\"2009\" data-end=\"2036\"><br \/>\n<a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.54.46.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6535\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.54.46.png\" alt=\"\" width=\"928\" height=\"210\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.54.46.png 928w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.54.46-300x68.png 300w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.54.46-768x174.png 768w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/a><br \/>\n<\/strong><\/p>\n<pre>Number of characters in the answer: <strong data-start=\"220\" data-end=\"240\">{%answer_count%}<\/strong><br data-start=\"240\" data-end=\"243\" \/>Thank you for the detailed response\r\n\r\n<\/pre>\n<h4><a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.56.35.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6536\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.56.35.png\" alt=\"\" width=\"379\" height=\"250\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.56.35.png 740w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-11-v-17.56.35-300x198.png 300w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/a><\/h4>\n<p data-start=\"76\" data-end=\"156\"><strong>Let\u2019s calculate the destiny number<\/strong> \u2014 the sum of all digits in the date of birth.<\/p>\n<p data-start=\"158\" data-end=\"274\">After receiving the subscriber\u2019s date of birth, we can pass it to the variable <strong data-start=\"237\" data-end=\"251\">birth_date<\/strong> in the <strong>\u201cFormula\u201d<\/strong> step.<\/p>\n<p data-start=\"276\" data-end=\"533\">In line 1, we convert the date format into the required form. Since variables of the \u201cDate\u201d and \u201cDate and time\u201d types are stored in the internal format YYYY-MM-DD, even if the user entered the date as 11.11.2011, it is stored inside BotHelp as &#8220;2011-11-11&#8221;.<\/p>\n<p data-start=\"535\" data-end=\"680\">From lines 3 to 10, using the <strong data-start=\"565\" data-end=\"578\">substring<\/strong> function, we extract the necessary digits from the date of birth and save them into a local variable.<\/p>\n<p data-start=\"682\" data-end=\"819\" data-is-last-node=\"\" data-is-only-node=\"\">In line 11, we sum the extracted digits from the date of birth into the <strong data-start=\"754\" data-end=\"769\">life_number<\/strong> variable to display the result to the subscriber.<\/p>\n<pre>date = format_date(client.birth_date, \"%d.%m.%Y\")\r\n\r\nd1 = int(substring(date, 0, -9))\r\nd2 = int(substring(date, 1, -8))\r\nd3 = int(substring(date, 3, -6))\r\nd4 = int(substring(date, 4, -5))\r\nd5 = int(substring(date, 6, -3))\r\nd6 = int(substring(date, 7, -2))\r\nd7 = int(substring(date, 8, -1))\r\nd8 = int(substring(date, 9, 0))\r\n\r\nclient.life_number = d1+d2+d3+d4+d5+d6+d7+d8<\/pre>\n<p><a href=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.30.11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6538\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.30.11.png\" alt=\"\" width=\"902\" height=\"452\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.30.11.png 902w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.30.11-300x150.png 300w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.30.11-768x385.png 768w\" sizes=\"auto, (max-width: 902px) 100vw, 902px\" \/><\/a><\/p>\n<pre>Your destiny number is {%life_number%}\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6539\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.31.45.png\" alt=\"\" width=\"377\" height=\"236\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.31.45.png 722w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.31.45-300x188.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/pre>\n<h4>Working with dates and time<\/h4>\n<div class=\"_tableContainer_1rjym_1\">\n<div class=\"group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"2040\" data-end=\"3292\">\n<thead data-start=\"2040\" data-end=\"2076\">\n<tr data-start=\"2040\" data-end=\"2076\">\n<th data-start=\"2040\" data-end=\"2051\" data-col-size=\"sm\">Function<\/th>\n<th data-start=\"2051\" data-end=\"2065\" data-col-size=\"lg\">Description<\/th>\n<th data-start=\"2065\" data-end=\"2076\" data-col-size=\"md\">Example<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2114\" data-end=\"3292\">\n<tr data-start=\"2114\" data-end=\"2293\">\n<td data-start=\"2114\" data-end=\"2137\" data-col-size=\"sm\"><code data-start=\"2116\" data-end=\"2136\">get_current_time()<\/code><\/td>\n<td data-start=\"2137\" data-end=\"2229\" data-col-size=\"lg\">Returns the current date and time in the workspace timezone. Format: <code data-start=\"2208\" data-end=\"2227\">%Y-%m-%d %H:%M:%S<\/code>.<\/td>\n<td data-start=\"2229\" data-end=\"2293\" data-col-size=\"md\"><code data-start=\"2231\" data-end=\"2265\">globals.now = get_current_time()<\/code> \u2192 <code data-start=\"2268\" data-end=\"2291\">\"2025-11-11 16:30:00\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"2294\" data-end=\"2453\">\n<td data-start=\"2294\" data-end=\"2319\" data-col-size=\"sm\"><code data-start=\"2296\" data-end=\"2318\">addYear(date, years)<\/code><\/td>\n<td data-start=\"2319\" data-end=\"2406\" data-col-size=\"lg\">Adds or subtracts years (accounts for leap years). Use negative numbers to subtract.<\/td>\n<td data-start=\"2406\" data-end=\"2453\" data-col-size=\"md\"><code data-start=\"2408\" data-end=\"2434\">addYear(\"2020-01-01\", 3)<\/code> \u2192 <code data-start=\"2437\" data-end=\"2451\">\"2023-01-01\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"2454\" data-end=\"2600\">\n<td data-start=\"2454\" data-end=\"2481\" data-col-size=\"sm\"><code data-start=\"2456\" data-end=\"2480\">addMonth(date, months)<\/code><\/td>\n<td data-start=\"2481\" data-end=\"2552\" data-col-size=\"lg\">Adds or subtracts months (accounts for month length and leap years).<\/td>\n<td data-start=\"2552\" data-end=\"2600\" data-col-size=\"md\"><code data-start=\"2554\" data-end=\"2581\">addMonth(\"2025-01-10\", 2)<\/code> \u2192 <code data-start=\"2584\" data-end=\"2598\">\"2025-03-10\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"2601\" data-end=\"2734\">\n<td data-start=\"2601\" data-end=\"2625\" data-col-size=\"sm\"><code data-start=\"2603\" data-end=\"2624\">addDays(date, days)<\/code><\/td>\n<td data-start=\"2625\" data-end=\"2685\" data-col-size=\"lg\">Adds or subtracts days. Use negative numbers to subtract.<\/td>\n<td data-start=\"2685\" data-end=\"2734\" data-col-size=\"md\"><code data-start=\"2687\" data-end=\"2715\">addDays(\"20.08.2019\", -99)<\/code> \u2192 <code data-start=\"2718\" data-end=\"2732\">\"13.05.2019\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"2735\" data-end=\"2882\">\n<td data-start=\"2735\" data-end=\"2765\" data-col-size=\"sm\"><code data-start=\"2737\" data-end=\"2764\">addMinutes(date, minutes)<\/code><\/td>\n<td data-start=\"2765\" data-end=\"2816\" data-col-size=\"lg\">Adds or subtracts minutes (for DateTime values).<\/td>\n<td data-start=\"2816\" data-end=\"2882\" data-col-size=\"md\"><code data-start=\"2818\" data-end=\"2854\">addMinutes(get_current_time(), 20)<\/code> \u2192 <code data-start=\"2857\" data-end=\"2880\">\"2025-11-11 16:50:00\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"2883\" data-end=\"3103\">\n<td data-start=\"2883\" data-end=\"2915\" data-col-size=\"sm\"><code data-start=\"2885\" data-end=\"2914\">format_date(date, \"format\")<\/code><\/td>\n<td data-start=\"2915\" data-end=\"3043\" data-col-size=\"lg\">Converts a date to the specified format. Supported formats: <code data-start=\"2977\" data-end=\"2987\">%Y-%m-%d<\/code>, <code data-start=\"2989\" data-end=\"2999\">%d.%m.%Y<\/code>, <code data-start=\"3001\" data-end=\"3020\">%Y-%m-%d %H:%M:%S<\/code>, <code data-start=\"3022\" data-end=\"3041\">%d.%m.%Y %H:%M:%S<\/code>.<\/td>\n<td data-start=\"3043\" data-end=\"3103\" data-col-size=\"md\"><code data-start=\"3045\" data-end=\"3084\">format_date(\"2025-10-10\", \"%d.%m.%Y\")<\/code> \u2192 <code data-start=\"3087\" data-end=\"3101\">\"10.10.2025\"<\/code><\/td>\n<\/tr>\n<tr data-start=\"3104\" data-end=\"3292\">\n<td data-start=\"3104\" data-end=\"3138\" data-col-size=\"sm\"><code data-start=\"3106\" data-end=\"3137\">date_diff(date1, date2, unit)<\/code><\/td>\n<td data-start=\"3138\" data-end=\"3221\" data-col-size=\"lg\">Returns the difference between two dates. <code data-start=\"3182\" data-end=\"3188\">unit<\/code> can be <code data-start=\"3196\" data-end=\"3204\">\"days\"<\/code> or <code data-start=\"3208\" data-end=\"3219\">\"minutes\"<\/code>.<\/td>\n<td data-start=\"3221\" data-end=\"3292\" data-col-size=\"md\"><code data-start=\"3223\" data-end=\"3281\">date_diff(get_current_time(), client.birth_date, \"days\")<\/code> \u2192 <code data-start=\"3284\" data-end=\"3290\">9125<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p data-start=\"3294\" data-end=\"3410\">All operations are performed in the workspace timezone. Multiplying or dividing dates will cause a <strong data-start=\"3393\" data-end=\"3407\">Type Error<\/strong>.<\/p>\n<p>Let\u2019s calculate how old the subscriber is and make a prediction based on that.<\/p>\n<p data-start=\"134\" data-end=\"249\" data-is-last-node=\"\" data-is-only-node=\"\">First, we request the date of birth and save the response to a variable of the <strong data-start=\"213\" data-end=\"221\">date<\/strong> type called <strong data-start=\"234\" data-end=\"248\">birth_date<\/strong>.<\/p>\n<p data-start=\"78\" data-end=\"106\">Next, in the \u201cFormula\u201d step:<\/p>\n<ol>\n<li data-start=\"108\" data-end=\"438\">Using <strong data-start=\"114\" data-end=\"121\">int<\/strong>, we remove fractional values to get the full number of years.<\/li>\n<li data-start=\"108\" data-end=\"438\">Using <strong data-start=\"192\" data-end=\"205\" data-is-only-node=\"\">date_diff<\/strong>, we calculate the difference in days between the previously entered <strong data-start=\"274\" data-end=\"288\">birth_date<\/strong> and the current date value <strong data-start=\"316\" data-end=\"336\">get_current_time<\/strong>.<\/li>\n<li data-start=\"108\" data-end=\"438\">Then, using an <strong data-start=\"355\" data-end=\"361\">IF<\/strong> condition, we write the corresponding result into the <strong data-start=\"416\" data-end=\"428\">forecast<\/strong> variable.<\/li>\n<\/ol>\n<pre data-start=\"3417\" data-end=\"3439\">client.age_years = int(date_diff(client.birth_date, get_current_time(),\r\n\"days\") \/ 365)\r\n\r\nclient.forecast = if(client.age_years &gt;= 30,\"It\u2019s a time of structure and stability \ud83d\udc4c\",\r\n\"A period of experimentation and growth \u2014 try something new \ud83d\udcab\")<strong data-start=\"3417\" data-end=\"3437\">\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6540\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.39.17-1024x136.png\" alt=\"\" width=\"1024\" height=\"136\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.39.17-1024x136.png 1024w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.39.17-300x40.png 300w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.39.17-768x102.png 768w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.39.17.png 1186w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/>\r\n<\/strong><\/pre>\n<pre data-pm-slice=\"1 1 []\">You are <span class=\"macros\" data-macros=\"{%age_years%}\" data-value=\"age_years\" data-symbol=\"%\" data-readonly=\"true\"><span class=\"macros-start\" contenteditable=\"false\">{%<\/span><span class=\"macros-content\" contenteditable=\"false\">age_years<\/span><span class=\"macros-end\" contenteditable=\"false\">%}<\/span><\/span> years old <span class=\"macros\" data-macros=\"{%forecast%}\" data-value=\"forecast\" data-symbol=\"%\" data-readonly=\"true\"><span class=\"macros-start\" contenteditable=\"false\">{%<\/span><span class=\"macros-content\" contenteditable=\"false\">forecast<\/span><span class=\"macros-end\" contenteditable=\"false\">%}<\/span><\/span><\/pre>\n<h4 data-start=\"3417\" data-end=\"3439\"><strong data-start=\"3417\" data-end=\"3437\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6541\" src=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.40.52.png\" alt=\"\" width=\"335\" height=\"202\" srcset=\"https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.40.52.png 730w, https:\/\/help.bothelp.io\/wp-content\/uploads\/2025\/12\/snimok-ekrana-2025-12-12-v-10.40.52-300x181.png 300w\" sizes=\"auto, (max-width: 335px) 100vw, 335px\" \/><\/strong><\/h4>\n<p>Functional Notes<\/p>\n<ul data-start=\"3441\" data-end=\"3808\" data-is-last-node=\"\" data-is-only-node=\"\">\n<li data-start=\"3441\" data-end=\"3545\">\n<p data-start=\"3443\" data-end=\"3545\">Code in the \u201cFormula\u201d step executes line by line, top to bottom, in an isolated BotHelp environment.<\/p>\n<\/li>\n<li data-start=\"3546\" data-end=\"3596\">\n<p data-start=\"3548\" data-end=\"3596\">Syntax is similar to Python but not identical.<\/p>\n<\/li>\n<li data-start=\"3597\" data-end=\"3707\">\n<p data-start=\"3599\" data-end=\"3707\">Only simple expressions are supported \u2014 no loops (<code data-start=\"3649\" data-end=\"3654\">for<\/code>, <code data-start=\"3656\" data-end=\"3663\">while<\/code>), functions (<code data-start=\"3677\" data-end=\"3682\">def<\/code>), or external imports.<\/p>\n<\/li>\n<li data-start=\"3708\" data-end=\"3761\">\n<p data-start=\"3710\" data-end=\"3761\">Code cannot call APIs or access external systems.<\/p>\n<\/li>\n<li data-start=\"3762\" data-end=\"3808\" data-is-last-node=\"\">\n<p data-start=\"3764\" data-end=\"3808\" data-is-last-node=\"\">Variables are created upon first assignment.<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<p><span style=\"font-weight: 400;\">\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043d\u0430\u043c \u0432 \u0447\u0430\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0430 \u043b\u0438\u0431\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 Telegram<\/span><a href=\"https:\/\/t.me\/BotHelpSupportBot\" target=\"_blank\" rel=\"noopener\">&nbsp;<span style=\"font-weight: 400;\">BotHelpSupportBot<\/span><\/a><span style=\"font-weight: 400;\"> \u0438\u043b\u0438 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 <\/span><a href=\"mailto:hello@bothelp.io\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">hello@bothelp.io&nbsp;<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 14 \u0434\u043d\u0435\u0439 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043e\u043a, \u0430\u0432\u0442\u043e\u0432\u043e\u0440\u043e\u043d\u043e\u043a \u0438 \u0447\u0430\u0442-\u0431\u043e\u0442\u043e\u0432 BotHelp.<\/span><\/p>\n<p><a href=\"https:\/\/bothelp.io\/ru\" target=\"_blank\" rel=\"noopener\"><b>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 14 \u0434\u043d\u0435\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e<\/b><\/a><\/p>\n\r\n\t\t\t<div id=\"daexthefu-container\"\r\n\t\t\t\tclass=\"daexthefu-container daexthefu-layout-side-by-side daexthefu-alignment-left\"\r\n\t\t\t\tdata-post-id=\"6143\">\r\n\r\n\t\t\t\t<div class=\"daexthefu-feedback\">\r\n\t\t\t\t\t<div class=\"daexthefu-text\">\r\n\t\t\t\t\t\t<h3 class=\"daexthefu-title\">\u0411\u044b\u043b\u0430 \u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430?<\/h3>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<div class=\"daexthefu-buttons-container\">\r\n\t\t\t\t\t\t<div class=\"daexthefu-buttons\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t<div class=\"daexthefu-yes daexthefu-button daexthefu-button-type-icon\" data-value=\"1\">\r\n\t\t\t\t\r\n                <svg>\r\n                    <defs>\r\n                        <style>.thumb-up-cls-1{fill:#c9c9c9;}.thumb-up-cls-2{fill:#e1e1e1;}.thumb-up-cls-3{fill:#676767;}<\/style>\r\n                    <\/defs>\r\n                    <g id=\"thumb_up\">\r\n                        <path class=\"thumb-up-cls-2 daexthefu-icon-circle\" d=\"m24,3c11.58,0,21,9.42,21,21s-9.42,21-21,21S3,35.58,3,24,12.42,3,24,3m0-1C11.85,2,2,11.85,2,24s9.85,22,22,22,22-9.85,22-22S36.15,2,24,2h0Z\" \/>\r\n                        <g>\r\n                            <rect class=\"thumb-up-cls-3 daexthefu-icon-secondary-color\" x=\"10\" y=\"20\" width=\"6\" height=\"15\" rx=\"1.5\" ry=\"1.5\" \/>\r\n                            <path class=\"thumb-up-cls-1 daexthefu-icon-primary-color\" d=\"m30.57,9.06l-.49-.1c-.81-.17-1.61.35-1.78,1.16l-5.3,11.74c-.17.81,3.16,1.61,3.97,1.78l1.96.41c.81.17,1.61-.35,1.78-1.16l2.18-10.27c.34-1.61-.7-3.21-2.31-3.56Z\" \/>\r\n                            <path class=\"thumb-up-cls-1 daexthefu-icon-primary-color\" d=\"m38.17,20h-18.67c-.83,0-1.5.67-1.5,1.5v12c0,.83.67,1.5,1.5,1.5h16.27c.71,0,1.33-.5,1.47-1.21l2.4-12c.19-.93-.53-1.8-1.47-1.8Z\" \/>\r\n                        <\/g>\r\n                    <\/g>\r\n                <\/svg>\t\t\t<\/div>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t<div class=\"daexthefu-no daexthefu-button daexthefu-button-type-icon\" data-value=\"0\">\r\n\t\t\t\t\r\n                <svg>\r\n                    <defs>\r\n                        <style>.thumb-down-cls-1{fill:#c9c9c9;}.thumb-down-cls-2{fill:#e1e1e1;}.thumb-down-cls-3{fill:#676767;}<\/style>\r\n                    <\/defs>\r\n                    <g id=\"thumb_down\">\r\n                        <path class=\"thumb-down-cls-2 daexthefu-icon-circle\" d=\"m24,3c11.58,0,21,9.42,21,21s-9.42,21-21,21S3,35.58,3,24,12.42,3,24,3m0-1C11.85,2,2,11.85,2,24s9.85,22,22,22,22-9.85,22-22S36.15,2,24,2h0Z\" \/>\r\n                        <g>\r\n                            <rect class=\"thumb-down-cls-3 daexthefu-icon-secondary-color\" x=\"10\" y=\"13\" width=\"6\" height=\"15\" rx=\"1.5\" ry=\"1.5\" \/>\r\n                            <path class=\"thumb-down-cls-1 daexthefu-icon-primary-color\" d=\"m30.57,38.94l-.49.1c-.81.17-1.61-.35-1.78-1.16l-5.3-11.74c-.17-.81,3.16-1.61,3.97-1.78l1.96-.41c.81-.17,1.61.35,1.78,1.16l2.18,10.27c.34,1.61-.7,3.21-2.31,3.56Z\" \/>\r\n                            <path class=\"thumb-down-cls-1 daexthefu-icon-primary-color\" d=\"m38.17,28h-18.67c-.83,0-1.5-.67-1.5-1.5v-12c0-.83.67-1.5,1.5-1.5h16.27c.71,0,1.33.5,1.47,1.21l2.4,12c.19.93-.53,1.8-1.47,1.8Z\" \/>\r\n                        <\/g>\r\n                    <\/g>\r\n                <\/svg>\t\t\t<\/div>\r\n\r\n\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"daexthefu-comment\">\r\n\t\t\t\t\t<div class=\"daexthefu-comment-top-container\">\r\n\t\t\t\t\t\t<label id=\"daexthefu-comment-label\" class=\"daexthefu-comment-label\"><\/label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"daexthefu-comment-character-counter-container\">\r\n\t\t\t\t\t\t\t\t<div id=\"daexthefu-comment-character-counter-number\"\r\n\t\t\t\t\t\t\t\t\tclass=\"daexthefu-comment-character-counter-number\"><\/div>\r\n\t\t\t\t\t\t\t\t<div class=\"daexthefu-comment-character-counter-text\"><\/div>\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<textarea id=\"daexthefu-comment-textarea\" class=\"daexthefu-comment-textarea\"\r\n\t\t\t\t\t\t\t\tplaceholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0430\u0448\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\"\r\n\t\t\t\t\t\t\t\tmaxlength=\"\r\n\t\t\t\t\t\t\t\t400\t\t\t\t\t\t\t\t\t\"><\/textarea>\r\n\t\t\t\t\t<div class=\"daexthefu-comment-buttons-container\">\r\n\t\t\t\t\t\t<button class=\"daexthefu-comment-submit daexthefu-button\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c<\/button>\r\n\t\t\t\t\t\t<button class=\"daexthefu-comment-cancel daexthefu-button\">\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c<\/button>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"daexthefu-successful-submission-text\">\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c!<\/div>\r\n\r\n\t\t\t<\/div>\r\n\r\n\t\t\t","protected":false},"excerpt":{"rendered":"<p>The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder, [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_helpful_status":1,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-6143","post","type-post","status-publish","format-standard","hentry","category-shagi-v-botah"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Step formula<\/title>\n<meta name=\"description\" content=\"The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder,&hellip;\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/The%20\u201cFormula\u201d%20Step%20is%20a%20code%20editor%20block%20where%20you%20can%20perform%20logical%20and%20arithmetic%20operations,%20use%20built-in%20functions,%20and%20manage%20variables.With%20it,%20you%20can%20assign%20values%20to%20fields%20and%20variables,%20calculate%20metrics,%20compare%20data,%20and%20build%20complex%20scenarios%20directly%20inside%20BotHelp.%20Where%20to%20Find%20It%20and%20How%20to%20Enable%20It%20In%20the%20flow%20builder,&hellip;\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Step formula\" \/>\n<meta property=\"og:description\" content=\"The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder,&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/help.bothelp.io\/en\/shag-formula\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/bothelpru\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-31T08:58:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-26T09:49:26+00:00\" \/>\n<meta name=\"author\" content=\"e.bezmaternykh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"e.bezmaternykh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/\"},\"author\":{\"name\":\"e.bezmaternykh\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/#\\\/schema\\\/person\\\/3d6703d74bf6281d752af998b5a7a799\"},\"headline\":\"Step formula\",\"datePublished\":\"2025-10-31T08:58:48+00:00\",\"dateModified\":\"2026-03-26T09:49:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/\"},\"wordCount\":555,\"articleSection\":[\"Steps in bots\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/\",\"url\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/\",\"name\":\"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0448\u0430\u0433\u0430 \u00ab\u0424\u043e\u0440\u043c\u0443\u043b\u0430\u00bb - \u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/#website\"},\"datePublished\":\"2025-10-31T08:58:48+00:00\",\"dateModified\":\"2026-03-26T09:49:26+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/#\\\/schema\\\/person\\\/3d6703d74bf6281d752af998b5a7a799\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/shag-formula\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"How to Work with BotHelp Service: Setting Up Your Account for Your Business Goals\",\"item\":\"https:\\\/\\\/help.bothelp.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Step formula\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/\",\"name\":\"\u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp\",\"description\":\"\u0417\u0434\u0435\u0441\u044c \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/help.bothelp.io\\\/#\\\/schema\\\/person\\\/3d6703d74bf6281d752af998b5a7a799\",\"name\":\"e.bezmaternykh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g\",\"caption\":\"e.bezmaternykh\"},\"url\":\"https:\\\/\\\/help.bothelp.io\\\/en\\\/author\\\/e-bezmaternykh\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Step formula","description":"The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder,&hellip;","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder,&hellip;","og_locale":"en_US","og_type":"article","og_title":"Step formula","og_description":"The \u201cFormula\u201d Step is a code editor block where you can perform logical and arithmetic operations, use built-in functions, and manage variables.With it, you can assign values to fields and variables, calculate metrics, compare data, and build complex scenarios directly inside BotHelp. Where to Find It and How to Enable It In the flow builder,&hellip;","og_url":"https:\/\/help.bothelp.io\/en\/shag-formula\/","og_site_name":"\u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp","article_publisher":"https:\/\/www.facebook.com\/bothelpru","article_published_time":"2025-10-31T08:58:48+00:00","article_modified_time":"2026-03-26T09:49:26+00:00","author":"e.bezmaternykh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"e.bezmaternykh","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/#article","isPartOf":{"@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/"},"author":{"name":"e.bezmaternykh","@id":"https:\/\/help.bothelp.io\/#\/schema\/person\/3d6703d74bf6281d752af998b5a7a799"},"headline":"Step formula","datePublished":"2025-10-31T08:58:48+00:00","dateModified":"2026-03-26T09:49:26+00:00","mainEntityOfPage":{"@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/"},"wordCount":555,"articleSection":["Steps in bots"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/","url":"https:\/\/help.bothelp.io\/en\/shag-formula\/","name":"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0448\u0430\u0433\u0430 \u00ab\u0424\u043e\u0440\u043c\u0443\u043b\u0430\u00bb - \u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp","isPartOf":{"@id":"https:\/\/help.bothelp.io\/#website"},"datePublished":"2025-10-31T08:58:48+00:00","dateModified":"2026-03-26T09:49:26+00:00","author":{"@id":"https:\/\/help.bothelp.io\/#\/schema\/person\/3d6703d74bf6281d752af998b5a7a799"},"breadcrumb":{"@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/help.bothelp.io\/en\/shag-formula\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/help.bothelp.io\/en\/shag-formula\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"How to Work with BotHelp Service: Setting Up Your Account for Your Business Goals","item":"https:\/\/help.bothelp.io\/"},{"@type":"ListItem","position":2,"name":"Step formula"}]},{"@type":"WebSite","@id":"https:\/\/help.bothelp.io\/en\/#website","url":"https:\/\/help.bothelp.io\/en\/","name":"\u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439 BotHelp","description":"\u0417\u0434\u0435\u0441\u044c \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/help.bothelp.io\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/help.bothelp.io\/#\/schema\/person\/3d6703d74bf6281d752af998b5a7a799","name":"e.bezmaternykh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5cb3cb3e24dd71cdab99be19c756f97e910900e6371c5573a7604f4cb2a523a9?s=96&d=mm&r=g","caption":"e.bezmaternykh"},"url":"https:\/\/help.bothelp.io\/en\/author\/e-bezmaternykh\/"}]}},"_links":{"self":[{"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/posts\/6143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/comments?post=6143"}],"version-history":[{"count":60,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/posts\/6143\/revisions"}],"predecessor-version":[{"id":7733,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/posts\/6143\/revisions\/7733"}],"wp:attachment":[{"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/media?parent=6143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/categories?post=6143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.bothelp.io\/en\/wp-json\/wp\/v2\/tags?post=6143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}