lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Quintiq file version 2.0
#parent: #root
Method TryReadLast (const LibOpt_Task task, output String message_o) const as Boolean
{
  Description:
  [*
    Try to read the last message.
    If there is no message, the method will return `false`, if there is a message, the method will return `true` and the message is outputted in the message_o output parameter.
  *]
  TextBody:
  [*
    id := this.Channel().GetAlgorithmStoreID( task, false );
    algorithm := this.Channel().GetAlgorithm( id );
    
    count := RealToNumber::ISOConverter().Convert( algorithm.RetrieveReal( LibOpt_Channel::Algorithm_Count() ) );
    
    result := count > 0;
    
    if( result )
    {
      message_o := algorithm.RetrieveString( LibOpt_Channel::Algorithm_Index( count - 1 ) )
    }
    
    AlgorithmStore::Store( id, & algorithm );
    
    return result;
  *]
}