Field(Orders.RecIn,"","",2) = RecType
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The Field() function may have three or four arguments, Arnd. The fourth is number of fields to return.
However, I do not believe that the third argument for Field() can legally be a string; it must be an integer. Therefore, assuming that you've read the entire source record (RecIn) as a VarChar and want to return the second comma-delimited field from it, the correct specification isor more simply
However, I do not believe that the third argument for Field() can legally be a string; it must be an integer. Therefore, assuming that you've read the entire source record (RecIn) as a VarChar and want to return the second comma-delimited field from it, the correct specification is
Code: Select all
Field(InLink.RecIn, ",", 2, 1)
Code: Select all
Field(InLink.RecIn, ",", 2)
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.
Did not work
Thank you all for the info. But still the result is the same
Yes read the entire source record (RecIn) as a VarChar and want to return the A, second comma-delimited field from it.
When Field(InLink.RecIn, ",", 2, 1) is used it's pulling only
"
"
"
"
"
"
and with Field(InLink.RecIn, ",", 2) job is getting aborted with
the previous messages.
Yes read the entire source record (RecIn) as a VarChar and want to return the A, second comma-delimited field from it.
When Field(InLink.RecIn, ",", 2, 1) is used it's pulling only
"
"
"
"
"
"
and with Field(InLink.RecIn, ",", 2) job is getting aborted with
the previous messages.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You need to reduce the string so that it can fit into Char(1). Since you're reading the entire line as a single string, the Field() function is returning the quote characters as well as the quoted value. Therefore you also need to Trim() the quote characters from the result of the Field() function.
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.
-
- Premium Member
- Posts: 783
- Joined: Mon Jan 16, 2006 10:17 pm
- Location: Sydney, Australia
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The fact (already stated) that the entire record has been read as a single string, presumably because the file contains more than one record type. Note the name of the field that is being attempted to be extracted.
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.
I shouldn't have tried that without having a BASIC to check; for some reason I thought that PX didn't allow the 4th arg. But the arguments were incorrectly ordered as well in the OP.ray.wurlod wrote:The Field() function may have three or four arguments, Arnd. The fourth is number of fields to return.
After removing the quotes in the source it worked
After removing the quotes in the source and retyping the derivation (Field(InLink.RecIn, ",", 2) it worked.
Thank you all.
Thank you all.