Tim,

Couldn't you just use the LJustify() function to pad the string with spaces?

Ie... #LJustify(PreviousEncounterReferenceNumber, 15)# will pad the
string with spaces to a total length of 15.

In your HTML output, if you need to display the spaces, then simply do this:

#Replace(LJustify(PreviousEncounterReferenceNumber, 15)," "," ","ALL")#

  - Rick

Claremont, Timothy wrote:

> I am using CFMX to loop through a query, manipulate each field in the
> query, display the field in a table on screen, and then append each
> manipulated field to the end of a text file. The text file is then
> handed off to a COBOL(?) file processing system run by the good old
> State of New York.
>
> The output must be in a very specific format, such as "this field must
> start at position 14 and consist of 15 characters, and be space filled"
> etc. There are NO delimiters in the desired output file.
>
> My question is, when I "fill" a field so that it contains the
> appropriate number of spaces, what should I use for a blank space? It
> appears that " " does not do the trick. It also appears that chr(32)
> works fine for screen view, but the resultant text file contains
> literally a bunch of "chr(32)".
>
> Here is a sample of my code, in this example I am assigning ' ' as my
> BlankSpaceVariable:
>
> <!--- Previous Encounter Reference Number, Position 14-28, Field Size 15
> --->
> <CFSET BlankSpaceVariable = ' '>
> <CFSET BlankSpace = (15 - #Len(PreviousEncounterReferenceNumber)#)>
>
> <cfloop index="#Len(PreviousEncounterReferenceNumber)#" from="1"
> to="#BlankSpace#">
> <CFSET #PreviousEncounterReferenceNumber# =
> '#BlankSpaceVariable#' & '#CurrentVariable#'>
> </CFLOOP>
>
> <!--- Display this part of the table on screen --->
> <td>
> <font face="Fixedsys">
> #PreviousEncounterReferenceNumber#
> </font>
> </td>
>
> <!--- Append this variable to the end of the current text file --->
> <cffile action=""> > file="C:\Inetpub\wwwroot\MEDS\MEDSPharmOutput\#OutputFile#"
> output="#PreviousEncounterReferenceNumber#"
> addnewline="No">
>
> Everything appears to be working as desired with the exception of the
> blank space assignments. What is the preferred character to indicate a
> space?
>
> TIA,
> Tim
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to