BookmarkSubscribe
Choose Language Hide Translation Bar
rfeick
Community Trekker

Munger Columns with Variable Names

I have a script that calculates progress data for a list of projects. One section creates a summary table to calculate the number of days each project spends in a given phase. The issue is that the :day:hr:m when I just want the number of days (For example: 17 rather than :17:00:00). Is there an easy way to do this? I've tried every possible way I can think of. I attached the relevent section of the script and the table that it generates.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
mpl34
Community Trekker

Re: Munger Columns with Variable Names

You can cycle through the columns and replace the values, but there must be a better way. This converts the test table range columns:

namesdefaulttohere(1);
dt=currentdatatable();
for(i=1,i<=ncols(dt), i++,
	if(contains(columnname(i),"Range")>0,
		repmat=indays(column(dt,i)<<getasmatrix)/(24*60*60)^2;
		column(dt,i)<<setvalues(repmat)<<format("Best");
	)
);

View solution in original post

0 Kudos
3 REPLIES 3
rfeick
Community Trekker

Re: Munger Columns with Variable Names

 
0 Kudos
mpl34
Community Trekker

Re: Munger Columns with Variable Names

You can cycle through the columns and replace the values, but there must be a better way. This converts the test table range columns:

namesdefaulttohere(1);
dt=currentdatatable();
for(i=1,i<=ncols(dt), i++,
	if(contains(columnname(i),"Range")>0,
		repmat=indays(column(dt,i)<<getasmatrix)/(24*60*60)^2;
		column(dt,i)<<setvalues(repmat)<<format("Best");
	)
);

View solution in original post

0 Kudos
rfeick
Community Trekker

Re: Munger Columns with Variable Names

Why is the denominator (24*60*60)^2 and not just (24*60*60)?

0 Kudos