Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: dhrobertsonHi All,
I'm struggling with a problem that I hope someone can help me with...
the scenario is this. I have meetings that are listed based on hours. 4 hours equates to half a day, 8 hours to a full day. the output required is not interested in hours but wants to know about the meetings in respect of half days only. I have created logic to create additional rows in order to create 2 rows for a 8 hour meeting, breaking it down into 2 half days (am/pm). my issues is around when a meeting may be split over more than 1 day. if I split 1 day it is still the same date.... when a source row specifies a meeting over 2 days however (see source input line 4 (16 hours), I need to generate 4 rows, which I can do in my logic, BUT..... my logic creates the rows with the same date (see output for the 23-09-2014).... I need to create 2 rows for the specified startdate (in this case 23-09-2014) and then add 1 day for the last 2 rows (24-09-2014). if the meeting was over 5 days it would be the same principal but over 10 rows but with 5 incrementing dates.
I hope I have made sense in my explanation??
brainscript below. any help would be greatly appreciated.
node:Static_Data
bretype:core::Static Data
editor:sortkey=551029390db05ff0
output:@40fe6c55598828e5/=
prop:StaticData=<<EOX
startdate:date, meetingid:int,hoursworked:int
2014-09-20,1111,4
2014-09-21,2222,8
2014-09-22,3333,8
2014-09-23,4444,16
EOX
editor:XY=860,150
end:Static_Data
node:Duplicate_rows_to_create_05_day_values_3
bretype:core::Filter
editor:Label=Duplicate rows to create 0.5 day values
editor:sortkey=5508476b197a264a_3
input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
output:@40fd2c7420761db6/=
prop:Script=<<EOX
rowcounter = hoursworked / 4
DAYVALUECALC = 0.5
output 1
{
emit rowcounter
emit hoursworked
emit meetingid
emit startdate
emit "a" as DAYVALUECALC
where false
}
i = 1
while i <= rowcounter
{
do output 1
{
emit rowcounter
emit hoursworked
emit meetingid
emit startdate
emit DAYVALUECALC
}
i = i+1
}
EOX
editor:XY=960,150
end:Duplicate_rows_to_create_05_day_values_3