AnsweredAssumed Answered

Remove the Dash in result

Question asked by thong127 on Jan 2, 2014
Latest reply on Jan 6, 2014 by thong127

Title

Remove the Dash in result

Post

     Happy new year to all!
      
     Can you please help me how to remove the dash in the result of the below function that I copied from the other forum
      
     Please find link of the file.
      
      
     Thank you.
      
     thong
      
      
     /* 
     MonthlySerial custom function 
      
     Author: Daniele Raybaudi 
      
     Format: MonthlySerial ( AEfield ; digit ) 
      
     Result: text 
      
     parameters: 
     AEfield: text - the text field wich will hold the serial number; it must be setted as auto-enter, always evaluate 
     digit: number - the number of digit (#) that must increment by one and restart from one every new month 
      
     This custom function can be used for: 
      
     1) Autoenter a serial number that increments monthly 
     2) the format of the serial number is essentially: YY-MM### 
     3) the serial number may have how many digits (#) you choosed 
      
     The Auto-Enter field must be setted to always evaluate; 
     the custom function isn't recursive, so you can use it as a simple calc; 
     the custom function will work only with FMP8 and above. 
      
      
     05/23/2006 
      
     */ 
     Let([ 
     year = Right ( "00" & Year ( Get ( CurrentDate ) ); 2 );
     month = Right ( "00" & Month ( Get ( CurrentDate ) ); 2 ); 
     lastId =GetNthRecord (AEfield; Get ( TotalRecordCount ) - 1); 
     lastMonth = Middle ( lastId; 4 ; 2 )    
     ]; 
     year & "-" & month
     & 
     Case( 
     month   ≠   lastMonth  or Right ( lastId ; digit ) = 10^digit -1; Right ( 10^digit  ; digit-1 ) & "1"; 
     SerialIncrement ( Right ( lastId ; digit ) ; 1 ) 
     ) 
     )

Outcomes