Hi All,
Is there any way to combine these two operations (Creating a new columns and then running a ForLoop) to a single one ?
I have repeated Customer Ids in a columns and then it changes at some point and 2nd ID keeps on repeating and then 3rd one and so on. I want to create a new column say, Unq_Id and its values should be empty until Customer_Id changes. I can do this in script below, but I am wondering if there is any better way to do it ? This means - running a loop inside Column Formula, or something similar !
dt << New Column( “Unq_ID”, Numeric, Continuous, Set Each Value() );
dt << Sort( by( :Customer_ID ), Order( Ascending ), Replace Table( 1 ) );
For( i = 1, i <= N Rows( dt ), i++,
If(
:Customer_ID[i] == :Customer_ID[i + 1]
,
:Unq_ID[i] = :Customer_ID[i]
)
);
Any suggestion?
thanks, Hari