Column Expression: Dynamically Extract and Define Type

Hi,

picking up my original topic:

Hi all, while working with the Column Expression Node I struggle a lot, maybe because of the lack of documentation, to dynamically define the column type (i.e. string, int etc.). I overwrite via a flow variable expressions > element 0 > outputType > cell-class but to no avail. [Bildschirmfoto 2022-09-12 um 13.47.11] I tried with the: exact type declaration like “Number (integer)” or “String” an array index (starting at 0) like 12 for “Number (integer)” or 20 for “String” a cleaned version …

I want to extract the column type to save this alongside i.e. a CSV file in order to once after reading CSV again, reinstate the original column type(s). Reason for that is that data might get shared / transmitted in human readable text files types. But, reinterpreting column types is time consuming and failure prone.

I am trying to accomplish this by looping over the table of data types derived from aforementioned workflow.

| Binary Object       | org.knime.core.data.blob.BinaryObjectDataCell                       |
| Bit vector          | org.knime.core.data.vector.bitvector.DenseBitVectorCell             |
| Bit vector (sparse) | org.knime.core.data.vector.bitvector.SparseBitVectorCell            |
| Boolean Value       | org.knime.core.data.def.BooleanCell                                 |
| Byte vector         | org.knime.core.data.vector.bytevector.DenseByteVectorCell           |
| Duration            | org.knime.core.data.time.duration.DurationCell                      |
| Image               | org.knime.knip.base.data.img.ImgPlusCell                            |
| JSON                | org.knime.core.data.json.JSONCell                                   |
| Local Date          | org.knime.core.data.time.localdate.LocalDateCell                    |
| Local Date Time     | org.knime.core.data.time.localdatetime.LocalDateTimeCell            |
| Local Time          | org.knime.core.data.time.localtime.LocalTimeCell                    |
| Number (double)     | org.knime.core.data.def.DoubleCell                                  |
| Number (integer)    | org.knime.core.data.def.IntCell                                     |
| Number (long)       | org.knime.core.data.def.LongCell                                    |
| PMML                | org.knime.core.data.def.LongCell                                    |
| PNG Image           | org.knime.core.data.image.png.PNGImageCell                          |
| Path                | org.knime.filehandling.core.data.location.cell.SimpleFSLocationCell |
| Period              | org.knime.core.data.time.period.PeriodCell                          |
| RDKit Molecule      | org.rdkit.knime.types.RDKitMolCell2                                 |
| SVG Image           | org.knime.base.data.xml.SvgCell                                     |
| String              | org.knime.core.data.def.StringCell                                  |
| URI                 | org.knime.core.data.uri.URIDataCell                                 |
| XML                 | org.knime.core.data.xml.XMLCell                                     |
| Zone Date Time      | org.knime.core.data.time.zoneddatetime.ZonedDateTimeCell            |

Not really an elegant but more a brute force approach (due lack of ideas currently). However, it seems the type can not be managed through variables, can it?

hub.knime.com

Best

Mike