<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic For-Loop in DIAdem</title>
    <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4074833#M27770</link>
    <description>&lt;P&gt;Hello Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a Diadem Beginner and I am currently trying to Display the numbers from 1 to 10 by using a for-loop like in the following Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Dim i&lt;BR /&gt;Sub SFD_ProcessChannel(ChannelNumberP, InputListV, ParamP, DataP, ErrorP)&lt;BR /&gt;for i = 1 to 10 &lt;BR /&gt;DataP = i&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The important thing is that i want to visualize these numbers in every step of the loop.&lt;/P&gt;
&lt;P&gt;Can someone explain to me why I get either "no value" or just the last number of the loop (10) displayed in visual?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Aug 2020 11:08:38 GMT</pubDate>
    <dc:creator>Beginner12345</dc:creator>
    <dc:date>2020-08-13T11:08:38Z</dc:date>
    <item>
      <title>For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4074833#M27770</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a Diadem Beginner and I am currently trying to Display the numbers from 1 to 10 by using a for-loop like in the following Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Dim i&lt;BR /&gt;Sub SFD_ProcessChannel(ChannelNumberP, InputListV, ParamP, DataP, ErrorP)&lt;BR /&gt;for i = 1 to 10 &lt;BR /&gt;DataP = i&lt;BR /&gt;Next&lt;BR /&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The important thing is that i want to visualize these numbers in every step of the loop.&lt;/P&gt;
&lt;P&gt;Can someone explain to me why I get either "no value" or just the last number of the loop (10) displayed in visual?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 11:08:38 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4074833#M27770</guid>
      <dc:creator>Beginner12345</dc:creator>
      <dc:date>2020-08-13T11:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075176#M27773</link>
      <description>&lt;P&gt;Hi Beginner,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To display the value in the loop. can put&amp;nbsp; logfilewrite i in loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Dim i&lt;BR /&gt;Sub SFD_ProcessChannel(ChannelNumberP, InputListV, ParamP, DataP, ErrorP)&lt;BR /&gt;&amp;nbsp; for i = 1 to 10 &lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logfilewrite i&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp; &amp;nbsp; DataP = i &lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp; Next&lt;BR /&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Paul&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you are wanting to pass parameters back in parameter. then prefix the call parameter with either byref or byval.&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Byval when passing value and do not return anything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Byref when can return/modify the value in the sub/function.&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;Sub SFD_ProcessChannel(byval ChannelNumberP, byval InputListV, byval ParamP,byref DataP, byref ErrorP)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 13:31:50 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075176#M27773</guid>
      <dc:creator>Pesmith8</dc:creator>
      <dc:date>2020-08-14T13:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075501#M27782</link>
      <description>&lt;P&gt;Hi Pesmith, thanks for your answer. Sadly the Problem is still there. Only the last value of my loop is being displayed. I have attached a PNG of the "visual-window" in Diadem to Show you my actual Problem.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 09:13:35 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075501#M27782</guid>
      <dc:creator>Beginner12345</dc:creator>
      <dc:date>2020-08-17T09:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075710#M27792</link>
      <description>&lt;P&gt;Hi Beginner12345,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is my understanding that when you run a script block in DAC, the entire script executes before the script block returns and the data flow recommences.&amp;nbsp; That would explain why in DAC/VISUAL you only ever see the last iteration of the variable.&amp;nbsp; The DAC/VISUAL automation environment is designed for data acquisition control, based on configurations defined by nodes and wires-- it's not designed to be fully automated by a scripting language.&amp;nbsp; The script block is a tool to help you expand what one node can do in DAC/VISUAL, but the execution is still determined by the data/event flow of the wires and nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps Walter Rick will comment further-- he knows more about this than I do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brad Turpin&lt;/P&gt;
&lt;P&gt;Principal Technical Support Engineer&lt;/P&gt;
&lt;P&gt;NI&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 19:23:52 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075710#M27792</guid>
      <dc:creator>Brad_Turpin</dc:creator>
      <dc:date>2020-08-17T19:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075810#M27796</link>
      <description>&lt;P&gt;Hi Brad_Turpin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for your answer. I will try to contact Walter_Rick. If you have any other ideas i would love to hear them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 05:53:42 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4075810#M27796</guid>
      <dc:creator>Beginner12345</dc:creator>
      <dc:date>2020-08-18T05:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop</title>
      <link>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4077381#M27811</link>
      <description>&lt;DIV class="lia-note-header"&gt;
&lt;DIV class="lia-note-author lia-component-author"&gt;
&lt;DIV class="lia-note-date"&gt;&lt;SPAN class="DateTime"&gt;&lt;SPAN class="local-date"&gt;08-24-2020&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="lia-note-content"&gt;
&lt;DIV class="lia-note-body-container lia-component-body"&gt;
&lt;DIV id="notebodydisplay_0" class="lia-note-body"&gt;
&lt;P&gt;Hi Beginner12345,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DAC kernel calls the function SFD_ProcessChannel and waits until it is finished. Your problem can be realized by using the output of the VBS-Block back as input and this script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dim i&lt;/P&gt;
&lt;P&gt;Sub SFD_ProcessChannel( ChannelNumberP, InputListV, ParamP, DataP, ErrorP )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataP = InputListV(0) + 1&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;Walter&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:37:28 GMT</pubDate>
      <guid>https://forums.ni.com/t5/DIAdem/For-Loop/m-p/4077381#M27811</guid>
      <dc:creator>Walter_Rick</dc:creator>
      <dc:date>2020-08-24T13:37:28Z</dc:date>
    </item>
  </channel>
</rss>

