lineoffset not playing nicely with 'null' entry
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 20
- Joined: Mon Apr 18, 2016 10:31 am
lineoffset not playing nicely with 'null' entry
I'm trying to use lineoffset to return the correct line from a variable, but if the first entry is 'null' I'm unable to match to the second entry no matter what it contains. All other entries behave as expected. Is this a bug, or am I missing something?
Sample variable below (quotes added to highlight null entry)
""
"Dr"
"Mr"
"Mrs"
lineoffset("Mr",tVar) = 3
lineoffset("Dr",tVar) = 1 !
Sample variable below (quotes added to highlight null entry)
""
"Dr"
"Mr"
"Mrs"
lineoffset("Mr",tVar) = 3
lineoffset("Dr",tVar) = 1 !
Re: lineoffset not playing nicely with 'null' entry
Hi Jon,
what version of LC are you using? Just made a test on my Mac with LC 8.01 and got:
lineoffset("Mr",tVar) = 3
lineoffset("Dr",tVar) = 2 !
as exspected!?
Best
Klaus
what version of LC are you using? Just made a test on my Mac with LC 8.01 and got:
lineoffset("Mr",tVar) = 3
lineoffset("Dr",tVar) = 2 !
as exspected!?
Best
Klaus
Re: lineoffset not playing nicely with 'null' entry
Hi,
tested on Win, 6.7.10:
Works. Besides that this doesn't find line 1 ;-)
Have fun!
tested on Win, 6.7.10:
Code: Select all
on mouseUp
put empty & cr & "Dr" & cr & "Mr" & cr & "Mrs" into MyVar
ask "What?"
put lineoffset(it,MyVar)
end mouseUp
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: lineoffset not playing nicely with 'null' entry
Hi.
Not sure what you mean by
Craig Newman
Not sure what you mean by
Did you mean that you cannot FIND empty? If so, even though line 1 is empty, you are correct, and the function will return 0.Besides that this doesn't find line 1
Craig Newman
-
- Posts: 20
- Joined: Mon Apr 18, 2016 10:31 am
Re: lineoffset not playing nicely with 'null' entry
Looks like this was a case of LiveCode doing odd things after being open a few days. I've since rebooted my PC and there no longer appears to be a problem with a null entry in the array.
Thanks to all for your input.
As an aside, I also had 4 fields in a datagrid that I could not edit the values of. I eventually deleted the offending fields and recreated them and they now behave perfectly!
Note to self - shut down & restart the PC if suffering from strange behaviour.
Thanks to all for your input.
As an aside, I also had 4 fields in a datagrid that I could not edit the values of. I eventually deleted the offending fields and recreated them and they now behave perfectly!
Note to self - shut down & restart the PC if suffering from strange behaviour.
Re: lineoffset not playing nicely with 'null' entry
Hi,
I use to have table fields, they're good enough for me. And when I need to work with the data & sheer text manipulating doesn't do the job, I throw 'em into a db table and have the sql engine sort out the good and the bad ;-)
Have fun!
That's what I meant - searching for "" (empty) doesn't find line 1, the empty line ;-)dunbarx wrote:Did you mean that you cannot FIND empty? If so, even though line 1 is empty, you are correct, and the function will return 0.
After trying to understand datagrids, and failing, I decided to clasify 'em as "This isn't fun!" and threw 'em in a coffin together with emacs, regexps, arrays and similar atrocities.jon@armasoft.co.uk wrote:As an aside, I also had 4 fields in a datagrid [...]
I use to have table fields, they're good enough for me. And when I need to work with the data & sheer text manipulating doesn't do the job, I throw 'em into a db table and have the sql engine sort out the good and the bad ;-)
Relogging can do this, too, more quickly ;-)jon@armasoft.co.uk wrote:Note to self - shut down & restart the PC if suffering from strange behaviour.
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: lineoffset not playing nicely with 'null' entry
Hi.
I do not think one can find nothing directly, though I see what you tried to do. The only way around this is to loop through each line and determine if that line is indeed empty. The upside to that process is that you will find ALL the empty lines.
Craig
I do not think one can find nothing directly, though I see what you tried to do. The only way around this is to loop through each line and determine if that line is indeed empty. The upside to that process is that you will find ALL the empty lines.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: lineoffset not playing nicely with 'null' entry
Code: Select all
get lineoffset(cr&cr, cr& MyVar )
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: lineoffset not playing nicely with 'null' entry
That won't find a blank ending line, so you would have to append CR to the back-end, too.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: lineoffset not playing nicely with 'null' entry
Do blank ending "lines" exist in xTalks?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: lineoffset not playing nicely with 'null' entry
We go round and round on this one. When you query a DB, if the last value is null or empty, the last char in the container will be a CR. The Tao Of LC would specify that you must take that behavior into account.