{"id":52655,"date":"2023-10-24T15:47:11","date_gmt":"2023-10-24T13:47:11","guid":{"rendered":"https:\/\/www.myscada.org\/?post_type=docs&#038;p=52655"},"modified":"2023-10-24T15:47:11","modified_gmt":"2023-10-24T13:47:11","password":"","slug":"entering-advanced-functions-equations","status":"publish","type":"docs","link":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/","title":{"rendered":"Entering advanced functions (equations)"},"content":{"rendered":"<p style=\"text-align: justify;\">To create complex and feature-rich components, you need to enter complex formulas instead of simple variables. You can use functions anywhere you like: inside animations, instead of constants, or as a text replacement in the text fields.<\/p>\n<p style=\"text-align: justify;\">Formulas are evaluated with JavaScript, so you can enter any formula that is a valid JavaScript expression. You can also include any of the Component Variables that you have defined.<\/p>\n<p style=\"text-align: justify;\">To show the functionality, we will extend our example by implementing the scale along the slide bar we have just created.<\/p>\n<ul style=\"list-style-type: square;\">\n<li style=\"text-align: justify;\">Open the slide bar created in the previous chapter and adjust as follows:<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg\" alt=\"7.7.1\" width=\"294\" height=\"122\" \/><\/p>\n<ul style=\"list-style-type: square;\">\n<li style=\"text-align: justify;\">Delete the <em>Min<\/em> and <em>Max<\/em> fields and stretch the blue rectangle, including the frame. After that, insert additional lines with the <em>Drawing-Line<\/em> tool to divide the rectangle into thirds. With <em>Transforms -&gt; Order -&gt; Lower to background<\/em> send both lines and the frame into the background<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.2.jpg\" alt=\"7.7.2\" width=\"302\" height=\"45\" \/><\/p>\n<ul style=\"list-style-type: square;\">\n<li>Now insert additional text fields.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.3.jpg\" alt=\"7.7.3\" width=\"302\" height=\"56\" \/><\/p>\n<p style=\"text-align: justify;\">For each text field we need to specify the <em>Text<\/em> in the <em>Replacement<\/em> in the <strong>Rep.<\/strong> tab:<\/p>\n<ul style=\"list-style-type: square;\">\n<li>Left text field:\u00a0<em>(min).toFixed(1)<\/em><\/li>\n<li>Second text field (from left): <em>((min+max)\/3+min).toFixed(1)<\/em><\/li>\n<li>Second text field (from right): <em>(2*(min+max)\/3+min).toFixed(1)<\/em><\/li>\n<li>Right text field: <em>(max).toFixed(1)<\/em><\/li>\n<\/ul>\n<p style=\"text-align: justify;\">The left text field will show the value of the variable <em>min.toFixed(x)<\/em>, which is a function that rounds the result to x decimal places. In our case, the value will be formatted to show one decimal place.<\/p>\n<p style=\"text-align: justify;\">The second text field from the left should show 1\/3 of the scale; therefore, we have used the formula <em>min+(min+max)\/3<\/em> to get 1\/3 of the scale. We will use the <em>toFixed(1)<\/em> function to round the result.<\/p>\n<p style=\"text-align: justify;\">The other two text fields are similar to those two; we can add units and a label to our component to finish:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.4.jpg\" alt=\"7.7.4\" width=\"600\" height=\"301\" \/><\/p>\n<p style=\"text-align: justify;\">To use the Label and Units text fields, we need to create two new variables. Both will be of the type \u2018string\u2019. The first variable will be named <em>label<\/em>, and the second will be named <em>unit<\/em>. For the text field label, add Text Replacement equal to the variable label. For Units text field, add Text Replacement equal to variable units. Finally, click on the <strong>Save<\/strong> button to see the changes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.5.jpg\" alt=\"7.7.5\" width=\"350\" height=\"202\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To create complex and feature-rich components, you need to enter complex formulas instead of simple variables. You can use functions anywhere you like: inside animations, instead of constants, or as a text replacement in the text fields. Formulas are evaluated with JavaScript, so you can enter any formula that is a valid JavaScript expression. You<a class=\"moretag excerpt orangelink\" href=\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":2555,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[325],"doc_tag":[],"class_list":["post-52655","docs","type-docs","status-publish","hentry","doc_category-mydesigner-v8"],"year_month":"2026-04","word_count":366,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Musilda","author_nicename":"musilda","author_url":"https:\/\/amitomation.cz\/en\/author\/musilda\/"},"doc_category_info":[{"term_name":"AMiTDesigner","term_url":"https:\/\/amitomation.cz\/en\/docs-category\/mydesigner-v8\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Entering advanced functions (equations) - AMiT Automation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Entering advanced functions (equations) - AMiT Automation\" \/>\n<meta property=\"og:description\" content=\"To create complex and feature-rich components, you need to enter complex formulas instead of simple variables. You can use functions anywhere you like: inside animations, instead of constants, or as a text replacement in the text fields. Formulas are evaluated with JavaScript, so you can enter any formula that is a valid JavaScript expression. You[...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\" \/>\n<meta property=\"og:site_name\" content=\"AMiT Automation\" \/>\n<meta property=\"og:image\" content=\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\",\"url\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\",\"name\":\"Entering advanced functions (equations) - AMiT Automation\",\"isPartOf\":{\"@id\":\"https:\/\/amitomation.cz\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg\",\"datePublished\":\"2023-10-24T13:47:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage\",\"url\":\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg\",\"contentUrl\":\"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/amitomation.cz\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/amitomation.cz\/en\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Entering advanced functions (equations)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/amitomation.cz\/en\/#website\",\"url\":\"https:\/\/amitomation.cz\/en\/\",\"name\":\"AMiT Automation\",\"description\":\"Czech manufacturer of Control Systems and Industrial Automation Electronics\",\"publisher\":{\"@id\":\"https:\/\/amitomation.cz\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/amitomation.cz\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/amitomation.cz\/en\/#organization\",\"name\":\"AMiT, spol. s r.o.\",\"url\":\"https:\/\/amitomation.cz\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/amitomation.cz\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/amitomation.cz\/wp-content\/uploads\/2017\/07\/amit_automation_100x42.gif\",\"contentUrl\":\"https:\/\/amitomation.cz\/wp-content\/uploads\/2017\/07\/amit_automation_100x42.gif\",\"width\":100,\"height\":42,\"caption\":\"AMiT, spol. s r.o.\"},\"image\":{\"@id\":\"https:\/\/amitomation.cz\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.linkedin.com\/organization\/10939938\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Entering advanced functions (equations) - AMiT Automation","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":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/","og_locale":"en_US","og_type":"article","og_title":"Entering advanced functions (equations) - AMiT Automation","og_description":"To create complex and feature-rich components, you need to enter complex formulas instead of simple variables. You can use functions anywhere you like: inside animations, instead of constants, or as a text replacement in the text fields. Formulas are evaluated with JavaScript, so you can enter any formula that is a valid JavaScript expression. You[...]","og_url":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/","og_site_name":"AMiT Automation","og_image":[{"url":"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/","url":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/","name":"Entering advanced functions (equations) - AMiT Automation","isPartOf":{"@id":"https:\/\/amitomation.cz\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage"},"image":{"@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage"},"thumbnailUrl":"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg","datePublished":"2023-10-24T13:47:11+00:00","breadcrumb":{"@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#primaryimage","url":"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg","contentUrl":"http:\/\/myscada.org\/downloads\/manuals_image\/img_7.7.1.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/amitomation.cz\/en\/documentation\/entering-advanced-functions-equations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/amitomation.cz\/en\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/amitomation.cz\/en\/documentation\/"},{"@type":"ListItem","position":3,"name":"Entering advanced functions (equations)"}]},{"@type":"WebSite","@id":"https:\/\/amitomation.cz\/en\/#website","url":"https:\/\/amitomation.cz\/en\/","name":"AMiT Automation","description":"Czech manufacturer of Control Systems and Industrial Automation Electronics","publisher":{"@id":"https:\/\/amitomation.cz\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/amitomation.cz\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/amitomation.cz\/en\/#organization","name":"AMiT, spol. s r.o.","url":"https:\/\/amitomation.cz\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/amitomation.cz\/en\/#\/schema\/logo\/image\/","url":"https:\/\/amitomation.cz\/wp-content\/uploads\/2017\/07\/amit_automation_100x42.gif","contentUrl":"https:\/\/amitomation.cz\/wp-content\/uploads\/2017\/07\/amit_automation_100x42.gif","width":100,"height":42,"caption":"AMiT, spol. s r.o."},"image":{"@id":"https:\/\/amitomation.cz\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/organization\/10939938\/"]}]}},"_links":{"self":[{"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/docs\/52655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/users\/2555"}],"replies":[{"embeddable":true,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/comments?post=52655"}],"version-history":[{"count":1,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/docs\/52655\/revisions"}],"predecessor-version":[{"id":53681,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/docs\/52655\/revisions\/53681"}],"wp:attachment":[{"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/media?parent=52655"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/doc_category?post=52655"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/amitomation.cz\/en\/wp-json\/wp\/v2\/doc_tag?post=52655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}