numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
20 stars 7 forks source link

Categorization (drop-down functionality) of table column get lost when passing / copy the table #253

Closed lucasJedel closed 1 month ago

lucasJedel commented 2 months ago

In addition, possible category values that are not already occurring in the column are getting lost.

This happens when:

(see: requirementstool-view-edit-handleEditReq.nprc)

right now, you have to manualy GetDatatypeOfAttribute for the table, read the categories and categorize manualy:

copy currentTable(_nRow, cols{}) -target=editTable();
...
sAttributeName = currentTable(#, colsCatCurr{nIdx});
categories_cst{} = $inv~requirementstool~TableMetaDataHandler~GetDatatypeOfAttribute(currentTable(), sAttributeName);
editTable().categorize(nCol, categories_cst{});

Analysis

The problem is located within void CategoricalColumn::insert(const VectorIndex& idx, const TableColumn* column), where only the string values but not the category definitions are copied. To achieve a good behavior, one could use a deviation of void CategoricalColumn::setCategories(const std::vector<std::string>& vCategories), which only appends missing categories (with a potential new ID), e.g. void CategoricalColumn::mergeCategories(const std::vector<std::string>& vCategories)

numeredev commented 2 months ago

@lucasJedel Passed from and to which location? Please be precise.