extra blank line

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
herbwords
Posts: 70
Joined: Sat Dec 01, 2007 2:59 am

extra blank line

Post by herbwords » Mon Dec 03, 2012 3:49 am

Hi,

With this script every time I go to a card it gets the content of the fld findlot and puts it into a scrolling fld cpound on another cd inventory1.
It works great. But, it puts an empty line in between each copied entry and I want single space.
Any suggestion are appreciated. Thanks! - Patrick


on openCard
if the hilite of btn "Recent" of cd "inventory1" of stack "inventory" is true then
if there is fld "findlot" then
put fld "findlot" & return after fld "cpound" of cd "inventory1" of stack "inventory"
end if
end if
end openCard


This is what it does:

11330 - 11 - RG01067 - Cacao Butter - hr3D4

11328 - 11 - RG01070 - Cacao powder - hr4C2

11611 - 11 - RG01058 - Boldo, whole - hr2B1

11861 - 11 - RG01071 - Cacao, beans - R2

This is what I want:

11330 - 11 - RG01067 - Cacao Butter - hr3D4
11328 - 11 - RG01070 - Cacao powder - hr4C2
11611 - 11 - RG01058 - Boldo, whole - hr2B1
11861 - 11 - RG01071 - Cacao, beans - R2

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: extra blank line

Post by dunbarx » Mon Dec 03, 2012 6:31 am

Hi.

This is an oldie but goodie.

There may be an errant return in your field data or elsewhere. It seems simple and logical to just place new data AFTER the old, but you can get tripped up that way.

What I always do is something like this:

put yourNewData into line the number of lines of fld "yourTargetField" + 1 of fld "yourTargetField".

Now the next line in the field is always identified directly, and the new data will fall into, er, line.

But beware, if there are, for some reason, several more returns (which are invisible) in the target field, then you might see your data posted even lower down. There are ways around this as well, of course, but usually the more common situation you are in is with a single invisible return bumping things down one line.

Write back if you want to explore this further, and make sure that the next visible empty line is always the target line. And of course you can always delete blank lines in the final data, perhaps each time you change it, but that is inelegant.

Craig Newman

herbwords
Posts: 70
Joined: Sat Dec 01, 2007 2:59 am

Re: extra blank line

Post by herbwords » Mon Dec 03, 2012 7:44 am

Thanks Craig!

This was the final, it works great. Patrick

on openCard
if the hilite of btn "Recent" of cd "inventory1" of stack "inventory" is true then
if there is fld "findlot" then
put fld "findlot" into line the number of lines of fld "cpound" of cd "inventory1"+ 1 of fld "cpound" of cd "inventory1"
end if
end if
end openCard

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: extra blank line

Post by Klaus » Mon Dec 03, 2012 12:17 pm

Hi freinds,

I highly recommend to use brackets in this case, since I found that the engine is getting
less and less forgiving with every new version!
...
put fld "findlot" into line the number of lines of fld "cpound" of cd "inventory1"+ 1 of fld "cpound" of cd "inventory1"
...

Better:
...
put fld "findlot" into line (the number of lines of fld "cpound" of cd "inventory1"+ 1) of fld "cpound" of cd "inventory1"
...

Or even better (for debugging purposes!):
...
put the num of lines of fld "cpound" of cd "inventory1" into tNum
put fld "findlot" into line (tNum + 1) of fld "cpound" of cd "inventory1"
...

AND this is also more redable! :)


Best

Klaus

Post Reply