Deleting certain fields behaves strangely

Pascal Lehner tate83 at gmail.com
Mon Sep 2 07:59:48 EDT 2013


Hi all

I have a script that creates fields named "Point1", "Point2" ... describing
certain data points on a graph. This works fine. However, when the number
of Points on the new graphic is smaller than on the old, I have old
"PointX" that remain from the previous graphc. Thus I want to implement a
delete routine to get rid of all fields and recreate them.

In the current example I have 6 data points called
Point1 to Point6

<code>
*repeat* with tField = 1 to the number of fields *on* card targetCard
*  put* the short name of field tField into tFieldName
*    if* tFieldName contains "Point" *then
**      put* "Deleting field no." && tField && "named" && tFieldName
      *delete* field tFieldName
    *end* *if*
*end* *repeat
*</code>
However, the following shows a very strange behavior I cannot understand
just now.
When I run it, it deletes Point1, Point3, Point5 but does not care about
the even numbers and breaks with an error message "Chunk: no such object".
When I run it again just afterwards, Point4 is the only survivor, same
error message.
When I run it a third time, Point4 is removed and the new graph is drawn
correctly.

Can you spot the issue? It is LiveCode Community 6.1.1. RC4

Thanks,

Pascal



More information about the use-livecode mailing list