| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetParameterAsDuration (String channelName_i, String parameterName_i, output Strings feedbacks_o) declarative as Duration | 
| { | 
|   Description: 'Get a parameter value as a duration' | 
|   TextBody: | 
|   [* | 
|     // Jacky C Oct-6-2015 (created) | 
|     type  := "Duration"; | 
|     value := Duration::MinDuration(); | 
|     row   := this.GetParameterValue( channelName_i, parameterName_i, type ); | 
|      | 
|     if( not isnull( row ) ) | 
|     { | 
|       valueInKT := row.ParameterValue(); | 
|       converter := StringToDuration::StandardConverter(); | 
|      | 
|       if( converter.CanConvert( valueInKT ) ) | 
|       { | 
|         value := converter.Convert( valueInKT ); | 
|       } | 
|       else | 
|       { | 
|         // register the parameter name as invalid (conversion error) | 
|         feedback   := this.CommunicationChannel().GetCommunicationChannelRoot().GetTranslation( 'DM_ChannelParameters_ConversionError' ); | 
|         feedbacks_o.Add( this.ConstructInvalidParameter( channelName_i, parameterName_i, feedback ) ); | 
|       } | 
|     } | 
|     else | 
|     { | 
|       // register the parameter name as invalid (not found) | 
|       feedback   := this.CommunicationChannel().GetCommunicationChannelRoot().GetTranslation( 'DM_ChannelParameters_NotFound' ); | 
|       feedbacks_o.Add( this.ConstructInvalidParameter( channelName_i, parameterName_i, feedback ) ); | 
|     } | 
|      | 
|     return value; | 
|   *] | 
| } |