cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-791256%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EF%C3%BCgen%20Sie%20eine%20Funktion%20zum%20Bereinigen%20der%20Datentabelle%20hinzu%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-791256%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSTRONG%3EWas%20hat%20Sie%20zu%20dieser%20Wunschliste%20inspiriert%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIch%20schreibe%20immer%20mehr%20oder%20weniger%20komplizierte%20Skripte%2C%20um%20meine%20Datentabellen%20zu%20%E2%80%9Ebereinigen%E2%80%9C%20(Tabellenskripte%2C%20Tabellenvariablen%2C%20Spalteneigenschaften%20usw.%20entfernen).%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EWelche%20Verbesserung%20w%C3%BCrden%20Sie%20gerne%20sehen%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EStellen%20Sie%20eine%20einfache%20Plattform%20zum%20Bereinigen%20von%20Datentabellen%20bereit.%20Dies%20sollte%20die%20M%C3%B6glichkeit%20bieten%2C%20Tabellenskripte%2C%20Tabellenvariablen%2C%20Spalteneigenschaften%2C%20Zeilenzust%C3%A4nde%20und%20alle%20anderen%20%C3%84nderungen%20zu%20entfernen.%20Im%20besten%20Fall%20kann%20der%20Benutzer%20entscheiden%2C%20was%20entfernt%20werden%20soll.%20Einige%20davon%20k%C3%B6nnten%20in%20Subset%20implementiert%20werden%2C%20aber%20ich%20denke%2C%20dies%20sollte%20auch%20eine%20separate%20Plattform%20sein.%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EWarum%20ist%20diese%20Idee%20wichtig%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EErleichtert%20das%20Erstellen%20neuer%20Datentabellen%20aus%20vorhandenen%2C%20ohne%20dass%20nicht%20relevante%20Informationen%20%C3%BCbernommen%20werden.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-791256%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGrundlegende%20Datenanalyse%20und%20Modellierung%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDatenzugriff%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDatenzusammenf%C3%BChrung%20und%20-bereinigung%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EErgebnisse%20teilen%20und%20kommunizieren%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-797476%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20F%C3%BCgen%20Sie%20eine%20Funktion%20zum%20Bereinigen%20der%20Datentabelle%20hinzu%20-%20Status%20ge%C3%A4ndert%20in%3A%20Best%C3%A4tigt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-797476%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EInteressante%20Idee%2C%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%20.%20Wie%20machst%20du%20das%20heute%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-797673%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20F%C3%BCgen%20Sie%20eine%20Funktion%20zum%20Bereinigen%20der%20Datentabelle%20hinzu%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-797673%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EJe%20nach%20Fall%20kann%20ich%20entweder%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EF%C3%BChren%20Sie%20diese%20manuell%20durch%3C%2FLI%3E%0A%3CLI%3EErstellen%20Sie%20ein%20Skript%20(sofern%20es%20sich%20um%20eine%20Automatisierung%20handelt)%3C%2FLI%3E%0A%3CLI%3EManchmal%20%C3%BCberspringe%20ich%20die%20Bereinigung%20und%20habe%20am%20Ende%20eine%20etwas%20chaotische%20Datentabelle%2C%20aber%20das%20ist%20kein%20Problem%2C%20bis%20ich%20die%20Tabelle%20freigebe%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIch%20werde%20h%C3%B6chstwahrscheinlich%20ein%20Add-In%20schreiben%20(ich%20habe%20bereits%20damit%20begonnen%2C%20bin%20aber%20auf%20einen%20%E2%80%9Ekleinen%E2%80%9C%20Feature%20Creep%20mit%20allen%20m%C3%B6glichen%20unn%C3%B6tigen%20Funktionen%20gesto%C3%9Fen)%2C%20um%20diese%20spezifischen%20%E2%80%9EMetadaten%E2%80%9C-Bereinigungsaufgaben%20auszuf%C3%BChren%2C%20da%20ich%20sie%20ziemlich%20regelm%C3%A4%C3%9Fig%20durchf%C3%BChre.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-797695%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20F%C3%BCgen%20Sie%20eine%20Funktion%20zum%20Bereinigen%20der%20Datentabelle%20hinzu%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-797695%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EBis%20der%20Wunsch%20gen%C3%BCgend%20Anerkennung%20erh%C3%A4lt%2C%20kann%20dieses%20Skript%20hilfreich%20sein.%3C%2FP%3E%3CP%3EEs%20erstellt%20ein%20Skript%20f%C3%BCr%20die%20aktuelle%20Datentabelle%20und%20entfernt%20%E2%80%93%20abh%C3%A4ngig%20von%20den%20Einstellungen%20%E2%80%93%20Skripte%2C%20Spalteneigenschaften%20und%20den%20Ausdruck%20%E2%80%9Eadd%20rows()%E2%80%9C.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0AremoveScripts%20%3D%201%3B%0AremoveColumnProperties%20%3D%201%3B%0Aremove%20rows%20%3D%201%3B%0A%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FBig%20Class.jmp%22%20)%3B%0Adt%20%26lt%3B%26lt%3B%20copy%20table%20script(%20%22no%20data%22%20)%3B%0AtableScript%20%3D%20Eval(%20Eval%20Expr(%20Parse(%20Expr(%20Get%20Clipboard()%20)%20)%20)%20)%3B%0A%0AtableScriptList%20%3D%20Substitute(%20Name%20Expr(%20tableScript%20)%2C%20Expr(%20New%20Table()%20)%2C%20Expr(%20List()%20)%20)%3B%0AIf(%20removeScripts%2C%0A%09tableScriptList%20%3D%20Filter%20Each(%20%7Bpart%7D%2C%20tableScriptList%2C%20Not(%20Head(%20Part%20)%20%3D%3D%20Expr(%20New%20Script()%20)%20)%20)%0A)%3B%0AtableScriptList%20%3D%20Transform%20Each(%20%7Bpart%7D%2C%20tableScriptList%2C%0A%09If(%0A%09%09Head(%20part%20)%20%3D%3D%20Expr(%20New%20Column()%20)%20%26amp%3B%20removeColumnProperties%2C%0A%09%09%09Substitute(%20Name%20Expr(%20part%20)%2C%20Extract%20Expr(%20part%2C%20Set%20Property(%20Wild%20List()%20)%20)%2C%20.%20)%2C%0A%09%09Head(%20part%20)%20%3D%3D%20Expr(%20Add%20Rows()%20)%20%26amp%3B%20remove%20rows%2C%20.%2C%0A%09%09Name%20Expr(%20part%20)%0A%09)%0A)%3B%0AnewtableScript%20%3D%20Substitute(%20Name%20Expr(%20tableScriptList%20)%2C%20Expr(%20List()%20)%2C%20Expr(%20New%20Table()%20)%20)%3B%0A%0AnewtableScript%3B%0A%09%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EEs%20ist%20alles%20andere%20als%20ideal.%3C%2FP%3E%3CP%3EDas%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EErsetzen%3C%2FFONT%3E%20ist%20ziemlich%20gef%C3%A4hrlich%20%E2%80%93%20es%20ersetzt%20nicht%20nur%20den%20Ausdruck%2C%20den%20der%20Benutzer%20ersetzen%20wollte%2C%20sondern%20alle%20passenden%20Ausdr%C3%BCcke!%3C%2FP%3E%3CP%3EzB%20wird%20jede%20Liste%2C%20die%20am%20Ende%20des%20Skripts%20%C3%BCbrig%20bleibt%2C%20durch%20New%20Table%20()%20ersetzt!!!%3C%2FP%3E%3CP%3EJede%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eneue%20Tabelle%20()%3C%2FFONT%3E%20in%20einem%20Tabellenskript%20wird%20durch%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Eeine%20Liste%20()%3C%2FFONT%3E%20ersetzt%20%5Bund%20dann%20am%20Ende%20durch%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3ENeue%20Tabelle%20()%3C%2FFONT%3E%20%3A%5D%3C%2FP%3E%3CP%3EKennen%20Sie%20eine%20Problemumgehung%2C%20um%20dies%20bei%20JMP%20zu%20verhindern%3F%3CBR%20%2F%3E%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3EErsatzleiter%3C%2FFONT%3E%20%3F%3C%2FP%3E%3CP%3EMit%20diesem%20Thema%20im%20Hinterkopf%20habe%20ich%20diesen%20Wunsch%20niedergeschrieben%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJMP-Wish-List%2FExpression-Indexing-read-and-write-access%2Fm-p%2F697359%23U697359%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-idea-thread%20lia-fa-icon%20lia-fa-idea%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3E%3CLI-EMOJI%20id%3D%22lia_folded-hands%22%20title%3D%22%3Amanos_unidas_para_la_oraci%C3%B3n%3A%22%3E%3C%2FLI-EMOJI%3E%20Ausdrucksindizierung%3A%20Lese-%20und%20Schreibzugriff%3C%2FA%3E%20%3C%2FP%3E%3CP%3ESobald%20es%20verf%C3%BCgbar%20ist%2C%20werde%20ich%20das%20Skript%20aktualisieren%20und%20robuster%20machen.%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
0 Kudos

Add a feature to clean data table

What inspired this wish list request? 

Always writing more or less complicated scripts to "clean" my data tables (remove table scripts, table variables, column properties, ...)

 

What is the improvement you would like to see? 

Provide easy platform to cleanup data table. This should give option to remove table scripts, table variables, column properties, row states and all different modifications. In best case user could decide which to remove. Some of these could be implemented to Subset but I feel like this should also be separate platform.

 

Why is this idea important? 

Makes it easier to create new data tables from existing ones without they carrying over non-relevant information.

3 Comments
mia_stephens
Staff
Status changed to: Acknowledged

Interesting idea @jthi . How do you do this today?

jthi
Super User

Depending on the case, I either:

  • Do these manually
  • Script them (if it is automatization)
  • Sometimes I skip the cleaning and might end up with a bit messy data table but it isn't a problem until I share the table

I will most likely write an add-in (I did already start but did come across a "small" feature creep with all sorts of unnecessary features) to perform these specific "metadata" clean-up tasks as I do them quite regularly.

hogi
Level XII

Till the wish gets enough Kudos, this script might help.

It creates a script for the current data table and - depending on the settings, it removes scripts, column properties and the add rows() expression.

 

Names Default To Here( 1 );

removeScripts = 1;
removeColumnProperties = 1;
remove rows = 1;

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << copy table script( "no data" );
tableScript = Eval( Eval Expr( Parse( Expr( Get Clipboard() ) ) ) );

tableScriptList = Substitute( Name Expr( tableScript ), Expr( New Table() ), Expr( List() ) );
If( removeScripts,
	tableScriptList = Filter Each( {part}, tableScriptList, Not( Head( Part ) == Expr( New Script() ) ) )
);
tableScriptList = Transform Each( {part}, tableScriptList,
	If(
		Head( part ) == Expr( New Column() ) & removeColumnProperties,
			Substitute( Name Expr( part ), Extract Expr( part, Set Property( Wild List() ) ), . ),
		Head( part ) == Expr( Add Rows() ) & remove rows, .,
		Name Expr( part )
	)
);
newtableScript = Substitute( Name Expr( tableScriptList ), Expr( List() ), Expr( New Table() ) );

newtableScript;
	

It's far from ideal.

The Substitute is quite dangerous - it does not only replace the expression the user wanted to replace, it replaces all matching expressions!

e.g. any list which remains at the end of the script will be replaced by New Table () !!!

Any new table() which is in a Table Script will be replaced by List() [and then by New table() at the end :]

Do you know any workaround to prevent JMP from doing so?
Substitute Head?

With this issue in mind, I wrote this wish:

🙏 Expression Indexing: read and write access 

One it's available, I will update the script and make it more robust.