Page 1 of 2
Trim Function in Modify Stage
Posted: Wed Feb 15, 2006 3:44 am
by Nageshsunkoji
Hi Folks,
In One of Ascential Provide Document I read about the following function in the Modify stage :
stringField=string_trim[character, direction, justify] (string)
In the document they wrote that the above function will trim the Leading or Trailing charcters from the String. But , when i tried above function i am getting Fatal error. can any body workaround this function, if it is true please correct me the synatx and function.
Regards
Nagesh.
Posted: Wed Feb 15, 2006 3:49 am
by ArndW
Nagesh,
could you show us what you actually entered in the modify stage? The function should work, I can recall having tried it in the past. Also you might tell us the data type and contents as well as the actual error message you received - is it a compile or a runtime error?
Posted: Wed Feb 15, 2006 4:53 am
by Nageshsunkoji
Hi Arnd,
Thank you for your reply.
I tried with the below function and i got the result now.
Empname= string_trim['0', begin, end](Empname)
Previously I tried with another round means i tried like this
Empname= string_trim['0', begin, end](Nagesh)
My undersatnding was not proper at that time, now its Ok.
Now I have one more query, is it possible to trim Leading and tariling spaces by using modify stage ? I tried by using above function, but its not trimming spaces.
Your inputs are more appreciate.
Thanks and Regards
Nagesh.
Posted: Thu Feb 16, 2006 5:43 am
by Nageshsunkoji
Hi All,
I tried to remove the Leading spaces from the string by using the following function:
Empname= string_trim[" ", begin](Empname)
I succeeded by trimming Leading spaces.
But i failed to remove tariler spaces by using following function :
Empname= string_trim[" ", end](Empname).
Could any body try out this fuction, Please let me know abt this function some more inputs.
Regards
Nagesh.
Posted: Tue Mar 07, 2006 3:20 pm
by rgandra
Hi All,
I used following function to remove Leading and Trailing spaces.
Empname= string_trim[" "](Empname)
I think this is what you are trying to know.
Thanks,
rgandra
Posted: Tue Mar 07, 2006 10:40 pm
by Nageshsunkoji
Hi Rgandra,
I tried out the function mentioned by you
Empname= string_trim[" "](Empname)
But i didn't get the proper result.
Its not removing Leading and Trailing spaces.
Regards
Nagesh.
Posted: Tue Mar 07, 2006 11:16 pm
by vmcburney
Try just the following:
Empname= string_trim(Empname)
It should trim spaces by default.
Posted: Wed Mar 08, 2006 9:36 pm
by Nageshsunkoji
Hi vmcburney
I tried the function mentioned by you
Empname= string_trim(Empname)
still i am not getting proper result. Its not removing the Trailing and leading spaces.
Regards
Nagesh.
Posted: Thu Mar 09, 2006 6:11 am
by ray.wurlod
Is EmpName a string[nn] (Char) or a string[max=nn] (VarChar) data type?
Posted: Thu Mar 09, 2006 10:14 pm
by Nageshsunkoji
ray.wurlod wrote:Is EmpName a string[nn] (Char) or a string[max=nn] (VarChar) data type?
Hi Ray,
My attribute EmpName is Char Data Type and I am generating the spaces in the Empname data by using Row Generator.
Thanks & Regards
Nagesh.
Posted: Fri Mar 10, 2006 12:05 am
by vmcburney
Try defining the output field as varchar, you might be putting it into a CHAR field.
NewEmpname varchar(255)=string_trim(Empname)
Now I remember why I never use the Modify stage.
Posted: Fri Mar 10, 2006 6:22 am
by ray.wurlod
Don't forget the colon.
NewEmpname: nullable varchar(255)=string_trim(Empname)
Posted: Tue Nov 28, 2006 1:00 pm
by ajith
ray.wurlod wrote:Don't forget the colon.
NewEmpname: nullable varchar(255)=string_trim(Empname)
When you use "nullable varchar" instead of "nullable string" it gives out an error.Error parsing modify adapter: Error in binding: Could not find type: "varchar"
I searched all the threads tried all the functions, but I did not see anything like trimleadingtrailing. I dont think that can be done in modify stage.
Anybody any new idea????
Posted: Tue Nov 28, 2006 1:25 pm
by ray.wurlod
My error. Should have been:
Code: Select all
NewEmpname: nullable string[max=255]=string_trim[" "](Empname)
The default trimmable character is APT_STRING_PADCHAR which, unless you've changed it, is Char(0), not space.
Posted: Tue Nov 28, 2006 11:05 pm
by ajith
ray.wurlod wrote:My error. Should have been:
Code: Select all
NewEmpname: nullable string[max=255]=string_trim[" "](Empname)
The default trimmable character is APT_STRING_PADCHAR ...
I tried that too,
It is trimming only the trailing spaces not the leading ones.
I seriously don't know what to do now, I have to do Trimming on 3 source feeds. I hate modify stage, it allows me to do nothing. Dont tell me the only way forward is adding 3 transformer stages.