Trim Function in Modify Stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
Trim Function in Modify Stage
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.
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.
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
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?
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?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
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.
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.
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
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.
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.
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Try just the following:
Empname= string_trim(Empname)
It should trim spaces by default.
Empname= string_trim(Empname)
It should trim spaces by default.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
Hi Ray,ray.wurlod wrote:Is EmpName a string[nn] (Char) or a string[max=nn] (VarChar) data type?
My attribute EmpName is Char Data Type and I am generating the spaces in the Empname data by using Row Generator.
Thanks & Regards
Nagesh.
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
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.
NewEmpname varchar(255)=string_trim(Empname)
Now I remember why I never use the Modify stage.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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"ray.wurlod wrote:Don't forget the colon.
NewEmpname: nullable varchar(255)=string_trim(Empname)
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????
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
My error. Should have been:
The default trimmable character is APT_STRING_PADCHAR which, unless you've changed it, is Char(0), not space.
Code: Select all
NewEmpname: nullable string[max=255]=string_trim[" "](Empname)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod wrote:My error. Should have been:The default trimmable character is APT_STRING_PADCHAR ...Code: Select all
NewEmpname: nullable string[max=255]=string_trim[" "](Empname)
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.