Page 1 of 1

finding a string in a global variable

Posted: Fri Aug 22, 2008 2:03 am
by Glenn Boyce
I 've put some customer data into a global variable and was hoping to use the find and get foundline functions to retrieve specific items from a "find" done on customer name. It works in a field. how do I make it work in a gVariable?

thanks, Glenn

Posted: Fri Aug 22, 2008 10:38 am
by Klaus
Hi Glenn,

you can use "offset" or "contains" (and maybe more :-))!

Code: Select all

...
if tGlobalVar contains "My string" then
  ## string is in global
end if
...
"offset" will return 0 if your string is not in the global and a number (position of the first char of your string in the global) if the global contains your string.
...
if offset("My string",tGlobalVar) <> 0 then
## string is in global
end if
...

Best

Klaus

Posted: Mon Aug 25, 2008 12:01 am
by Glenn Boyce
Hi Klaus,

Thanks for that. I need the line number of the string. Is that what is returned?

Posted: Mon Aug 25, 2008 8:45 am
by Klaus
Hi Glen,

ah, sorry, overlooked that.

Then you can use "lineoffset", which will give you the linenumber of your desired string(s).


Best

Klaus