New Table( "inputdata",
Add Rows( 308 ),
New Column( "dates",
Character,
Nominal,
Set Values(
{"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "07/10/2017", "07/17/2017", "07/17/2017", "07/17/2017",
"07/17/2017", "07/17/2017", "07/17/2017", "07/24/2017", "07/24/2017",
"07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017", "07/24/2017",
"07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017", "07/10/2017",
"07/10/2017", "", ""}
)
),
New Column( "codes",
Numeric,
Continuous,
Format( "Best", 8 ),
Set Values(
[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4]
)
));Yes. I'll paste the short script with the if loop below. and the data set is attached above.
Thank you for looking at this already!
Script:
dtt=Data table("inputdata");
//option 1, not working as desired
colc=dtt<<NewColumn("codefin",Formula(Char(:dates)||"_"||Char(:codes)));
IDs=dtt<<New Column( "ID",
Numeric,
Continuous,
Format("Best", 8 ),
Formula(If( Row() == 1,
Summarize( bygroup = by( :dates) );
If( bygroup[1] == "",
newbygroup = Remove( bygroup, 1 ),
newbygroup = bygroup
);
);
(Loc( newbygroup, :dates ) - 1) * 7 + :codes;),
get selected
);