Sivakatirswami wrote:
OK, well I solved the problem by taking the split out of the loop to a function, now it works. But I still think this is a bug.
No, I don't agree. The docs say very clearly
Important! You cannot change the labelVariable in a statement inside the loop. Doing so will cause a script error. You can change the content of the container, but doing so will probably produce unexpected results.
since "split" does change x (into an array, and to a different value), you're breaking the rule, and can't expect this to work.
Passing x as a parameter to the function passes a *copy* of the data, and hence avoids breaking the rule.
I'm not sure what Rev intended by the phrase "cause a script error" - it certainly doesn't cause the script to stop with the error box, in any example I could think of - but it does produce "unexpected" results in some cases.
on mouseUp
repeat for each line x in gLogData
put returnLogEntry(x) & cr after tLog
end repeat
put tLog into fld "logViewer"
end mouseup
function returnLogEntry x
split x with "|" and tab
return (x["Project"] & tab & (x["hours"] +round(x["hour-fraction"],2)) & tab & x["Fund_Category"])
end returnLogEntry
Now I get all six lines as expected:
Online-Donations 5.41 Public Services Publishers-Desk-Interface 1.25 Public Services Digital-Dharma-List 6.5 Public Services Web-Editor-Upgrade 2.17 Public Services Publishers-Desk-Interface 6.75 Funded Projects Online-Donations 1.08 Public Services
skts
-- Alex Tweedly http://www.tweedly.net
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 12/05/2005
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
