Pages: [1]
  Print  
Author Topic: generate attribute and filename in loop cycle  (Read 822 times)
robben
Newbie
*
Posts: 9


« on: July 12, 2013, 09:54:29 AM »

Goodmorning,
i am new at rapidminer and discovering it as great for ETL and analysis tasks.
Just a question i didn't find documented even if browsing around.
I need to load some csv files, treat these data adding an attribute to corrispondent dataset recorded the name of the file where they come from and then apped it in a unique dataset.
I used loop files operator with read csv, generate attributes subprocess operators and then an append operator.
But in generate attributes right now i am just able to write a fix name for all the files.
I don't know how to reference in generate attributes operator the changing file name for each iteration coming from loop files operator.
Is there any way to do it (for example with any process parameter) directly on Edit List in function descriptions or is there another way?
Thanks in advance
Logged
mdc
Jr. Member
**
Posts: 60


« Reply #1 on: July 12, 2013, 04:26:24 PM »


Try to use 'file name macro' parameter of the 'Loop Files' operator. This can be done by adding %{file_name} as a value to your attribute.
I'm not actually sure if this is what your looking for, but you can post a sample of  your process so it's more clear.

Matthew
Logged
robben
Newbie
*
Posts: 9


« Reply #2 on: July 12, 2013, 09:53:17 PM »

Matthew,
it's perfectly what i was looking for. Thanks a lot
is there any way to get filename without extension? I mean if the filename is ABC.csv just ABC
Thanks
Roberto
Logged
Marius
Administrator
Hero Member
*****
Posts: 1793



WWW
« Reply #3 on: July 22, 2013, 09:58:37 AM »

If you are familiar with regular expressions, you can remove the extension from the original filename with the Generate Macro operator and the ReplaceAll() function.

Best regards,
Marius
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
robben
Newbie
*
Posts: 9


« Reply #4 on: July 22, 2013, 01:38:58 PM »

Thanks Marius,
i will check that solution deepening regular expressions
Apart, english manual, operator Reference and AccademicUse that i read, is there any other manual where to study specific rapidminer code programming (i mean the code programming and not the visual one?)
Thanks in advance
Roberto

Logged
Marius
Administrator
Hero Member
*****
Posts: 1793



WWW
« Reply #5 on: July 22, 2013, 01:41:13 PM »

Do you mean actual Java programming, i.e. extending RapidMiner with custom operators and extensions? Or do you mean the "code" used in Generate Attribute and Generate Macro?

Best regards,
Marius
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
robben
Newbie
*
Posts: 9


« Reply #6 on: July 22, 2013, 03:32:55 PM »

Both.
Thx
Logged
Marius
Administrator
Hero Member
*****
Posts: 1793



WWW
« Reply #7 on: July 23, 2013, 08:57:26 AM »

The RapidMiner Extension Guide available from our documentation site describes how to create custom operators. For Generate Attributes the only documentation is the one available directly in the operator itself: if you open the expression editor, at the bottom a categorized list of functions is displayed. If you hover the mouse over a function name a tooltip is shown describing the syntax of the respective function.

Best regards,
Marius
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
Pages: [1]
  Print  
 
Jump to: