Jun 21, 2002 #1 edrossi Programmer Jan 24, 2002 42 US Is there an easy way to concatonate the following: R0 - Character field 07 - Numeric field result needed: R007 - Character field Thanks is advance for the help.....
Is there an easy way to concatonate the following: R0 - Character field 07 - Numeric field result needed: R007 - Character field Thanks is advance for the help.....
Jun 21, 2002 #2 rgbean Programmer Nov 9, 2000 5,707 US Sure. One way is to use TRANSFORM(). e.g. cX = "R0" nX = 7 cY = cX + Transform(nX, "@L 99" Rick Upvote 0 Downvote
Sure. One way is to use TRANSFORM(). e.g. cX = "R0" nX = 7 cY = cX + Transform(nX, "@L 99" Rick
Jun 21, 2002 #3 wgcs Programmer Mar 31, 2002 2,056 EC It all depends on what you ultimately want... if you are just massaging data, then do this: ALTER TABLE ADD COLUMN newField C(40) REPLACE ALL newField WITH Left(ChrFld,2)+alltrim(str(NumFld)) However, this "newField" will NOT be updated when the values in ChrFld and NumFld are changed. What is it you want to do with the "newField"? Will all future records that are added only fill in newField? Upvote 0 Downvote
It all depends on what you ultimately want... if you are just massaging data, then do this: ALTER TABLE ADD COLUMN newField C(40) REPLACE ALL newField WITH Left(ChrFld,2)+alltrim(str(NumFld)) However, this "newField" will NOT be updated when the values in ChrFld and NumFld are changed. What is it you want to do with the "newField"? Will all future records that are added only fill in newField?
Jun 21, 2002 #4 ramani Programmer Mar 15, 2001 4,336 AE HI Edrossi, ResultNeeded = ALLTRIM(charField)+ALLTRIM(STR(NumField)) Hope this helps you ramani (Subramanian.G),FoxAcc, ramani_g@yahoo.com Upvote 0 Downvote
HI Edrossi, ResultNeeded = ALLTRIM(charField)+ALLTRIM(STR(NumField)) Hope this helps you ramani (Subramanian.G),FoxAcc, ramani_g@yahoo.com
Jun 21, 2002 #5 jaa69 Programmer Nov 12, 2001 85 US Well actually that will not work. using something like this : cx = "RO" nx = 7 adding these together like cx + alltrim(str(nx)) will give you "RO7" You stated you needed to get the result "RO07" you will need to pad the numeric field with a zero "0" if the length of it is not 2 characters. if len(alltrim(str(nx)) = 1 mresults = cx + "0" + alltrim(str(nx)) else mresults = cx + alltrim(str(nx)) endif that should give you the desired result. Upvote 0 Downvote
Well actually that will not work. using something like this : cx = "RO" nx = 7 adding these together like cx + alltrim(str(nx)) will give you "RO7" You stated you needed to get the result "RO07" you will need to pad the numeric field with a zero "0" if the length of it is not 2 characters. if len(alltrim(str(nx)) = 1 mresults = cx + "0" + alltrim(str(nx)) else mresults = cx + alltrim(str(nx)) endif that should give you the desired result.
Jun 23, 2002 #6 MCTCO Programmer Jun 15, 2002 44 US TRY THIS CHARACTER+PADL(ALLTRIM(STR(NUMERICVALUE,2,0)),2,"0" Upvote 0 Downvote