2 Replies Latest reply on Oct 24, 2013 5:13 AM by Flavio Bonacordi

    How to create Custom Function in WorkBench

    Flavio Bonacordi


      Hi Community,

       

      I have a Script.. and I would like to convert a block of code of that inscript into a include file and use it in other scripts...

       

      How can I do that?

       

      I tried but I always get the LEX error when I do the compilation...

       

          sLocation := GetController();
          
          Substr(sLocation, sNewLocName, 1, 3);
          if sNewLocName="HOE" then
            sNewLocName:="Houston";
          elseif sNewLocName="DAL" then
            sNewLocName:="Dallas";
          elseif sNewLocName="LHD" then
            sNewLocName:="Leatherhead";
          elseif sNewLocName="SNG" then
            sNewLocName:="Singapore";
          elseif sNewLocName="CGY" then
           sNewLocName:="Calgary";
          elseif sNewLocName="CTC" then
            sNewLocName:="Curitiba";
          elseif sNewLocName="MLB" then
            sNewLocName:="Guinea Equatorial";
          else
            sNewLocName:=sLocation;
          end;  
      
      

      I would like to have a function that once called, returned the friendly name for my location based on the GETCONTROLLER() result.

       

      The code above is the one that I would like to convert to a function an call that function in other scripts...