{"id":3535,"date":"2019-02-12T16:09:21","date_gmt":"2019-02-12T16:09:21","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/usage-help-manual\/19-variables-and-computations\/cvar\/"},"modified":"2026-02-12T14:22:57","modified_gmt":"2026-02-12T19:22:57","slug":"cvar","status":"publish","type":"page","link":"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/cvar\/","title":{"rendered":"cvar"},"content":{"rendered":"<div>\n<h3>Purpose:<\/h3>\n<\/div>\n<dl>\n<dd>\n<p>Create and initialize variables in the CyFlex system from the command line or scripts, supporting data types such as REAL, INT, LOGICAL, and STRING.<\/p>\n<\/dd>\n<\/dl>\n<h3>Enter:<\/h3>\n<dl>\n<dd>\n<p>For REAL: <strong>cvar<\/strong> REAL &lt;label&gt; &lt;initial_value&gt; [units] [resolution]]<\/p>\n<p>For INT: cvar INT &lt;label&gt; &lt;initial_value&gt; [units]]<\/p>\n<p>For LOGICAL:<strong> cvar<\/strong> LOGI &lt;label&gt; &lt;initial_value&gt; [true_event_name] [false_event_name]]<\/p>\n<p>For STRING: <strong>cvar<\/strong> STRING &lt;label&gt; &lt;initial_value&gt;<\/p>\n<\/dd>\n<\/dl>\n<h3>Where:<\/h3>\n<dl>\n<dd>\n<div>\n<table style=\"width: 87.4%; height: 433px;\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col \/>\n<col \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 55px;\">\n<td style=\"width: 16.91%; height: 55px;\">\n<p>label<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 55px;\">\n<p>Specify the variable label to be created.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 55px;\">\n<td style=\"width: 16.91%; height: 55px;\">\n<p>initial_value<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 55px;\">\n<p>Specify the numeric value to which the variable will be set when created.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 55px;\">\n<td style=\"width: 16.91%; height: 55px;\">\n<p>units<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 55px;\">\n<p>Optional. Specify a valid CyFlex units string. The default is none.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 55px;\">\n<td style=\"width: 16.91%; height: 55px;\">\n<p>resolution<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 55px;\">\n<p>Optional. Specify the display resolution.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 79px;\">\n<td style=\"width: 16.91%; height: 79px;\">\n<p>true_event_name<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 79px;\">\n<p>Optional. Specify the name of an event that will be set when the variable value transitions from FALSE to TRUE.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 79px;\">\n<td style=\"width: 16.91%; height: 79px;\">\n<p>false_event_name<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 79px;\">\n<p>Optional. Specify the name of an event that will be set when the variable value transitions from TRUE to FALSE.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 55px;\">\n<td style=\"width: 16.91%; height: 55px;\">\n<p>event_name<\/p>\n<\/td>\n<td style=\"width: 172.05%; height: 55px;\">\n<p>Optional. Specify a transition event name which will be set if the string value is changed.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/dd>\n<\/dl>\n<h3>Examples:<\/h3>\n<dl>\n<dd>\n<p><span style=\"text-decoration: underline;\">REAL variable Example:<\/span>\u00a0<br \/>\nEnter: <strong>cvar<\/strong> REAL xyz 100 psi 2<br \/>\nThe preceding creates a real variable named &#8220;xyz&#8221; and set the units to [psi] and the initial value to 100[psi] and the display resolution to 2 places.<\/p>\n<div><span style=\"text-decoration: underline;\">INTEGER\u00a0variable Example:<\/span>\u00a0\u00a0<br \/>\nEnter:\u00a0\u00a0<strong>cvar<\/strong> INT\u00a0 my_int 99\u00a0 none\u00a0 <br \/>\nThe preceding creates an integer variable named &#8220;my_int&#8221; with an initial value of 99 and the units string of none.<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0\u00a0<\/div>\n<div><span style=\"text-decoration: underline;\"> LOGICAL\u00a0variable Example:<\/span>\u00a0\u00a0<br \/>\nEnter: \u00a0 <strong>cvar\u00a0<\/strong>LOGI\u00a0 pump\u00a0\u00a0ON\u00a0\u00a0pump-turned-on\u00a0\u00a0pump-turned_off\u00a0\u00a0 \u00a0<\/div>\n<div>The preceding creates a logical variable named &#8220;pump&#8221; with initial_value ON, true_event_name &#8220;pump_turned_on&#8221;, and false_event_name &#8220;pump_turned_off&#8221;.<\/div>\n<div>\u00a0<\/div>\n<div><span style=\"text-decoration: underline;\">STRING\u00a0variable Example:\u00a0\u00a0<\/span><br \/>\nEnter: <strong>cvar\u00a0<\/strong>STRING\u00a0 my_name\u00a0\u00a0&#8216;Joe Random&#8217;\u00a0\u00a0 \u00a0<\/div>\n<div>The preceding creates a string variable named &#8220;my_name&#8221; and sets the value to &#8216;Joe Random&#8217;.<\/div>\n<\/dd>\n<\/dl>\n<h3>Notes:<\/h3>\n<p style=\"padding-left: 40px;\">Variables created with cvar can only be updated if they are owned by cvar and of the same type.<\/p>\n<p style=\"padding-left: 40px;\">Ensure the variable does not already exist or matches the specified type.<\/p>\n<h3>See Also:<\/h3>\n<dl>\n<dd>\n<p><a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/rvar\/\">rvar<\/a><\/p>\n<\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Purpose: Create and initialize variables in the CyFlex system from the command line or scripts, supporting data types such as REAL, INT, LOGICAL, and STRING. Enter: For REAL: cvar REAL &lt;label&gt; &lt;initial_value&gt; [units] [resolution]] For INT: cvar INT &lt;label&gt; &lt;initial_value&gt; [units]] For LOGICAL: cvar LOGI &lt;label&gt; &lt;initial_value&gt; [true_event_name] [false_event_name]] For STRING: cvar STRING &lt;label&gt; &lt;initial_value&gt; [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"parent":1966,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3535","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/comments?post=3535"}],"version-history":[{"count":0,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3535\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/1966"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=3535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}