cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Delete Empty Columns
robot
Level VI

This JSL script will delete empty data columns.

Comments
fitri

my version as below .

dt = Current Data Table();

For( i = N Col( dt ), i >= 1, i--,

       If( (Col N Missing( Column( i ) ) / N Row()) == 1,

              dt << delete columns( i )

       )

);

Thomas1

Simple and effective. Thanks

Thanks 😁

dspa

Piggybacking off @fitri , this worked for me

// get col names
colnames = dt << Get Column Names;

// delete empty columns
For( j = 1, j <= N Items( colnames ), j++,
	If( Col N Missing( Column( colnames[j] ) ) / N Row() == 1,
		dt << delete columns( colnames[j] )
	)
);