cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-437747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3EAdd%20option%20to%20prevent%20unexpected%20new%20column%20creation%20from%20table%20variables%20in%20concatenate.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-437747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3EAfter%20running%20this%20script%20dt3%20will%20contain%20a%20column%20'a'.%20When%20using%20concatenate%20in%20a%20script%20this%20can%20result%20in%20unexpected%20behavior%20or%20the%20need%20to%20manually%20remove%20variables%20that%20are%20not%20used%20in%20the%20table.%20(Example%3A%20the%20'SQL'%20table%20variable%20automatically%20added%20to%20tables%20returned%20from%20SQL%20Queries.)%20Provide%20an%20option%20in%20Concatenate()%20to%20rename%20duplicate%20table%20variables%20before%20concatenation%20if%20they%20would%20result%20in%20a%20new%20column.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20default%20to%20here(1)%3B%0A%0Adt1%20%3D%20New%20Table(%20%22Test%22%2C%20Add%20Rows(1)%2C%20New%20Table%20Variable(%20%22a%22%2C%201%20)%20)%3B%0Adt2%20%3D%20New%20Table(%20%22Test%22%2C%20Add%20Rows(1)%2C%20New%20Table%20Variable(%20%22a%22%2C%202%20)%20)%3B%0A%0Adt3%20%3D%20dt1%20%26lt%3B%26lt%3B%20Concatenate(%20dt2%20)%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-437747%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3EAutomation%20and%20Scripting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
0 Kudos

Add option to prevent unexpected new column creation from table variables in concatenate.

After running this script dt3 will contain a column 'a'. When using concatenate in a script this can result in unexpected behavior or the need to manually remove variables that are not used in the table. (Example: the 'SQL' table variable automatically added to tables returned from SQL Queries.) Provide an option in Concatenate() to rename duplicate table variables before concatenation if they would result in a new column. 

 

Names default to here(1);

dt1 = New Table( "Test", Add Rows(1), New Table Variable( "a", 1 ) );
dt2 = New Table( "Test", Add Rows(1), New Table Variable( "a", 2 ) );

dt3 = dt1 << Concatenate( dt2 );