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-372689%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EAufzeichnen%20und%20Wiederherstellen%20von%20Metadaten%20in%20einer%20Tabelle%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-372689%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EIch%20habe%20eine%20gestapelte%20Datentabelle%20mit%20drei%20Spalten%2C%20die%20Zeichenfolgen%20und%20eine%20weitere%20numerische%20Spalte%20enthalten.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%3A%20eindeutige%20Kennung%3C%2FP%3E%3CP%3EB%3A%20Text%3C%2FP%3E%3CP%3EC%3A%20Text%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%2C%20Bs%2C%20Cs%2C%20Werte%3C%2FP%3E%3CP%3E-----%3C%2FP%3E%3CP%3EA1%2C%20B1%2C%20C1%2C%20Wert11%3C%2FP%3E%3CP%3EA1%2C%20B1%2C%20C1%2C%20Wert12%3C%2FP%3E%3CP%3EA1%2C%20B1%2C%20C1%2C%20Wert13%3C%2FP%3E%3CP%3EA2%2C%20B2%2C%20C2%2C%20Wert21%3C%2FP%3E%3CP%3EA2%2C%20B2%2C%20C2%2C%20Wert22%3C%2FP%3E%3CP%3EA2%2C%20B2%2C%20C2%2C%20Wert23%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIm%20Moment%20erstelle%20ich%20einen%20verketteten%20Spaltennamen%20mit%20der%20Form%20%E2%80%9EA%20(B)%20%5BC%5D%E2%80%9C%2C%20den%20ich%20aufteile%2C%20um%20die%20endg%C3%BCltige%20Tabelle%20wie%20folgt%20zu%20erhalten%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA1%20(B1)%20%5BC1%5D%2C%20A2%20(B2)%20%5BC2%5D%2C%3C%2FP%3E%3CP%3EWert%2011%2C%20Wert%2021%3C%2FP%3E%3CP%3EWert%2012%2C%20Wert%2022%3C%2FP%3E%3CP%3EWert%2013%2C%20Wert%2023%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIch%20m%C3%B6chte%20eine%20neue%20Spalteneigenschaft%20erstellen%2C%20die%20das%20As%20in%20dieser%20endg%C3%BCltigen%20Tabelle%20speichert.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBen%C3%B6tige%20ich%20eine%20Schleife%20mit%20zwei%20Listen%2C%20um%20diese%20Eigenschaft%20spaltenweise%20einzuf%C3%BCgen%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-372689%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EDatenmischung%20und%20-bereinigung%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-373572%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Metadaten%20in%20einer%20Tabelle%20aufzeichnen%20und%20wiederherstellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-373572%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESchauen%20Sie%20sich%20Assoziative%20Arrays%20an%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-373550%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Metadaten%20in%20einer%20Tabelle%20aufzeichnen%20und%20wiederherstellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-373550%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EManchmal%20kann%20As%20das%20Muster%20%E2%80%9Eabc%20(cde)%E2%80%9C%20haben%2C%20daher%20ist%20es%20besser%2C%20eine%20Zuordnung%20aus%20der%20ersten%20Tabelle%20anstelle%20von%20Word()%20zu%20verwenden.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Gibt%20es%20ein%20JSL-W%C3%B6rterbuch%2C%20das%20wir%20verwenden%20k%C3%B6nnen%2C%20sodass%20der%20Schl%C3%BCssel%20der%20Spaltenname%20und%20der%20Wert%20die%20neue%20zu%20speichernde%20Eigenschaft%20ist%3F%3CBR%20%2F%3E%20%7B%22A1%20(B1)%20%5BC1%5D%22%3A%20%22A1%22%2C%3CBR%20%2F%3E%20%E2%80%9EA2%20(B2)%20%5BC2%5D%E2%80%9C%3A%20%E2%80%9EA2%E2%80%9C%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-372752%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Metadaten%20in%20einer%20Tabelle%20aufzeichnen%20und%20wiederherstellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-372752%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EWenn%20ich%20richtig%20verstehe%2C%20was%20Sie%20wollen%20%E2%80%93%20Sie%20haben%20den%20Eigenschaftswert%20bereits%20im%20Spaltennamen%2C%20sodass%20Sie%20ihn%20von%20dort%20abrufen%20k%C3%B6nnen%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Adt%20%3D%20New%20Table(%22Untitled%22%2C%0A%20Add%20Rows(3)%2C%0A%20Compress%20File%20When%20Saved(1)%2C%0A%20New%20Column(%22A1%20(B1)%20%5BC1%5D%22%2C%0A%20%20Character%2C%0A%20%20%22Nominal%22%2C%0A%20%20Set%20Values(%7B%22Value%2011%22%2C%20%22Value%2012%22%2C%20%22Value%2013%22%7D)%0A%20)%2C%0A%20New%20Column(%22A2%20(B2)%20%5BC2%5D%22%2C%0A%20%20Character%2C%0A%20%20%22Nominal%22%2C%0A%20%20Set%20Values(%7B%22Value%2021%22%2C%20%22Value%2022%22%2C%20%22Value%2023%22%7D)%0A%20)%0A)%3B%0A%0AcolNames%20%3D%20dt%20%26lt%3B%26lt%3B%20Get%20Column%20Names(%22String%22)%3B%0A%0AFor(i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20Items(colNames)%2C%20i%2B%2B%2C%0A%20aVal%20%3D%20Word(1%2C%20colNAmes%5Bi%5D)%3B%0A%20Column(dt%2C%20colNames%5Bi%5D)%20%26lt%3B%26lt%3B%20Set%20Property(%22A_property%22%2C%20aVal)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-372740%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Metadaten%20in%20einer%20Tabelle%20aufzeichnen%20und%20wiederherstellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-372740%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ESicher.%3CBR%20%2F%3E%3CBR%20%2F%3E%20Spalte%3A%20A1%20(B1)%20%5BC1%5D%3CBR%20%2F%3E%20A_Eigenschaft%3A%20A1%3CBR%20%2F%3E%3CBR%20%2F%3E%20Spalte%3A%20A2%20(B2)%20%5BC2%5D%3CBR%20%2F%3E%20A_Eigenschaft%3A%20A2%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-372704%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Metadaten%20in%20einer%20Tabelle%20aufzeichnen%20und%20wiederherstellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-372704%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EK%C3%B6nnen%20Sie%20ein%20Beispiel%20daf%C3%BCr%20geben%2C%20wie%20der%20Inhalt%20der%20neuen%20Spalteneigenschaft%20aussehen%20w%C3%BCrde%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
FN
FN
Level VI

Recording and recovering metadata in a table

I have a stacked data table with three columns that contain strings and another numeric. 

 

A: unique identifier

B: text

C: text

 

As, Bs, Cs, Values

-----

A1, B1, C1, value11

A1, B1, C1, value12

A1, B1, C1, value13

A2, B2, C2, value21

A2, B2, C2, value22

A2, B2, C2, value23

 

Right now, I am creating a concatenated column name with the form "A (B) [C]" which I split to have the final table like so:

 

A1 (B1) [C1],  A2 (B2) [C2], 

Value 11,        Value 21 

Value 12,        Value 22

Value 13,         Value 23

 

I want to create a new column property that saves the As in this final table.

 

Do I need a loop with two lists to insert this property column by column?

 

5 REPLIES 5
txnelson
Super User

Re: Recording and recovering metadata in a table

Can you provide an example of what the contents of the new column property would look like?
Jim
FN
FN
Level VI

Re: Recording and recovering metadata in a table

Sure.

Column: A1 (B1) [C1]
A_property: A1

Column: A2 (B2) [C2]
A_property: A2
jthi
Super User

Re: Recording and recovering metadata in a table

If I understand correctly what you want - You have the property value already in the column name so you can could get it from there:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(3),
	Compress File When Saved(1),
	New Column("A1 (B1) [C1]",
		Character,
		"Nominal",
		Set Values({"Value 11", "Value 12", "Value 13"})
	),
	New Column("A2 (B2) [C2]",
		Character,
		"Nominal",
		Set Values({"Value 21", "Value 22", "Value 23"})
	)
);

colNames = dt << Get Column Names("String");

For(i = 1, i <= N Items(colNames), i++,
	aVal = Word(1, colNAmes[i]);
	Column(dt, colNames[i]) << Set Property("A_property", aVal);
);
-Jarmo
FN
FN
Level VI

Re: Recording and recovering metadata in a table

Sometimes As can have the pattern "abc (cde)" so better to use a mapping from the first table instead of Word().

is there a JSL dictionary we can use so the key is the column name and the value is the new property to save?
{"A1 (B1) [C1]": "A1",
"A2 (B2) [C2]": "A2"}
jthi
Super User

Re: Recording and recovering metadata in a table

Check out Associative Arrays

-Jarmo

Recommended Articles