import data script problem

Alex Tweedly alex at tweedly.net
Sun Sep 18 19:54:27 EDT 2005


rev at armbase.com wrote:

>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.
>
>  
>
Basically, in technical terms :-), "You can't do that"

I may not say this well ..... you're trying to use build up the field 
reference using that last "&", and that's not allowed. This is a case 
where you need to use "do" (or similar).
Change that line from

>  Put item curNum of field "withtabs" of stack "PDATreader" into field "field"&curNum
>  
>
into two lines - something like

>  Put item curNum of field "withtabs" of stack "PDATreader" into temp
>  do "Put temp into field " & quote & "field" & curNum & quote
>  
>
(You could do it all in one - but the quoting is easier to follow this way)




-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 16/09/2005




More information about the use-livecode mailing list