Discussion:
removeKey()
(too old to reply)
Dale Fredrikson
2008-10-06 12:29:28 UTC
Permalink
As far as I can tell, the removeKey() function of the assocArray object doesn't work properly.

To demonstrate what I'm talking about, please compile and run the following code:

local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )

If you then drill down in the Inspector to the Array Elements, it should show the four remaining elements -- everything except 'three'.

But it doesn't. Instead it shows that 'three' has indeed been removed, but also one of the other elements has been modified: For that element, the key value has been removed, and the element value has been set to false.

Maybe this is old news, but I don't find anything about it in bug_reports.

Am I missing something obvious?

Dale
Rich - AutoTraker Inc.
2008-10-06 18:37:41 UTC
Permalink
Seems the removeKey() function works properly.
Its just the display of the assocArray in the inspector thats screwed up.
Rich...

local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )

cKey = a.firstKey
for nElements = 1 to a.count( )
? "a['"+cKey + "'] = "
?? a[ cKey ]
cKey := a.nextKey( cKey )
endfor
Post by Dale Fredrikson
As far as I can tell, the removeKey() function of the assocArray object
doesn't work properly.
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should
show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed,
but also one of the other elements has been modified: For that element,
the key value has been removed, and the element value has been set to
false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
Dale
Dale Fredrikson
2008-10-08 19:28:27 UTC
Permalink
Thanks, guys. My faith in dBase is restored.

Regards,

Dale
Post by Rich - AutoTraker Inc.
Seems the removeKey() function works properly.
Its just the display of the assocArray in the inspector thats screwed up.
Rich...
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
cKey = a.firstKey
for nElements = 1 to a.count( )
? "a['"+cKey + "'] = "
?? a[ cKey ]
cKey := a.nextKey( cKey )
endfor
Post by Dale Fredrikson
As far as I can tell, the removeKey() function of the assocArray object
doesn't work properly.
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should
show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed,
but also one of the other elements has been modified: For that element,
the key value has been removed, and the element value has been set to
false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
Dale
Marty Kay
2008-10-06 16:53:21 UTC
Permalink
Hi Dale,
Post by Dale Fredrikson
As far as I can tell, the removeKey() function of the assocArray object
doesn't work properly.
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should
show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed,
but also one of the other elements has been modified: For that element,
the key value has been removed, and the element value has been set to
false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
This appears to me to be a bug.
I've entered it as QAID: 6483.


Thanks,

- Marty -

Martin Kay
dataBased Intelligence, Inc.
kathy kolosky
2008-10-06 18:55:20 UTC
Permalink
Hi Dale. QAID 6483 was submitted for this issue where it was determined that
the inspector was not showing the elements correctly. But, they are still
there.

If you do this in the command window and check the value of the other keys
you will see they are still there.

I put in a me too for you on this QAID and resubmitted it to R&D.

Thanks, Kathy
QA
dBI
Post by Dale Fredrikson
As far as I can tell, the removeKey() function of the assocArray object
doesn't work properly.
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should
show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed,
but also one of the other elements has been modified: For that element,
the key value has been removed, and the element value has been set to
false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
Dale
kathy kolosky
2008-10-06 18:58:44 UTC
Permalink
Nevermind. I see this was just entered by Marty.

- Kathy
Post by kathy kolosky
Hi Dale. QAID 6483 was submitted for this issue where it was determined
that the inspector was not showing the elements correctly. But, they are
still there.
If you do this in the command window and check the value of the other keys
you will see they are still there.
Loading...