Write a function to join data tablesI was trying to write a function to join dt2 to dt1, however, I cannot get it to work at all... The error I got is "Name Unresolved: TrimTable at row 1 in access or evaluation of 'TrimTable' , TrimTable( dt1[1] ) /*###*/"
What is wrong?
Much appreciated for the help!
join_data_table = Function({dt1, dt2},
{Default Local},
dt_1 = TrimTable(dt1[1]);
dt_2 = TrimTable(dt2[1]);
dt_1 << Join(
With(dt_2),
Merge Same Name Columns,
By Matching Columns(:"Seq No"n = :Seq No),
Drop multiples(1, 0),
Include Nonmatches(1, 0),
Preserve main table order(1)
);
Return(dt1);
);
Automation and ScriptingWindowsRe: Write a function to join data tablesWhat is dt1 supposed to contains? What does TrimTable do? Could be that TrimTable() function is missing.
Maybe you want something like this?
Names Default To Here(1);
join_data_table = Function({dt1, dt2}, {Default Local},
dt = dt1 << Join(
With(dt2),
Merge Same Name Columns,
By Matching Columns(:name = :name), // Seq No changed to Name
Drop multiples(1, 0),
Include Nonmatches(1, 0),
Preserve main table order(1)
);
return(dt);
);
dt_bc = Open("$SAMPLE_DATA/Big Class.jmp");
dt_bcf = Open("$SAMPLE_DATA/Big Class Families.jmp");
join_data_table(dt_bc, dt_bcf);