cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
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