zuilin
November 5th, 2020, 23:30
I'm iterating through database entries that I've created trying to delete them and I must be doing something wrong. Here is my code and the database:
for k, v in pairs(ztWindowRecordList.getChildren()) do
if (DB.getValue(v, "windowNodePath") == sWindowNodePath) and (DB.getValue(v, "windowClass") == cWindowClass) then
DB.deleteChild(v, k);
end
end
and
<DM_ZTabber>
<ztabber_window_list>
<id-00001>
<windowClass type="string">masterindex</windowClass>
<windowNodePath type="string">tables</windowNodePath>
</id-00001>
<id-00002>
<windowClass type="string">table</windowClass>
<windowNodePath type="string">tables.id-00001</windowNodePath>
</id-00002>
</ztabber_window_list>
</DM_ZTabber>
The database looks exactly how I want it. What I want to do is now delete, say, the entry with id-0002 if the data in "windowClass" and "windowNodePath" match some variable information in my script (sWindowNodePath and cWindowClass).
I'm pretty sure I'm doing something wrong because the data never gets deleted from the DB.
Thanks.
for k, v in pairs(ztWindowRecordList.getChildren()) do
if (DB.getValue(v, "windowNodePath") == sWindowNodePath) and (DB.getValue(v, "windowClass") == cWindowClass) then
DB.deleteChild(v, k);
end
end
and
<DM_ZTabber>
<ztabber_window_list>
<id-00001>
<windowClass type="string">masterindex</windowClass>
<windowNodePath type="string">tables</windowNodePath>
</id-00001>
<id-00002>
<windowClass type="string">table</windowClass>
<windowNodePath type="string">tables.id-00001</windowNodePath>
</id-00002>
</ztabber_window_list>
</DM_ZTabber>
The database looks exactly how I want it. What I want to do is now delete, say, the entry with id-0002 if the data in "windowClass" and "windowNodePath" match some variable information in my script (sWindowNodePath and cWindowClass).
I'm pretty sure I'm doing something wrong because the data never gets deleted from the DB.
Thanks.