<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Array finding the total of index</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/91cbad911d/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/91cbad911d/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/91cbad911d/</id><updated>2023-02-13T10:11:04.886000Z</updated><subtitle>Recent posts to Array finding the total of index</subtitle><entry><title>Array finding the total of index</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/91cbad911d/?limit=25#125c" rel="alternate"/><published>2023-02-13T10:11:04.886000Z</published><updated>2023-02-13T10:11:04.886000Z</updated><author><name>oguzemretombul</name><uri>https://forge.codesys.com/u/oguzemretombul/</uri></author><id>https://forge.codesys.com06878807f94409ad15d0960f127c00c96e113589</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You can not define dynamic size array in codesys. I guess you have an array with static length but you want to now how many elements is not empty. &lt;br/&gt;
for example you have ' StringArrayVar : ARRAY &lt;span&gt;[1..100]&lt;/span&gt; OF STRING ' . you can find like that how many elements is not empty;&lt;/p&gt;
&lt;p&gt;var &lt;/p&gt;
&lt;p&gt;StringArrayVar : ARRAY &lt;span&gt;[1..100]&lt;/span&gt; OF STRING  ;&lt;br/&gt;
i: byte ; &lt;br/&gt;
TotalIndex : Byte ;&lt;/p&gt;
&lt;p&gt;end_var&lt;/p&gt;
&lt;p&gt;TotalIndex := 0 ;&lt;br/&gt;
FOR i:=1 TO 100 DO&lt;br/&gt;
IF StringArrayVar&lt;span&gt;[i]&lt;/span&gt; &amp;lt;&amp;gt; '' THEN TotalIndex := TotalIndex + 1 ; END_IF&lt;br/&gt;
END_FOR&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array finding the total of index</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/91cbad911d/?limit=25#fb2d" rel="alternate"/><published>2022-11-25T14:03:24.022000Z</published><updated>2022-11-25T14:03:24.022000Z</updated><author><name>dumbass</name><uri>https://forge.codesys.com/u/dumbass/</uri></author><id>https://forge.codesys.comba75152dd392beed8332d07320091c416c0757d0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, &lt;/p&gt;
&lt;p&gt;I have an array of String but I do not know how many elements in it. If the user put 3 elements in the array then the total of index = 3. How can I scan all the elements array if it is not equal to '' (&lt;em&gt;meaning NULL&lt;/em&gt;) and get the total of index in the array? &lt;br/&gt;
Thank you in advance&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>