Hi. I'm making Shift Work calendar in powerapps.(4 groups 3 shift - A, B, C, D)
but I met a problem...
I want to make it like under picture.
>>>>
Our Shift work order is Morning 3 days > rest 1 day > Swing 3 days > rest 1 day > Night 3 days > rest 1day .....
ex). 2022-01-01 - Morning : 'D group', Swing : 'A group', Night : 'C group'
2022-01-02 - Morning : 'D group', Swing : 'A group', Night : 'B group'
2022-01-03 - Morning: 'D group', Swing : 'C group', Night : 'B group' .................
please help.. T-T..
Solved! Go to Solution.
Hi @Zingoo :
According to your requirements, the schedule should be a cycle of 12 days.So the first step, I will first construct an auxiliary table as the basis for the loop.
ClearCollect(
ALoop,
{NO:1,Morning:"D",Swing:"B",Night:"C"},
{NO:2,Morning:"D",Swing:"A",Night:"C"},
{NO:3,Morning:"D",Swing:"A",Night:"B"},
{NO:4,Morning:"C",Swing:"A",Night:"B"},
{NO:5,Morning:"C",Swing:"D",Night:"B"},
{NO:6,Morning:"C",Swing:"D",Night:"A"},
{NO:7,Morning:"B",Swing:"D",Night:"A"},
{NO:8,Morning:"B",Swing:"C",Night:"A"},
{NO:9,Morning:"B",Swing:"C",Night:"D"},
{NO:10,Morning:"A",Swing:"C",Night:"D"},
{NO:11,Morning:"A",Swing:"B",Night:"D"},
{NO:0,Morning:"A",Swing:"B",Night:"C"}
)
Next, use this formula to get the schedule for the whole year of 2022:
ForAll(
Sequence(365,1,1),
With(
{TheRecord:LookUp(ALoop,NO=Mod(Value,12))},
{
Date:DateAdd(Date(2022,1,1),Value-1,Days),
Morning:TheRecord.Morning,
Swing:TheRecord.Swing,
Night:TheRecord.Night
}
)
)
Best Regards,
Bof
Hi @Zingoo :
According to your requirements, the schedule should be a cycle of 12 days.So the first step, I will first construct an auxiliary table as the basis for the loop.
ClearCollect(
ALoop,
{NO:1,Morning:"D",Swing:"B",Night:"C"},
{NO:2,Morning:"D",Swing:"A",Night:"C"},
{NO:3,Morning:"D",Swing:"A",Night:"B"},
{NO:4,Morning:"C",Swing:"A",Night:"B"},
{NO:5,Morning:"C",Swing:"D",Night:"B"},
{NO:6,Morning:"C",Swing:"D",Night:"A"},
{NO:7,Morning:"B",Swing:"D",Night:"A"},
{NO:8,Morning:"B",Swing:"C",Night:"A"},
{NO:9,Morning:"B",Swing:"C",Night:"D"},
{NO:10,Morning:"A",Swing:"C",Night:"D"},
{NO:11,Morning:"A",Swing:"B",Night:"D"},
{NO:0,Morning:"A",Swing:"B",Night:"C"}
)
Next, use this formula to get the schedule for the whole year of 2022:
ForAll(
Sequence(365,1,1),
With(
{TheRecord:LookUp(ALoop,NO=Mod(Value,12))},
{
Date:DateAdd(Date(2022,1,1),Value-1,Days),
Morning:TheRecord.Morning,
Swing:TheRecord.Swing,
Night:TheRecord.Night
}
)
)
Best Regards,
Bof