Create a field of spaces

 3 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
FireGeek21
Veteran Member
Posts: 84
Veteran Member

    I am using process flow to build a fixed field .txt file.  Several of the fields require a specific number of spaces because no value is being passed.  In SQL it is quite easy to use space(10) for a field with 10 spaces.  How can I do this in an Assign node maybe with javascript?  I have tried the addtrailingspaces(" ", 10  but the spaces appear as %20%20%20...  instead of true spaces.  Using "      " is out of the question because the header and trailer require over 2,000 spaces each.

    Thanks for the help!

    Ragu Raghavan
    Veteran Member
    Posts: 475
    Veteran Member
      isn't there a 3rd parameter? Try setting that to null. addTrailingSpaces(" ",10,"")
      Kyle Jorgensen
      Veteran Member
      Posts: 122
      Veteran Member
        Straight from the pflow.js file:

        /************************************************************
            Function: addTrailingSpaces(String varValue, int finalLenthOfVarValue, isSpaceEscaped)
            
            Purpose:  returns the String with trailing space escape chars
            to be used while attaching a variable in form URL. Can also
            be used to add actual space characters instead of the escaped
            space char by passing false for the argument isSpaceEscaped.
            If the 3rd argument is not passed at all, space will be escaped
            and then added.
        ************************************************************/
        function addTrailingSpaces(varString, finalLengthOfVarString, isSpaceEscaped)
        {
            var retVal = ""
                var currLengthOfVarValue = varString.length;
            var leadingSpacesLength = finalLengthOfVarString - currLengthOfVarValue;
            var leadingSpacesStr = "";
            var spaceChar = "%20";
            if(isSpaceEscaped==undefined) isSpaceEscaped = true;
            if(!isSpaceEscaped)
                spaceChar = " ";
            for (var i=0;i
        FireGeek21
        Veteran Member
        Posts: 84
        Veteran Member
          Ah, yes there is a 3rd parameter! Thanks. It helps to keep scrolling to the right to see all of the parameters. So simple! THANK YOU!!!