Bug #123 - Script command DeleteVariable() deletes the wrong variable
Product:PageStream 5.0.3.1 (All Platforms)Reported By:Tim Doty
Severity:NormalAssigned To:Deron Kazmaier
Priority:Average sign in to watch (1 is watching)
Status:InvalidReported:2006-05-28 18:27:00
Category:ScriptingUpdated:2006-05-28 18:27:00
Summary:Script command DeleteVariable() deletes the wrong variable
Keywords:deletevariable
Attached Files:No files attached.
 Sign In to add a file.

Script command DeleteVariable will, at least under some circumstances, delete the wrong variable. For example:

print NewVariable('foo', 'bar')
print NewVariable('bar', 'true')
print DeleteVariable('foo')

Will result in only the variable 'foo' remaining. The only connection between the two is that the value of 'foo' is the name of another variable 'bar'.


------- Additional Comment #1 From Tim Doty 2006-05-28 18:35 -------

The behavior appears to be always to delete the last variable added regardless of the specified name


------- Additional Comment #2 From Tim Doty 2006-05-28 22:10 -------

Probably related, can't delete more than one variable at a time? E.g., if there are three variables and you:

print DeleteVariable('setborder')
print DeleteVariable(pathIndex)
print DeleteVariable(borderName)

You get:

{'.error': 1, '.result': 0}
{'.errno': 1010, '.error': 0, '.result': 0, '.errstr': 'No Selection'}
{'.errno': 1010, '.error': 0, '.result': 0, '.errstr': 'No Selection'}

And only the first one is deleted (of course, the actual variable deleted is the last one added as previously noted in this bug)

Tim Doty wrote...2009-01-19 08:14:37

just tested this and the misbehavior continues. E.g.,
[script]
NEWVARIABLE FOO BAR
NEWVARIABLE BAR TRUE
DELETEVARIABLE FOO
[/script]

results in only variable foo being in the document. Similarly,

[script]newvariable foo bar
newvariable bar true
newvariable too true
deletevariable foo
deletevariable bar[/script]

only deletes the variable 'too'

Deron Kazmaier wrote...2009-01-19 18:37:55

This one is easy Smile the command should be DELETEVARIABLE VARIABLE FOO. Because you don't actually specify (as far as the command is concerned) what to delete, it is deleting the active variable. Once that happens, you can't delete the active variable again unless some action (editing, creating a newone) causes one to become the new active variable.

[Status updated to 'Invalid' on Mon, 19 Jan 2009 18:37:55 -0500]

Add a Comment
Sign in to add a comment.

Bug #123 - Script command DeleteVariable() deletes the wrong variable by Tim Doty   deletevariable
  created:2006-05-28 18:27:00   last updated:2006-05-28 18:27:00
  Copyright © 1985-2024 GrasshopperLLC. All Rights Reserved.


sign in to add a bug