Page 1 of 2
Execution Error
Posted: Wed Sep 25, 2019 2:20 am
by kespears
I'm following the LiveCode Tutorial to create a Notes App. I receive the following error in my card "list" when saving the note location and file information.
card "list": execution error at line 10 (Chunk: no such object), char 1
I'm using LiveCode 9.5
Thanks for any guidance.
Keith
Re: Execution Error
Posted: Wed Sep 25, 2019 4:50 am
by FourthWorld
Do you have a field named "notesList" on that card?
Re: Execution Error
Posted: Wed Sep 25, 2019 6:16 am
by richmond62
There is also a mismatch between lines 12 and 13:
tNotes and tNotesList
Re: Execution Error
Posted: Wed Sep 25, 2019 9:50 am
by bogs
I have a question that I actually am not sure of in regards to this problem and your question, Richard.
If the handler is 'preOpenCard', doesn't that mean that there can't be ... any object created yet? The card isn't even open, if I understand the way a stack opens up
I might not be understanding it correctly though, which is why I am asking.
Edit - I must not understand how it opens, on testing I couldn't generate an error for the same handler putting empty into a named field
@Keith - link to the tutorial you are following? Also, I'd make sure that as Richard suggested, you actually have a field that is named "notesList", and doesn't contain a different name that is close, like "noteList". Typographical errors are buggers to track down.
Re: Execution Error
Posted: Wed Sep 25, 2019 1:23 pm
by kespears
Bogs, I'm using Livecode 8 Build App Tutorial. I was in the Displaying a Notes session.
https://livecode.com/topic/displaying-t ... f-notes-4/
Richmond62, I will review the other stacks to see where “notesList” was created and ensure the names are correct, and take a look at the mismatch between 12 and 13.
Thanks
Keith
Re: Execution Error
Posted: Wed Sep 25, 2019 1:49 pm
by richmond62
Variables (unless explicitly declared as globals) are local to an operation
(i.e. notesList looks local to preOpencard).
Re: Execution Error
Posted: Wed Sep 25, 2019 2:57 pm
by dunbarx
We cannot see the few lines above what the OP posted. Perhaps variables are declared up there?
Keith?
Craig
Re: Execution Error
Posted: Wed Sep 25, 2019 3:47 pm
by bogs
kespears wrote: ↑Wed Sep 25, 2019 1:23 pm
Bogs, I'm using Livecode 8 Build App Tutorial.
Ah I see, this is a restricted tutorial that you actually paid to read!
I was thinking it was possibly a typographical error even in the tutorial, but I've never tried them myself.
Re: Execution Error
Posted: Wed Sep 25, 2019 5:13 pm
by kespears
Dunbarx and Richmond62, I will check my variables. Thanks.
Bogs, yes, this is one of the Paid tutorial. It's helpful, but maybe I missed a variable or 2. I'm checking. Thanks.
Thanks
Keith
Re: Execution Error
Posted: Wed Sep 25, 2019 5:14 pm
by FourthWorld
bogs wrote: ↑Wed Sep 25, 2019 9:50 am
I have a question that I actually am not sure of in regards to this problem and your question, Richard.
If the handler is 'preOpenCard', doesn't that mean that there can't be ... any object created yet? The card isn't even open, if I understand the way a stack opens up
The preOpenCard message allows us to set things up before the card is displayed for the user. Any objects on the card are there and fully addressable, they just haven't been rendered to screen yet.
Edit - I must not understand how it opens, on testing I couldn't generate an error for the same handler putting empty into a named field
How did the test differ from the earlier run?
Re: Execution Error
Posted: Wed Sep 25, 2019 5:26 pm
by jacque
kespears wrote: ↑Wed Sep 25, 2019 2:20 am
I'm following the LiveCode Tutorial to create a Notes App. I receive the following error in my card "list" when saving the note location and file information.
card "list": execution error at line 10 (Chunk: no such object), char 1
The mismatch in lines 12 and 13 is an error in the tutorial. There were a few of those throughout the sequence that didn't get caught and fixed. You can use either tNotes or tNoteslist but the two lines must use the same variable name. The first line puts a list of files into a variable and the second one puts the list in that variable into a field.
The "no such object" error means LC can't find a field named "noteslist" on the current card. Check the field name. If other handlers in the tutorial refer to the field as either "noteslist" or "list" then you'll have to fix that mismatch too.
Re: Execution Error
Posted: Wed Sep 25, 2019 5:33 pm
by richmond62
There were a few of those throughout the sequence that didn't get caught and fixed.
Whoops! Especially when that isn't a free resource.
Re: Execution Error
Posted: Wed Sep 25, 2019 5:57 pm
by jacque
Someone with the time needs to report it.
Re: Execution Error
Posted: Wed Sep 25, 2019 6:56 pm
by bn
The tutorial is correct.
taken from step "Displaying the list of notes"
step one
variables are ok,
step two
variables are ok
I guess Keith just jumped ahead and left out some steps
Kind regards
Bernd
Re: Execution Error
Posted: Wed Sep 25, 2019 7:16 pm
by bn
This is the script of step two
Code: Select all
on preOpenCard
-- Declare any local variables
local tNotes, tNoteName, tNoteTime, tNotesList
-- Clear the "notesList" field
put empty into field "notesList"
-- Set the deafultFolder, telling LiveCode where to look for files
set the defaultFolder to notesFolder()
-- Get the list of files that are in the default folder
put the detailed files into tNotes
-- Sort the list of files by the modification date
sort lines of tNotes descending by item 5 of each
-- Build a list of notes in the form we want to display in the field
-- Look at each line in the list of note files
repeat for each line tNote in tNotes
-- Get the name of the note file and the last modified date
put character 1 to - 5 of urlDecode(item 1 of tNote) into tNoteName
put item 5 of tNote into tNoteTime
-- Convert the last modified date to a readable date
convert tNoteTime to date
-- Build the list of notes to be displayed
put tNoteName & tab & tNoteTime & tab & ">" & return after tNotesList
end repeat
-- The last character is a return so delete it
delete the last character of tNotesList
-- Put the formatted list into the "notesList" field
put tNotesList into field "notesList"
end preOpenCard
it is "strict compilation compliant" i.e. all variables are declared and are correctly used.
Not that there might not be errors in some lessons but this code is ok.
Kind regards
Bernd