learner
26th May 2003, 10:16
Hi,

Let's say i have a table field having a value tdcus015.field="baanboard", now i want to extract characters from 5th to 8 in my variable , that means it should give me result as var = "boar"

how can i achieve it, the type of field is string, also let me know how can i do it if this field would have been of type long ?

Waiting for your replies Gurus

NvanBeest
26th May 2003, 10:45
If you know the exact position you want to grab, use the substring functionality provided by Baan: tdcus015.field(5;4)

As for a long: what do you want to extract? It is a binary value! If you need to extract characters from it, you will first have to convert it to a string, and then use the subscripting technique again.

Regards,
Nico

learner
26th May 2003, 13:34
Well as soon i posted this post , it ried it myself also & was able to figure out. initially i was doing tdcus015.field(2:4)

which was having syntax related problem, anyway what if if this field would have a binary value such as tdcus015.field = 123456

so in this case also i would first take this field in a string by using str$ function and then do string_var( 2;4) & that will solve my problem and if in case i need to do some calculations with this variable let's say 2 * string_var, then i have to first convert this srting back into integer using lval() function , & then do the calculation.

Am i right?

Regards

Learner

evesely
27th May 2003, 15:47
You've got it! :D

arunkw
20th July 2004, 13:09
I need to determine if a substring occurs in a string say I want to know if substring "board" is present in the string "baanboard" additionally I don't know the position at which my substring will occur or end.

Hitesh Shah
20th July 2004, 15:34
pos and rpos fucntions should help u.

tomlbacon
20th July 2004, 18:38
you could also do a (field) like ".*board.*" which uses the ".*" as wildcard and will bring in all records with board in it.

Hitesh Shah
21st July 2004, 08:53
Like would work only in SQL query . In order to us wild cards use 'In' operator. U can see it's help under 'expr.compile' function.