cancel
Showing results for 
Search instead for 
Did you mean: 

Using of Script controls

ksinghal
Explorer
0 Kudos

Hi Experts,

 

Currently, I am designing a Production Process where I need to use if-else conditions in Script Task but while executing it both (if condition as well as else condition ) are getting executed.

 

Below I have attached my code

 

 

var i;
for (var i=0; i<$input.LaborReport.length;i++)
{
    if( $input.FWorkCenter == $input.LaborReport[i].workCenter)
    {
        if($input.FStartTime >= $input.LaborReport[i].startTime && 
           $input.FEndTime <= $input.LaborReport[i].endTime ) 
        {
           $output.FinalUserName = $input.LaborReport[i].labor;
        }
       else if ($input.FEndDate >= $input.LaborReport[i].endDate)
       {
         $output.FinalUserName = $input.LaborReport[i].labor;
       }
    }
}

 

When I am releasing any order from Dispatching and monitoring I need to check which labor is assigned to that particular shift and I need to fetch his/her details.

P.S:-Assuming I have one labor on one shift

Shift Details:-Morning:- 08:00 AM to 14:00 PM || Afternoon:-14:00 PM to 22:00 PM || Night:- 22:00 PM to 08:00AM

Thanks & Regards

Kartik Singhal

Accepted Solutions (0)

Answers (0)