Data table number to Data table name with contains and EvalHello
The code currently works via data table number (dtlist)but what I need is the Eval to find a table based on contains then update it.
so something like Eval(contains(dtlist,("xx4") then update. if that's even possible?
Names Default To Here( 1 );
dtLIst = {};
For( i = 1, i <= N Table(), i++,
dt = data table(i);
insert into(dtList, dt );
);
eval(dtList[4]) << Update(
With( Data Table( "Sales" ) ),
Add Columns from Update table( :Name( "XX1" ) ));
eval(dtList[5]) << Update(
With( Data Table( "Sales" ) ),
Add Columns from Update table( :Name( "XX2" ) ))many thanks
Data TableScriptingRe: Data table number to Data table name with contains and EvalI think this will give you what you want
Names Default To Here( 1 );
For( i = 1, i <= N Table(), i++,
If( Contains( Data Table( i ) << get name, "XX1" ),
Break()
)
);
If( i <= N Table(),
Data Table( i ) << Update(
With( Data Table( "Sales" ) ),
Add Columns from Update table( :Name( "XX1" ) )
)
);
For( i = 1, i <= N Table(), i++,
If( Contains( Data Table( i ) << get name, "XX2" ),
Break()
)
);
If( i <= N Table(),
Eval( dtList[5] ) << Update(
With( Data Table( "Sales" ) ),
Add Columns from Update table( :Name( "XX2" ) )
)
);
Re: Data table number to Data table name with contains and EvalPerfect thank you!
Re: Data table number to Data table name with contains and Eval@txnelson
how would I add a calculation to the table? I assume its something like
For( q = 2, q <= N Items( cols ), q++,
For Each Row( cols[q][] = cols[q][] / :Name("xxx2") * 1000000 )but I can't quite figure out how to put it in the code above?
using the code
For( i = 1, i <= N Table(), i++,
If( Contains( Data Table( i ) << get name, "xxx" ),
Break()
)
);
If( i <= N Table(),
Data Table( i ) << Update(
With( Data Table( "Sales" ) ),
Add Columns from Update table( :Name( "xxx2" ) )
)
);
many thanks for your help
Re: Data table number to Data table name with contains and EvalWhere does the variable "cols" come from. Is it a List variable, containing the column name of each of the columns in the updated data table?
In your calculation, are you attempting to change the data in already existing columns, or are you attempting to create new columns in the data table?
Re: Data table number to Data table name with contains and EvalCols is basically dt << get names then dt is current data table which I know might not be helping.
Change the data that’s there with the calculation then delete the new column added to make the calculation.