LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Simon Knight
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Post
by Simon Knight » Sun Nov 15, 2009 9:21 am
Hi,
I think that I have missed something obvious but I am having problems with what should be a simple equality test:
The line " If LineCount is 5" does not work, neither does "If LineCount = 5", but the line "If LineCount > 5" does work.
I have confirmed that LineCount is being incremented.
Any ideas?
Code: Select all
Put 0 into Blockcount
Put 0 into LineCount
set the itemDelimiter to space
Put Blockcount & return after CleanData
repeat for each line tLine in tFileData --compound statement that sets the new var tLine to the value of present line
Put LineCount+1 into LineCount
If the length of tline >10 then -- only process lines containing data
repeat with tItemNo = 1 to 8
put "<" & item tItemNo of tLine & ">" after CleanData
end repeat
If (LineCount is 5) then -- DataFile stores each block on 5 lines
put Blockcount+1 into Blockcount
Put return & "Block -" & Blockcount & return after CleanData
put 0 into LineCount
Else
put return after CleanData
End if
end if
end repeat
put CleanData after field debug
best wishes
Skids
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Sun Nov 15, 2009 9:31 am
My guess is that line 5 of tFileData has fewer than 10 chars. Try moving line
after
so you only increment the line count on lines you process.
Code: Select all
If the length of tline >10 then -- only process lines containing data
Put LineCount+1 into LineCount
repeat with tItemNo = 1 to 8
-
Simon Knight
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Post
by Simon Knight » Sun Nov 15, 2009 10:37 am
Doh!
Thanks for pointing out my "schoolboy" error. I was so sure that I had the syntax wrong.
Simon
write out 100 times - I must get the logic right...
best wishes
Skids
-
mwieder
- VIP Livecode Opensource Backer

- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
-
Contact:
Post
by mwieder » Sun Nov 15, 2009 6:31 pm
Well, it's hard to get that syntax *too* wrong. <g>
The first law of quality assurance is that you can't find the bugs in your own code - it takes a set of eyes that aren't intimately familiar with the way things *should* work.
-
Simon Knight
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Post
by Simon Knight » Sun Nov 15, 2009 6:36 pm
You are so right. Its also true for important letters: have them reviewed by someone else or leave them to cool for 24 hours.
Thanks
best wishes
Skids