<?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: Process timeValues By Case and Different Time for Nth Item in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531323#M40138</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Mostly you just have to delete unneeded parts of the code and slightly alter the final to lines.&lt;/P&gt;&lt;P&gt;I would start by removing the markup (light grey text). It is used to create the GUI in the processor's properties, which won't work when you combine the options anyway. You can do this with the button in the lower of the code editor window. This will mark the code as "Custom Code" in the first line.&lt;span class="lia-inline-image-display-wrapper" image-alt="1673005186022.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1514740i37817AD42EE1875B/image-size/large?v=v2&amp;amp;px=999" role="button" title="1673005186022.png" alt="1673005186022.png" /&gt;&lt;/span&gt;Then you delete the first "return", since you don't want to immediately return the value from the "Values by Case" code, but rather check whether it needs to be modified further. Also remove the duplicate declarations of "current" and "item".&lt;/P&gt;&lt;P&gt;You then just need to edit the final to lines to either return the "retValue" (determined by "Values by Case") or that value plus 4.&lt;/P&gt;&lt;PRE&gt;/**Custom Code*/
Object current = ownerobject(c);
Object item = param(1);

Variant value = item.Type;
double retValue = 30;
if (value == 1){ retValue = 34;}
if (value == 2){ retValue = 38;}

int cnt = 8;

if (fmod(getinput(current),cnt) == 0)
&amp;nbsp;return retValue + 4;
else return retValue;&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Jan 2023 11:43:34 GMT</pubDate>
    <dc:creator>moehlmann_fe</dc:creator>
    <dc:date>2023-01-06T11:43:34Z</dc:date>
    <item>
      <title>Process timeValues By Case and Different Time for Nth Item</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531322#M40137</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 23.0.1 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;I'm in the situation where I have a process, where there are manufactured 3 products; A, B and C.&lt;/P&gt;
 &lt;P&gt;Process times (sec) are as so far:&lt;/P&gt;
 &lt;P&gt;A = 30&lt;/P&gt;
 &lt;P&gt;B = 34&lt;/P&gt;
 &lt;P&gt;C = 38&lt;/P&gt;
 &lt;P&gt;Furthermore, during the manufacturing process, we have quality checks and clean-up of the manufacturing equipment, which is conducted every 8th product. It adds 4 seconds to each product process time.&lt;/P&gt;
 &lt;P&gt;The default code within Flexsim are as follows and I simply want to combine them into one code:&lt;/P&gt;
 &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Code for Values By Case&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
 &lt;P&gt;Object current = ownerobject(c);&lt;/P&gt;
 &lt;P&gt;Object item = param(1);&lt;/P&gt;
 &lt;P&gt;/***popup:ValuesByCaseLabel:valuestr=Time:doreturn=1*/&lt;/P&gt;
 &lt;P&gt;/**Values By Case*/&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;Variant value = /** \nCase Function: *//***tag:ValueFunc*//**/item.Type/**/;&lt;/P&gt;
 &lt;P&gt;/** \nCases:\n*/&lt;/P&gt;
 &lt;P&gt;double retValue = /**\nDefault Port:*//***tag:default*//**/30/**/;&lt;/P&gt;
 &lt;P&gt;/***tagex:data*/&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;if (value == /**\nCase: *//**/1/**/){ retValue = /** Time: *//**/34/**/;}&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;if (value == /**\nCase: *//**/2/**/){ retValue = /** Time: *//**/38/**/;}/***//**/ /**/&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;return retValue/**/;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Code for Different Time for Nth Item&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
 &lt;P&gt;Object current = ownerobject(c);&lt;/P&gt;
 &lt;P&gt;Object item = param(1);&lt;/P&gt;
 &lt;P&gt;/***popup:NthItem*/&lt;/P&gt;
 &lt;P&gt;/**Different Time for Nth Item*/&lt;/P&gt;
 &lt;P&gt;int cnt = /**\nN: *//***tag:count*//**/8/**/;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;if (fmod(getinput(current),cnt) == 0)&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;return /**\nTime for Nth item: *//***tag:time_nth*//**/34/**/;&lt;/P&gt;
 &lt;P&gt;else return /**\nTime for all others: *//***tag:time_others*//**/30/**/;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;STRONG&gt;Can anyone assist or propose a solution to this problem&lt;/STRONG&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jan 2023 11:09:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531322#M40137</guid>
      <dc:creator>NANconsultant</dc:creator>
      <dc:date>2023-01-06T11:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Process timeValues By Case and Different Time for Nth Item</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531323#M40138</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Mostly you just have to delete unneeded parts of the code and slightly alter the final to lines.&lt;/P&gt;&lt;P&gt;I would start by removing the markup (light grey text). It is used to create the GUI in the processor's properties, which won't work when you combine the options anyway. You can do this with the button in the lower of the code editor window. This will mark the code as "Custom Code" in the first line.&lt;span class="lia-inline-image-display-wrapper" image-alt="1673005186022.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1514740i37817AD42EE1875B/image-size/large?v=v2&amp;amp;px=999" role="button" title="1673005186022.png" alt="1673005186022.png" /&gt;&lt;/span&gt;Then you delete the first "return", since you don't want to immediately return the value from the "Values by Case" code, but rather check whether it needs to be modified further. Also remove the duplicate declarations of "current" and "item".&lt;/P&gt;&lt;P&gt;You then just need to edit the final to lines to either return the "retValue" (determined by "Values by Case") or that value plus 4.&lt;/P&gt;&lt;PRE&gt;/**Custom Code*/
Object current = ownerobject(c);
Object item = param(1);

Variant value = item.Type;
double retValue = 30;
if (value == 1){ retValue = 34;}
if (value == 2){ retValue = 38;}

int cnt = 8;

if (fmod(getinput(current),cnt) == 0)
&amp;nbsp;return retValue + 4;
else return retValue;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jan 2023 11:43:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531323#M40138</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2023-01-06T11:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Process timeValues By Case and Different Time for Nth Item</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531324#M40139</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Hi Felix,
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;Thank you for the quick response, the answer works, thanks! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jan 2023 12:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/process-timevalues-by-case-and-different-time-for-nth-item/m-p/13531324#M40139</guid>
      <dc:creator>NANconsultant</dc:creator>
      <dc:date>2023-01-06T12:29:50Z</dc:date>
    </item>
  </channel>
</rss>

