Hello
I have a requirement where i have a string like
A%%%AB%%%DF%%%CE%%%XE%%%AF
i want to get the each string which is delimited by %%%.
I used Field function but it is not giving me the required result.
below are the expecte dresults
Field (InputString,'%%%',1)=A
Field (InputString,'%%%',2)=AB
Field (InputString,'%%%',3)=DF
Field (InputString,'%%%',4)=CE
........
Field (InputString,'%%%',6)=AF
Please help me out
Thanks
Field function
Moderators: chulett, rschirm, roy
hello nani
i will be getting a string i.e A%%%AB%%%DF%%%CE%%%XE%%%AF in of the fields from the input sequrntial File. I need to read that string and get the values which ar edelimited by %%%
i.e InputString=A%%%AB%%%DF%%%CE%%%XE%%%AF
outstring1=A
outstiring2=AB
outstiring3=DF
outstiring4=CE
outstiring5=XE
outstiring6=AF
I tried field function its not working. please help me
Thanks
i will be getting a string i.e A%%%AB%%%DF%%%CE%%%XE%%%AF in of the fields from the input sequrntial File. I need to read that string and get the values which ar edelimited by %%%
i.e InputString=A%%%AB%%%DF%%%CE%%%XE%%%AF
outstring1=A
outstiring2=AB
outstiring3=DF
outstiring4=CE
outstiring5=XE
outstiring6=AF
I tried field function its not working. please help me
Thanks
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
The documentation of field function says:
If '%' will not be present in data itself you can use field function after the followin conversion:
which will replace %%% with %, then your logic will work.
If '%' can be present in data itself you need to replace '%%%' with some strange characters like fieldmarks,value marks, char(10) or something similar. then you need to apply field function.
You may need to use PXEreplace posted by DSGuru2B quite a while ago to do the same.
Hence it seems like your logic will not work in this case.delimiter evaluates to any character, including field mark, value mark, and subvalue marks. It delimits the start and end of the substring. If delimiter evaluates to more than one character, only the first character is used.
If '%' will not be present in data itself you can use field function after the followin conversion:
Code: Select all
Trim(DSLink.InputColumn,"%","R")
If '%' can be present in data itself you need to replace '%%%' with some strange characters like fieldmarks,value marks, char(10) or something similar. then you need to apply field function.
You may need to use PXEreplace posted by DSGuru2B quite a while ago to do the same.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.
The Field() delimiter must be a single character. So either convert all of the occurances of "%%%" down to a single "%" or offset the "field" that you ask for:
In other words, 1 gets field 1, 2 gets field 4, 3 gets field 7, etc.
Code: Select all
FieldNumber = PositionNumber * 3 - 2
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers