Quintiq file version 2.0
#parent: #root
Method PTF_ConvertDateTimeInTestScriptExecutionStringList () id:Method_LibPTF_pnlTestController_PTF_ConvertDateTimeInTestScriptExecutionStringList
{
  #keys: '[131464.1.896648259]'
  Body:
  [*
    // Convert start / end time column to selected client timezone
    originalString := lstExecutionTestScript.Strings();
    
    if( originalString <> "" )
    {
      convertedString      := construct( Strings );
      rowDelimiter         := LibPTF_Util::StringListRowDelimiter();    
      columnDelimiter      := LibPTF_Util::StringListColumnDelimiter();  
      startTimeColumnIndex := 6;
      endTimeColumnIndex   := 7
      rows                 := originalString.Tokenize( rowDelimiter );
      strNotAvailable      := "N/A";
      
      traverse( rows, Elements, row )
      {
        columns := row.Tokenize( columnDelimiter );
       
        startime            := columns.Element( startTimeColumnIndex );
        endtime             := columns.Element( endTimeColumnIndex );
         
        // only convert datetime when the string value is not empty and not "N/A"
        if( startime <> "" and startime <> strNotAvailable
            and endtime <> "" and endtime <> "N/A" )
        {            
          convertedStartTime := this.PTF_ConvertDateTimeStringToSelectedClientTimezone( startime );
          convertedEndTime   := this.PTF_ConvertDateTimeStringToSelectedClientTimezone( endtime );
          
          columns.Delete( startTimeColumnIndex, endTimeColumnIndex );        // remove columns start time and end time
          columns.AddAfter( convertedStartTime, startTimeColumnIndex - 1 );  // insert start time column
          columns.AddAfter( convertedEndTime, endTimeColumnIndex - 1 );      // insert end time column
        }
        
        convertedString.Add( columns.ToString( columnDelimiter ) );
      }
      
      lstExecutionTestScript.Strings( convertedString.ToString( rowDelimiter ) );
    }
  *]
}
