Thanks for the suggestions.  See below:
Some options:

1. If left() and substring() failed, try mid() or substr().  Not sure
about these.

Mid() and substr() errored as well.

2. If this QoQ originated from a database query, can you select the
first n characters in the SELECT statement?  What if you SELECT the
field twice:

SELECT myCol, SUBSTRING(myCol, 1, 4) AS myColShort ...

In my environment we have multiple display layers (CF, Java, Power
Builder) being served by the same SQL server 2000 DB.  It is not as easy
to modify a stored proc used in many different places.  We try to use
the database for returning data, and do any formatting in the data layer
or display layer.

3. Use left() when outputting.

This would require me to be iterating over the result set.  This query
is being returned via flash remoting and a list object which I am
binding to the dataProvider property of a cfselect.  The flash redraw is
handling all output and there is no chance to play with the data once it
gets that far.

4. If one of these work, you may just need to loop over the query as an
array.

Yeah, this is what I ended up doing.
        <cfif len(trim(max_display_wdith))>
                <cfloop query="qry_sub_accounts">
                        <cfset
qry_sub_accounts['bank_account_sub_setup_name'][currentrow] =
left(qry_sub_accounts['bank_account_sub_setup_name'][currentrow],#max_di
splay_wdith#)>
                </cfloop>
        </cfif>

Thanks again for your help!

M!ke 

-----Original Message-----
From: Brad Wood [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 24, 2006 10:47 AM
To: CF-Talk
Subject: substring in q of q

When performing a query of query, is there a supported syntax for doing
a left() or substring()?  I wanted to trim down a display column to a
certain number of characters.  Left and substring both returned errors.
I was hoping to not have to do a cfloop over the result set and left()
them all that way-- seems more trouble than if I can get cfquery to
perform the string manipulations for me.

Thanks.

~Brad






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230336
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to