Results 1 to 6 of 6

Thread: How to Left Justify Data, pad with spaces on right.

  1. #1
    Member
    Real Name
    Mark Spearman
    Join Date
    Jul 2009
    Posts
    20

    Default How to Left Justify Data, pad with spaces on right.

    I want to left justify data and fill the left with spaces. For example, if the input is only "AA" in a character field that is 10 long, I want the field to hold the value "AA ".

    Any help appreciated. This should be common, but I'm not finding anything on a search of the forum or the help files.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    22,766

    Default Re: How to Left Justify Data, pad with spaces on right.

    Did you mean "fill the left with spaces" or "fill the right with spaces"?


    If you have a table field defined as character, ten places, the contents will by nature be left justified padded to the right to the length of the field with spaces, in an Alpha dbf. You can't store just "AA " in a ten place field.
    If you're the smartest person in the room, you're in the wrong room.

  3. #3
    Member
    Real Name
    Mark Spearman
    Join Date
    Jul 2009
    Posts
    20

    Default Re: How to Left Justify Data, pad with spaces on right.

    Wow, I really worded that poorly. My apologies.

    Simply put, I need to know how to format at field for left justification with spaces padding the right.

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    22,766

    Default Re: How to Left Justify Data, pad with spaces on right.

    I'm not understanding, sorry.

    Character table fields by definition are left justified and filled to the right with spaces. If you have a numeric field you can

    Code:
    test = 12345
    ? str(test)
    = "     12345"
    
    ? padr(alltrim(str(test)),10," ")
    = "12345     "
    If say a label for a field is right justified and you want it left justified, edit the display properties.

    (Speaking for desktop items.)
    Attached Images Attached Images
    If you're the smartest person in the room, you're in the wrong room.

  5. #5
    Member
    Real Name
    Mark Spearman
    Join Date
    Jul 2009
    Posts
    20

    Default Re: How to Left Justify Data, pad with spaces on right.

    That's exactly what I was trying to do. Thank you so much.

    The documentation for padr confused me when I tried it before. I'm new to Alpha 5 and not used to their docs yet.

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    22,766

    Default Re: How to Left Justify Data, pad with spaces on right.

    Glad to help. Remember to illustrate your issue as closely to the actual problem as possible.

    The use of "AA " as an example confused me.
    If you're the smartest person in the room, you're in the wrong room.

Similar Threads

  1. Signature Pad
    By Tom Henkel in forum Alpha Five Version 8
    Replies: 7
    Last Post: 05-13-2011, 10:35 AM
  2. pad field on data entry
    By dcorcoran in forum Alpha Five Version 6
    Replies: 11
    Last Post: 04-19-2005, 08:53 PM
  3. New user - Right justify or 0 pad field?
    By michaelklein in forum Alpha Five Version 5
    Replies: 13
    Last Post: 09-18-2003, 05:41 AM
  4. XDialog Justify
    By Scott Emerick in forum Alpha Five Version 5
    Replies: 9
    Last Post: 05-26-2003, 07:04 PM
  5. Right Justify
    By nick marodis in forum Alpha Five Version 4
    Replies: 1
    Last Post: 04-24-2000, 05:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •