I have a data table that looks like this,
I want to change it to something like this.
How do I do this in JSL? I don't have a reference column to split this against, but I know odd rows will be my first entry, and even rows will be my second entry always.
Create new column with the knowledge you have about odd and even rows and use that as your Split By column
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(8),
Compress File When Saved(1),
New Column("Column 1",
Character,
"Nominal",
Set Values(
{"Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1"}
)
),
New Column("Column 2",
Character,
"Nominal",
Set Values(
{"Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1"}
)
),
New Column("Column 3",
Character,
"Nominal",
Set Values({"A", "1", "B", "2", "C", "3", "D", "4"})
)
);
dt << New Column("By", Character, Nominal, Formula(
If(Mod(Row(), 2),
"Data 1";
,
"Data 2";
);
));
dt_split = dt << Split(
Split By(:By),
Split(:Column 3),
Output Table("Untitled 29.jmp"),
Sort by Column Property
);
Create new column with the knowledge you have about odd and even rows and use that as your Split By column
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(8),
Compress File When Saved(1),
New Column("Column 1",
Character,
"Nominal",
Set Values(
{"Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1"}
)
),
New Column("Column 2",
Character,
"Nominal",
Set Values(
{"Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1", "Test1"}
)
),
New Column("Column 3",
Character,
"Nominal",
Set Values({"A", "1", "B", "2", "C", "3", "D", "4"})
)
);
dt << New Column("By", Character, Nominal, Formula(
If(Mod(Row(), 2),
"Data 1";
,
"Data 2";
);
));
dt_split = dt << Split(
Split By(:By),
Split(:Column 3),
Output Table("Untitled 29.jmp"),
Sort by Column Property
);