<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to ARRAY with and ENUM</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/</id><updated>2022-06-16T07:17:58.867000Z</updated><subtitle>Recent posts to ARRAY with and ENUM</subtitle><entry><title>ARRAY with and ENUM</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/?limit=25#8059/b395" rel="alternate"/><published>2022-06-16T07:17:58.867000Z</published><updated>2022-06-16T07:17:58.867000Z</updated><author><name>fraccaroli</name><uri>https://forge.codesys.com/u/fraccaroli/</uri></author><id>https://forge.codesys.com18b7b0c03a46147c382daad2cb9ee7c3e060b2b2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Fless, hi i-campbell,&lt;br/&gt;
I added the warning disable as Fless suggest, but if I use the enum in the project the warning come:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[WARNING]&lt;/span&gt; INDEX C0125:  The constant 2 is assigned to more than one enumeration&lt;br/&gt;
Compile complete -- 0 errors, 1 warnings&lt;/p&gt;
&lt;p&gt;I think that the only workaround (without using global constant) is to remove the 'strict' attribute.&lt;/p&gt;
&lt;p&gt;It seems that CODESYS does not support this way to use array and enums. I was only curious to understand if there were some other way conform with standard programming rules.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;br/&gt;
Francesco&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ARRAY with and ENUM</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/?limit=25#8059" rel="alternate"/><published>2022-06-15T18:30:46.133000Z</published><updated>2022-06-15T18:30:46.133000Z</updated><author><name>Fless</name><uri>https://forge.codesys.com/u/fless/</uri></author><id>https://forge.codesys.com892d374b65b281b94a31f819ab2a1b2682036e7f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Welcome Francesco,&lt;/p&gt;
&lt;p&gt;this works for me:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;{attribute 'qualified_only'}&lt;/span&gt;
&lt;span class="err"&gt;{attribute 'strict'}&lt;/span&gt;
&lt;span class="err"&gt;TYPE INDEX :&lt;/span&gt;
&lt;span class="err"&gt;(&lt;/span&gt;
&lt;span class="err"&gt;    ID1,    //0&lt;/span&gt;
&lt;span class="err"&gt;    ID2,    //1&lt;/span&gt;
&lt;span class="err"&gt;    ID3,    //2&lt;/span&gt;
&lt;span class="err"&gt;    {warning disable C0125}&lt;/span&gt;
&lt;span class="err"&gt;    LASTELEM := ID3&lt;/span&gt;
&lt;span class="err"&gt;    {warning restore C0125}&lt;/span&gt;
&lt;span class="err"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;PROGRAM POU&lt;/span&gt;
&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    values : ARRAY [0..INDEX.LASTELEM] OF INT;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;values[INDEX.ID1] := 1;&lt;/span&gt;
&lt;span class="err"&gt;values[INDEX.ID2] := 10;&lt;/span&gt;
&lt;span class="err"&gt;values[INDEX.ID3] := 100;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>ARRAY with and ENUM</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/?limit=25#6e24" rel="alternate"/><published>2022-06-15T18:06:26.512000Z</published><updated>2022-06-15T18:06:26.512000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.come93724b4c45ecddcec4e15ac20276ccc04a62b12</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;did you remove the 'strict' attribute from your enum definition already?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ARRAY with and ENUM</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f20b049449/?limit=25#acec" rel="alternate"/><published>2022-06-15T14:47:35.812000Z</published><updated>2022-06-15T14:47:35.812000Z</updated><author><name>fraccaroli</name><uri>https://forge.codesys.com/u/fraccaroli/</uri></author><id>https://forge.codesys.comea3dfddb8b3f380701a73853a071750a88e79237</id><summary type="html"/></entry></feed>