<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to case statement in function</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/c83509a225/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/c83509a225/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/c83509a225/</id><updated>2020-02-27T20:35:00.885000Z</updated><subtitle>Recent posts to case statement in function</subtitle><entry><title>case statement in function</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/c83509a225/?limit=25#f02a" rel="alternate"/><published>2020-02-27T20:35:00.885000Z</published><updated>2020-02-27T20:35:00.885000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com6e3e26e7e2505af6815ab625a87ea32beaad472f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This means your string must be an integer  like '123'&lt;br/&gt;
it can not be 'onehundredtwentythree'&lt;br/&gt;
in that case you will have to use my solution with the IF statements.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>case statement in function</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/c83509a225/?limit=25#1fd8" rel="alternate"/><published>2020-02-27T20:34:59.432000Z</published><updated>2020-02-27T20:34:59.432000Z</updated><author><name>sarathbabu</name><uri>https://forge.codesys.com/u/sarathbabu/</uri></author><id>https://forge.codesys.comf87cb0e961b56ccc454084c4ddf20d566c9de322</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Steps you said can be a proper way to do&lt;/p&gt;
&lt;p&gt;I used STRING_TO_INTEGER it is working fine&lt;/p&gt;
&lt;p&gt;Any thing is wrong with this&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Sarath&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>case statement in function</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/c83509a225/?limit=25#d91b" rel="alternate"/><published>2020-02-27T20:34:58.081000Z</published><updated>2020-02-27T20:34:58.081000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comb6d17885a0b59d6a023a471fa121499ff23c48c0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;No case can only be used with a INT as selector.&lt;/p&gt;
&lt;p&gt;If the var used is a number in stringformat you can simply convert it to an integer&lt;br/&gt;
if the var is 'anystring' then you first must check them with an IF statement&lt;br/&gt;
so IF var='anystring'then caseselctor :=1;&lt;br/&gt;
IF var = 'anystring1'then caseselctor :=2;&lt;br/&gt;
etc&lt;br/&gt;
next question is&lt;/p&gt;
&lt;p&gt;case temp of&lt;/p&gt;
&lt;p&gt;0:test:=STRING_TO_BOOL (trig) ;(&lt;em&gt;it will return bool&lt;/em&gt;)&lt;br/&gt;
(&lt;em&gt;test must be declared as bool obvious&lt;/em&gt;)&lt;br/&gt;
1:tester:=STRING_TO_INT (trigg); (&lt;em&gt;it will return int&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;2:testerhw:=STRING_TO_REAL(trigrrw);(&lt;em&gt;it will return float&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;end_case&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>case statement in function</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/c83509a225/?limit=25#8ddc" rel="alternate"/><published>2020-02-27T20:34:54.251000Z</published><updated>2020-02-27T20:34:54.251000Z</updated><author><name>sarathbabu</name><uri>https://forge.codesys.com/u/sarathbabu/</uri></author><id>https://forge.codesys.com143fb86667adf97017dee62f72d7cf957306eb68</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;just convert STRING_TO_INT and u can use in Case statement too.  &lt;/p&gt;
&lt;p&gt;But still am wondering how to implement in function for the above requirement. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>case statement in function</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/c83509a225/?limit=25#7b12" rel="alternate"/><published>2020-02-27T20:34:52.892000Z</published><updated>2020-02-27T20:34:52.892000Z</updated><author><name>sarathbabu</name><uri>https://forge.codesys.com/u/sarathbabu/</uri></author><id>https://forge.codesys.com2a74820419e9b97f724e6044965a58bf7be3e258</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hi&lt;/p&gt;
&lt;p&gt;how to put up a case statement in a function for this case&lt;/p&gt;
&lt;p&gt;case temp of&lt;/p&gt;
&lt;p&gt;0:test:=trig(&lt;em&gt;it will return bool&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;1:tester:=trigg(&lt;em&gt;it will return int&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;2:testerhw:=trigrrw(&lt;em&gt;it will return float&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;end_case&lt;/p&gt;
&lt;p&gt;and one more thing can we use case for a string as need for string operations&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>