This is a long shot, but if you are pulling your from Oracle or another DB
that allows the LPAD/RPAD functions, you could pad it on the query instead
of having to loop through it.  In fact, I often, when putting values like
this together in select statements, do all of the concatenation in the
query.  Is this faster/slower?  I don't know.  It just turns out nicer,
easier-to-handle values.


If your columns are part number, dimensions, and cost, your query might look
like this:


SELECT LPAD(INV_PartNo,5), LPAD(INV_Height,4), LPAD(INV_Width,4),
LPAD(INV_Depth,4), LPAD(INV_Cost,7)
FROM INVENTORY


RPAD just pads on the right instead.  If you want to pad with something
other than spaces, add it as a single-quote delimited third parameter to the
function.  For example:


LPAD('dog',7,'R') returns RRRRdog.


HTH,
Matthieu

-----Original Message-----
From: Rick Mason [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 11:06 AM
To: CF-Talk
Subject: OT: Order in multi-column select box

I've had to build a select box with five columns for a current
project.  How can I keep the columns in straight lines and not
displayed every which way?

I looked at some past code and I don't think I have ever done a select
with more than two columns displayed.  It cries out for a table but I
can't do a table inside a select statement.

Short of looping through each column and adding enough spaces to make
them all equal to the largest record in the column I can't think of a
better way.  Is there an easier method that I am missing?

Rick Mason
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to