import data script problem

rev at armbase.com rev at armbase.com
Sun Sep 18 15:48:29 EDT 2005


Hi All.

I have a script that builds fields automatically in a card. This works fine.
The script is

on mouseUp
  global tFileName
 send mouseup to button "LoadPDBData" of Stack "PDATreader"
  send mouseup to button "ExtractPDBData" of Stack "PDATreader"
  send mouseup to button "BracketControlCharackters" of Stack "PDATreader"
  send mouseup to button "ConvertToTabs" of Stack "PDATreader"
 set the itemdelimiter to tab
  put the number of items of line 1 of field "withtabs" of stack "PDATreader"
into repNum
  put empty into curNum
  repeat for repNum times
  --put field "StartNumber" into curNum
  put curNum + 1 into curNum
  copy field "TextField" of stack "Armbase" to group "MasterGroup" of stack
tFileName
  set the name of field "TextField" of group "MasterGroup" of stack tFileName \
to "field"&curNum

  end repeat


end mouseUp


So the fields should be names field1 field2 etc and they are.

However, if I adapt the script to put data into the fields, then I get an error
at one of the original points (where previously there was no problem).

on importpdb

  global tFileName
 send mouseup to button "LoadPDBData" of Stack "PDATreader"
  send mouseup to button "ExtractPDBData" of Stack "PDATreader"
  send mouseup to button "BracketControlCharackters" of Stack "PDATreader"
  send mouseup to button "ConvertToTabs" of Stack "PDATreader"
 put the number of lines of field "withtabs" of stack "PDATreader" into lineNum
  set the itemdelimiter to tab
  put the number of items of line 1 of field "withtabs" of stack "PDATreader"
into repNum
  put empty into curNum
  repeat for lineNum times
  repeat for repNum times
  put curNum + 1 into curNum
  Put item curNum of field "withtabs" of stack "PDATreader" into field
"field"&curNum
end repeat
create card
end repeat
end importpdb



I can't see anything wrong here.

The error is

compiling at 8:44:13 PM
Type	repeat: garbage where a command should be
Object	MyDatabase.abd
Line	Put item curNum of field "withtabs" of stack "PDATreader" into field
"field"&curNum
Hint	&

I can see that the & is wrong but this works earlier.

cheers
Bob




More information about the use-livecode mailing list