The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[SOLVED] Creating data sets controlled by the content of file
Hello.
I am trying to realize the following task in RM: starting from a data table stored in the repository
I want to create new data tables depending on entries in a file.
In the simplest case the file would contain several lines, where each line contains
a list of names of attributes of the data table. I then want to read the file line by line
and for each line create a new data table that consists only of those columns of the original one
specified by the list of attribute names in the current line.
Any hints how to do that?
I am trying to realize the following task in RM: starting from a data table stored in the repository
I want to create new data tables depending on entries in a file.
In the simplest case the file would contain several lines, where each line contains
a list of names of attributes of the data table. I then want to read the file line by line
and for each line create a new data table that consists only of those columns of the original one
specified by the list of attribute names in the current line.
Any hints how to do that?
0
Answers
below I pasted a process which will do what you need. Replace the subprocess "Generate Fake File Data" by a Read CSV operator which reads the file which contains the attributes that you want to select. Be sure to select a character as delimiter which does NOT occur in the file. Thus, Read CSV will create an example set with exactly one attribute.
I assumed that the attributes are separated by commas in your file. The Replace operator converts each comma into the or selection character (|) for regular expressions. The resulting regular expression is used inside the Loop Examples operator to select the attributes accordingly.
This process assumes that your attributes don't contain any characters which have a special meaning in regular expressions.
Best regards,
Marius
The code works well and as far as I see can also be extended
to the other types of the data generation process that I have to
treat.
Kirth.