cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-695001%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EUmbenennen%20mehrerer%20Datentabellen%20ab%20dem%20letzten%20Wort%20des%20aktuellen%20Tabellennamens%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-695001%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHallo%2C%20ich%20versuche%2C%20mehrere%20Datentabellen%20umzubenennen%2C%20da%20die%20Namen%20meiner%20Datentabellen%20in%20Verzeichnisformen%20vorliegen.%20Ich%20m%C3%B6chte%20sie%20entsprechend%20ihren%20Ordnernamen%20umbenennen%20(wird%20vom%20letzten%20Zeichen%20des%20Verzeichnisses%20abgerufen).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EName%20der%20Beispieldatentabelle%3A%3C%2FP%3E%3CP%3EC%3A%5CBenutzer%5CDesktop%5CTabelle1%3C%2FP%3E%3CP%3EC%3A%5CBenutzer%5CDesktop%5CTable2%3C%2FP%3E%3CP%3EC%3A%5CBenutzer%5CDesktop%5CTable3%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIch%20habe%20versucht%2C%20mit%20der%20Word-Funktion%20das%20letzte%20Wort%20aus%20dem%20Dateinamen%20zu%20ermitteln%2C%20aber%20es%20funktioniert%20nicht.%20Bitte%20helfen%20Sie%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EFor%20(w%20%3D%201%2C%20w%20%26lt%3B%3D%20N%20Table()%2C%20w%2B%2B%2C%0A%20%20dtName%20%3D%20Word(-1%2C%20Data%20Table(w)%2C%20%22-%22)%2C%0A%20%20Data%20Table(w)%20%26lt%3B%26lt%3B%20Set%20Name(dtName)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EDie%20resultierenden%20Datentabellennamen%20sollten%20lauten%3A%20Tabelle1%2C%20Tabelle2%2C%20Tabelle3%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-695001%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EAutomatisierung%20und%20Skripterstellung%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-695016%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Umbenennen%20mehrerer%20Datentabellen%20ab%20dem%20letzten%20Wort%20des%20aktuellen%20Tabellennamens%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-695016%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESie%20m%C3%BCssen%20den%20Namen%20der%20Datentabelle%20abrufen%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EFor%20(w%20%3D%201%2C%20w%20%26lt%3B%3D%20N%20Table()%2C%20w%2B%2B%2C%0A%20%20dtName%20%3D%20Word(-1%2C%20Data%20Table(w)%20%26lt%3B%26lt%3B%20get%20name%2C%20%22-%22)%2C%0A%20%20Data%20Table(w)%20%26lt%3B%26lt%3B%20Set%20Name(dtName)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-695021%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Umbenennen%20mehrerer%20Datentabellen%20ab%20dem%20letzten%20Wort%20des%20aktuellen%20Tabellennamens%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-695021%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EWarum%20kommt%20es%20zu%20einem%20solchen%20Fehler%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EZu%20viele%20Argumente%7B40%7D%20beim%20Zugriff%20oder%20bei%20der%20Auswertung%20von%20'For'%20%2C%20For%2F*%23%23%23*%2F(w%20%3D%201%2C%20w%20%26lt%3B%3D%20N%20Table()%2C%20w%2B%2B%2C%20dtName%20%3D%20Word(%3CBR%20%2F%3E%20-1%2C%3CBR%20%2F%3E%20Datentabelle(%20w%20)%20%26lt%3B%26lt%3B%20Name%20abrufen%2C%3CBR%20%2F%3E%20%E2%80%9E-%E2%80%9C%3CBR%20%2F%3E%20)%2C%20Datentabelle(%20w%20)%20%26lt%3B%26lt%3B%20Set%20Name(%20dtName%20))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E---%20BEARBEITEN%20---%3C%2FP%3E%3CP%3EIch%20habe%20das%20Komma%20nach%20der%20Word-Funktion%20durch%20%3B%20ersetzt.%20und%20funktioniert%20jetzt%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EFor%20(w%20%3D%201%2C%20w%20%26lt%3B%3D%20N%20Table()%2C%20w%2B%2B%2C%0A%20%20dtName%20%3D%20Word(-1%2C%20Data%20Table(w)%20%26lt%3B%26lt%3B%20get%20name%2C%20%22-%22)%3B%0A%20%20Data%20Table(w)%20%26lt%3B%26lt%3B%20Set%20Name(dtName)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
UserID16644
Level V

Renaming multiple data table from last word of current table name

Hi, I am trying to rename multiple data table because my data table name are in directory forms. I would want to rename them according to their folder names (will be getting from the last character of the directory) 

 

Sample data table name: 

C:\Users\Desktop\Table1

C:\Users\Desktop\Table2

C:\Users\Desktop\Table3

 

I tried using Word function to get the last word from the file name, but doesn't work. Please help

 

For (w = 1, w <= N Table(), w++,
		dtName = Word(-1, Data Table(w), "\"),
		Data Table(w) << Set Name(dtName);
);

The resulting data table names should be: Table1, Table2, Table3

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Renaming multiple data table from last word of current table name

You need to retrieve the data table name

For (w = 1, w <= N Table(), w++,
		dtName = Word(-1, Data Table(w) << get name, "-"),
		Data Table(w) << Set Name(dtName);
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Renaming multiple data table from last word of current table name

You need to retrieve the data table name

For (w = 1, w <= N Table(), w++,
		dtName = Word(-1, Data Table(w) << get name, "-"),
		Data Table(w) << Set Name(dtName);
);
Jim
UserID16644
Level V

Re: Renaming multiple data table from last word of current table name

Why does it prompt an error like this?

 

too many arguments{40} in access or evaluation of 'For' , For/*###*/(w = 1, w <= N Table(), w++, dtName = Word(
-1,
Data Table( w ) << get name,
"-"
), Data Table( w ) << Set Name( dtName ))

 

--- EDIT ---

I replaced the comma after the Word function with ; and is working now

For (w = 1, w <= N Table(), w++,
		dtName = Word(-1, Data Table(w) << get name, "-");
		Data Table(w) << Set Name(dtName);
);

 

Recommended Articles