Page 1 of 1

offset problem

Posted: Wed Jul 30, 2014 3:23 pm
by Rob van der Sloot
I want to retrieve some lines from a field

so I made a button saying:

on mouseUp
lineOffset ("zen", field "CompanyFindTotal")
end mouseUp

where "zen" is a string in one of the lines of the field "CompanyFindTotal"

This is totally in accord with the dictionary, from where I copied this

yet I get the message:

execution error at line 2 (Handler: can't find handler) near "lineOffset", char 1

I don't understand this

please help me out.

Thanks

Rob van der Sloot

Re: offset problem

Posted: Wed Jul 30, 2014 3:51 pm
by FourthWorld
Lineoffset is a function; it returns a value but is not a command. So you'll need a command there to tell LC what you want to do with that value.

For example, if you want to put the value into another field:
put lineoffset("zen", field "CompanyFindTotal") into fld "FoundStuff"

Re: offset problem

Posted: Wed Jul 30, 2014 8:34 pm
by Rob van der Sloot
Thanks, I already found my problem in this setup. I used the lineoffset in a field with tabs, like records, and therfore did not work.
I also found that in the lineOffset function, the lineToFind must be an expression, and I want to use a variable there, which is therefore also not working.
So how do I find the linenumber in a field by using a variable. I changed my script into:

put lineOffset (tFind, field "Find") into field "SelectedLine".

But the result is 0.
I searched in the lessons page, but no answer there.
What I actualy want to do is put some text in a field. Then by closing the field I want do a find in another field.
The line where the searchstring is in I want to get the line number, so that I can present that whole line in a datagrid. The script for that was like this:

on closeField
local tFind
put quote & me & quote into tFind
put lineOffset (tFind, field "Find") into field "SelectedLine"
end closeField

But it does not work, so how to work this out.


Thanks

Rob