Today’s functoid is one which I’ve created in the past for several clients working
with BizTalk 2004 and flat files, especially position files.  Often you will
encounter a situation where the disassembler will give you a value of ”        
.  In BTS 2006 you have the option of setting a fill character that
is ignored by the disassembler, but on ’04 you’ve got to deal with this in the map.

The premise then in simple, to avoid the common pattern of a Trim -> Size ->
Greater Than -> Value Mapping we roll up the first three of these into this single
functoid.  The code is presented below, and you can follow the link to the source
code download.

Download
TimRayburn.CustomFunctoids v1.0

    9     class TrimmedValueExistsFunctoid : BaseFunctoid
   10    
{
   11     
   public TrimmedValueExistsFunctoid(): base()
   12     
   {
   13     
       // Assign a "unique" id
to this functiod
   14     
       this.ID = 24603;
   15 
   16     
       // Setup the resource assembly
to use.
   17     
       SetupResourceAssembly(
   18     
          "TimRayburn.CustomFunctoids.CustomFunctoidsResources",
   19     
          Assembly.GetExecutingAssembly());
   20 
   21     
       SetName("IDS_TRIMMEDVALUEEXISTSFUNCTOID_NAME");
   22     
       SetTooltip("IDS_TRIMMEDVALUEEXISTSFUNCTOID_TOOLTIP");
   23     
       SetDescription("IDS_TRIMMEDVALUEEXISTSFUNCTOID_DESCRIPTION");
   24     
       SetBitmap("IDB_TRIMMEDVALUEEXISTSFUNCTOID_BITMAP");
   25 
   26     
       this.SetMinParams(1);
   27     
       this.SetMaxParams(1);
   28 
   29     
       SetExternalFunctionName(this.GetType().Assembly.FullName,
   30     
          "TimRayburn.CustomFunctoids.TrimmedValueExistsFunctoid",
   31     
          "TrimmedValueExists");
   32 
   33     
       this.Category = FunctoidCategory.Logical;
   34     
       this.OutputConnectionType
= ConnectionType.AllExceptRecord;
   35 
   36     
       AddInputConnectionType(ConnectionType.AllExceptRecord);
   37     
   }
   38     
   public string TrimmedValueExists(string inputVal)
   39     
   {
   40     
       if (inputVal.Length.Equals(0))
   41     
          return "true";
   42     
       else
   43     
       {
   44     
          string trimmedVal
= inputVal.Trim();
   45     
          if (trimmedVal.Length.Equals(0))
   46     
               return "true";
   47     
          else
   48     
               return "false";
   49     
       }
   50     
   }
   51    
}