Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
viskovicz00012
Level II

Split if Cell Value Contains

dt3 = dt2 << Split(
        Split By( :ONP ),
        Split( :GLE, :OTS ),
        Output Table( "Split_data" ),
        Sort by Column Property);

This is a part of the automation script i made which is ran on daily schedule  -- somehow some datasets ran with this script doesnt contain both columns i.e GLE and OTS, How do i split dt2 such that it checks first if the dataset if it contains either(GLE only/OTS only) or both of them(GLE & OTS) and somehow splits the table?

1 REPLY 1
Highlighted
txnelson
Super User

Re: Split if Cell Value Contains

Here is the most straight forward version.....not the prettiest.

If(
	Try( dt2:GLE << get name, "" ) != "" &
	Try( dt2:OTS << get name, "" ) != "",
		dt3 = dt2 << Split(
			Split By( :ONP ),
			Split( :GLE, :OTS ),
			Output Table( "Split_data" ),
			Sort by Column Property
		),
	Try( dt2:GLE << get name, "" ) != "",
		dt3 = dt2 << Split(
			Split By( :ONP ),
			Split( :GLE ),
			Output Table( "Split_data" ),
			Sort by Column Property
		),
	Try( dt2:OTS << get name, "" ) != "",
		dt3 = dt2 << Split(
			Split By( :ONP ),
			Split( :OTS ),
			Output Table( "Split_data" ),
			Sort by Column Property
		)
);

 

Jim
Article Labels

    There are no labels assigned to this post.