Switch(
CountRows(colEmpInfo),
0,
UpdateContext({varPopupPendMsgFlag: true});
UpdateContext({varPopupPendTitle: "Attention"});
UpdateContext({varPopupPendMsg: "You have not selected any employee for requesting award"});
UpdateContext({varPopupPendMsgColor: RGBA(255,0,0,1)}),
1,
If(
CountRows(Filter(Award, Lower(Status.Value)="pending" && Employee_Email = First(colEmpInfo).employee_email ) ) < 1,
//ThisItem.employee_email
Navigate(
'Award New Form',
ScreenTransition.Cover,
{varAccountNo: drpReqEmpAwdAccNum.SelectedText.Value}
),
UpdateContext({varPopupPendMsgFlag: true});
UpdateContext({varPopupPendTitle: "Attention"});
UpdateContext({varPopupPendMsg: "You have a pending award request for the selected employee : " & First(colEmpInfo).employee_email });
UpdateContext({varPopupPendMsgColor: RGBA(255,0,0,1)});
Clear(colEmpInfo);
), //selected one employee based on Award count
// if there are more than one employee selected, we
// need to loop through the collection colEmpInfo
ForAll( colEmpInfo,
If( CountRows(Filter(Award, Lower(Status.Value)="pending" && Employee_Email = First(colEmpInfo).employee_email ) ) < 1,
{
//TODO, we cannot use the First(colEmpInfo) because we need to iterate through the collection of employee Info
// but I am not sure the syntax of powerFx. In Java, there is enhanced for loop which I can just declare an element
// I was trying to follow the below example but I noticed in this documentation, the collection was created using Product
/**
ClearCollect( Products,
Table(
{ Product: "Widget", 'Quantity Requested': 6, 'Quantity Available': 3 },
{ Product: "Gadget", 'Quantity Requested': 10, 'Quantity Available': 20 },
{ Product: "Gizmo", 'Quantity Requested': 4, 'Quantity Available': 11 },
{ Product: "Apparatus", 'Quantity Requested': 7, 'Quantity Available': 6 }
)
)
ForAll( Products,
If( 'Quantity Requested' > 'Quantity Available',
{
Product: Product,
'Quantity To Order': 'Quantity Requested' - 'Quantity Available'
}
)
)
*/
}
)
);
Navigate(
'Multiple Awards New Form',
ScreenTransition.Cover,
{varAwdType: "emp"}
) //selected multiple employees
);
UpdateContext({resetChkEmpAwdBody: true});
UpdateContext({resetChkEmpAwdBody: false});
UpdateContext({resetNameSearch: true});
UpdateContext({resetNameSearch: false});