<?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 Re: Get a line of a custom code from a script in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519802#M30961</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Thank you &lt;A rel="user" href="https://answers.flexsim.com/users/215/regan.b.html" nodeid="215"&gt;@Regan Blackett&lt;/A&gt; and &lt;A rel="user" href="https://answers.flexsim.com/users/226/jason.l.html" nodeid="226"&gt;@Jason Lightfoot&lt;/A&gt; !&lt;/P&gt;
 &lt;P&gt;I was missing the .as(string) in my code. I assumed the text returned with .value was enough.&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 14 Jun 2022 16:00:42 GMT</pubDate>
    <dc:creator>sebastien_b49</dc:creator>
    <dc:date>2022-06-14T16:00:42Z</dc:date>
    <item>
      <title>Get a line of a custom code from a script</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519799#M30958</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 20.2.3 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hi !&lt;/P&gt;
 &lt;P&gt;I'd like to write an automatic documentation system in my model. I added a Dashboard with Model documentation and within a dynamic flexscript I tried to recover one line from a custom code where the documentation is written.&lt;/P&gt;
 &lt;P&gt;I could recover the entire code but I did not succeed in separating it per line. It does not seem to take it as an array or a text, as the property length is not working. Neither is slice.&lt;/P&gt;
 &lt;P&gt;Is it possible to get one or several line from the codeNode property of a Custom Code ? &lt;/P&gt;
 &lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/53443-test-doc.fsm" target="_blank"&gt;Test_Doc.fsm&lt;/A&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Jun 2022 13:16:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519799#M30958</guid>
      <dc:creator>sebastien_b49</dc:creator>
      <dc:date>2022-06-14T13:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get a line of a custom code from a script</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519800#M30959</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;You will need to recast the code node's value as a string first then you perform whatever string based operations you need to do:&lt;/P&gt;&lt;PRE&gt;string codeNodeString = model().find("/Tools/ProcessFlow/ProcessFlow/Test&amp;gt;variables/codeNode").value.as(string);&lt;/PRE&gt;&lt;P&gt;This will get the code node as a string.  Then something like this would let you get a portion of the code node as a substring:&lt;/P&gt;&lt;PRE&gt;string subString = codeNodeString.slice(codeNodeString.indexOf("Doc"));&lt;/PRE&gt;&lt;P&gt;I'm assuming the comment in your code node is what you were wanting shown on the dashboard.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Jun 2022 14:32:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519800#M30959</guid>
      <dc:creator>regan_blackett</dc:creator>
      <dc:date>2022-06-14T14:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get a line of a custom code from a script</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519801#M30960</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;To answer your questions about multiple lines - here's an example using the split function to get an array&lt;/P&gt;&lt;PRE&gt;treenode codeNode = model().find("/Tools/ProcessFlow/ProcessFlow/Test&amp;gt;variables/codeNode");
string s=codeNode.value;
Array allLines=s.split(strascii(13));
for (int n=1;n&amp;lt;=allLines.length;n++)
      pt(allLines&lt;N&gt;+"&amp;lt;br&amp;gt;");&lt;/N&gt;&lt;/PRE&gt;&lt;P&gt;You could also try replacing strascii(13) with &amp;lt;br&amp;gt; and then just print the string.&lt;/P&gt;&lt;PRE&gt;treenode codeNode = model().find("/Tools/ProcessFlow/ProcessFlow/Test&amp;gt;variables/codeNode");
string s=codeNode.value;
s=s.replace(strascii(13),"&amp;lt;br&amp;gt;",1);
print(s);&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Jun 2022 15:49:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519801#M30960</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2022-06-14T15:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get a line of a custom code from a script</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519802#M30961</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Thank you &lt;A rel="user" href="https://answers.flexsim.com/users/215/regan.b.html" nodeid="215"&gt;@Regan Blackett&lt;/A&gt; and &lt;A rel="user" href="https://answers.flexsim.com/users/226/jason.l.html" nodeid="226"&gt;@Jason Lightfoot&lt;/A&gt; !&lt;/P&gt;
 &lt;P&gt;I was missing the .as(string) in my code. I assumed the text returned with .value was enough.&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Jun 2022 16:00:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-a-line-of-a-custom-code-from-a-script/m-p/13519802#M30961</guid>
      <dc:creator>sebastien_b49</dc:creator>
      <dc:date>2022-06-14T16:00:42Z</dc:date>
    </item>
  </channel>
</rss>

