The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Highlighted
Level II

Custom new formula columns based on N dynamically stacked data tables

Hi,

From a main dataset I create N stacked data tables based on N different parameter types and store them under stkdata.

With each stacked data table I want to create a different new column() formula which would be tailored to the unique length and/or nature of how the fields are delimited. Then I will graph each stacked data set & make reference to data from the new column(s). Currently the graphs are set up making reference to :Data & :Label.

• I can get the same formula to be applied across data tables just fine & graph them.
• I can't quite figure out how to properly structure the if else scenario or narrow down tools that would be most appropriate (Regex, Pat Match or other).

Partial code:

``````If( N Items( found_list ) > 0,
//dt << group columns( one_group, found_list );
stkdata = dt << Stack(
columns( As List( found_list ) ),
Keep( :reference_param_one, :reference_param_two),
Output Table( "Stacked " || one_group ),
); // close stacking of columns

colreference = Column( "Label" );

If(
stkdata = Current Data Table();
Pat Match( colreference, "param_group_one" ),
stkdata << New Column( "Limit_one",
"Character",
Formula( Num( Word( 2, Word( 27, :Label, ":" ), "=" ) ) )
);

Pat Match( colreference, "param_group_two" ),
stkdata << New Column( "Limit_two",
"Character",
Formula( Num( Word( 2, Word( 75, :Label, ":" ), "=" ) ) )
);

Pat Match( colreference, "param_group_three" ),
stkdata << New Column( "Limit_three",
"Character",
Formula( Num( Word( 2, Word( 29, :Label, ":" ), "=" ) ) )

);

stkdata << Oneway( Y( :Data ), X( :Label ) )

); // close If N Items (found_list) > 0
``````
Article Labels

There are no labels assigned to this post.