Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cocatenate all columns of any given table dynamically

Hi all,

I'm checking data in two tables(Same Strucy) present in two different systems is same or not.

Loaded the first table and while loading the second table I'm trying to use the exists(All_Fileds_Tab1,All_Fields_Tab2) function. In my requirement I need to validate the data accross multiple table for which I need to create a field.

All_Fileds_Tab1: Concatenate all fields from table 1.

All_Fields_Tab2: Concatenate all fields from table 2.

I'm Trying to build a frameworks which can work across any given table, i.e code should be table independent..i.e it should work for any table.

Question

1. How can I concatenate all fields in any given table, I want a dynamic concatenate statement which can concatenate all fields in any given table.

Thanks

Ranjith

1 Reply
maxgro
MVP
MVP

// test data

table:

Load

TransLineID,

TransID,

mod(TransID,26)+1 as Num,

Pick(Ceil(3*Rand1),'A','B','C') as Dim1,

Pick(Ceil(6*Rand1),'a','b','c','d','e','f') as Dim2,

Pick(Ceil(3*Rand()),'X','Y','Z') as Dim3,

Round(1000*Rand()*Rand()*Rand1) as Expression1,

Round(  10*Rand()*Rand()*Rand1) as Expression2,

Round(Rand()*Rand1,0.00001) as Expression3;

Load

Rand() as Rand1,

IterNo() as TransLineID,

RecNo() as TransID

Autogenerate 1000

While Rand()<=0.5 or IterNo()=1;

// concat

let f='';

for i=1 to NoOfFields('table')

  let f=f & ' & ' & chr(39) & '|' & chr(39) & ' & ' & FieldName(i, 'table') ;

NEXT;

let f=right(f,len(f)-len(' & ' & chr(39) & '|' & chr(39) & ' & '));

fieldconcat:

load $(f) as line Resident table;