Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8620

Having trouble referencing row number in computed field

$
0
0

Greetings All,

 

I need to calculate during based on values that are grouped by days.

 

So I have the following datawindow values where I group data by date:

 

 

DATE           START                    END                         DURATION         

 

03/01/14                                                                             7:15

 

                    03/01/14 08:00        03/01/14 09:15

                    03/01/14 10:00        03/01/14 10:15

                    03/01/14 12:00        03/01/14 13:15

                    03/01/14 14:00        03/01/14 15:15

 

03/02/14                                                                             7:00

 

                    03/02/14 08:00        03/02/14 09:15

                    03/02/14 10:00        03/02/14 10:15

                    03/02/14 12:00        03/02/14 13:15

                    03/02/14 14:00        03/02/14 15:00

 

03/03/14                                                                             6:45

 

                    03/03/14 08:00        03/03/14 09:15

                    03/03/14 10:00        03/03/14 10:15

                    03/03/14 12:00        03/03/14 13:15

                    03/03/14 14:00        03/03/14 14:45

 

I want to create a computed field called duration in Group 1 as shown above in RED. Duration is END datetime for the day minus the START datetime for the day. But I am having trouble referring to the END datetime by row number.

 

I can easily create a compute field that tells me how many rows are in each group as "count(  confirmation_no  for group 1 )".

 

But when I try to create the computed field (in RED), I get a error telling me that 'Column number is not valid'.

 

secondsafter(  time(string(start_datetime[1],'HH:MM')) , time(string( end_datetime[count(  confirmation_no  for group 1 )],'HH:MM')) )

 

So I created an intermediate computed field called 'compute_rows_for_date' using "count(  confirmation_no  for group 1 )".

 

secondsafter(  time(string(start_datetime[1],'HH:MM')) , time(string( end_datetime[compute_rows_for_date],'HH:MM')) )

 

But the above gives me the same error: 'Column number is not valid'

 

When I simply type in a row number it works fine, but it will not give me the correct result:

 

secondsafter(  time(string(onscene_datetime[1],'HH:MM')) , time(string( unload_datetime[4],'HH:MM')) )

 

Can someone kindly tell me how I can calculate how many rows are in Group 1 and use that value to refer to the END datetime in the last row in the group?

 

Thanks very much!!

 

Paul


Viewing all articles
Browse latest Browse all 8620

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>