Remove last element from $lb property
How can I remove elements from $lb property? Specifically last element?
$list does not work with $lb properties.
$listupdate can't remove elements
The only solution I found is a temp variable and $list, but isn't there something better?
Class User.Test Extends %RegisteredObject
{
Property List As %List [ InitialExpression = {$lb(1,2,3)} ];
/// do ##class(User.Test).TestList()
ClassMethod TestList()
{
set obj = ..%New()
do obj.ClearLast()
set list = obj.List
zw list
}
Method ClearLast()
{
//set $list(..List, *, *) = "" // <OBJECT DISPATCH>zTestList+2^User.Test.1 *Property 'List' in class 'User.Test' must be MultiDimensional
//set ..List = $LISTUPDATE(..List, $ll(..List), "") // Works, but returns $lb(1,2,"")
// works
set list = ..List
set class = $lg(list, *)
set $list(list, *, *) = ""
set ..List = list
}