Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substring or trim a text in coldfusion- help me

Status
Not open for further replies.

kuolung

Programmer
Sep 2, 1999
51
US
hello,

select account_manager, account_coordinator
from account
where id = 'acct04'

the result will be

account_manager account_coordinator
-------------------- ----------------------
smith,john_MGR jones,sue_COOR

what function in CF can i use to take out the trailing text _MGR and _COOR??? please help.
thanks...



 
Hey erle,

Try

#mid(account_manager,1,find("_",account_manager,1)-1)#

HTH,
PH
 
it doesn't work and this is what i have as you showed me:

<cfquery name=&quot;myquery&quot; datasource=&quot;myds&quot;>
select account_manager, account_coordinator
from account
where id = 'acct04'
</cfquery>

<cfoutput>
#mid(myquery.account_manager,1,find(&quot;_&quot;,myquery.account_manager,1)-1)#
</cfoutput>

i want to print out just &quot;smith,john&quot;, but the data in table is &quot;smith,john_MGR&quot;

please help again, thanks..
 
What results are you getting? An error? the wrong string?

What?

Post your results so we can figure it out from there.

tks,
PH
 
thank you, i got it to work now...but i have to take out the -1. thank you so much for you help.
 
how to download Oracle data into .csv format by coldfusion templates, I used <cfapplication> but i couldn't sucseeded, any one help me.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top