Powerapps Syntax Issue

Copper Contributor

Hi All,

I am working on a power app and trying to modify a template that creates a timesheet app.

I have added a column in SharePoint called Projects which is a drop down column.

In the App I am setting the variable Set(varProjects) with the names of the projects I want to enable for selection.

When the page loads the onVisible function runs and populates the fields with the default values but I cannot get the Projects one to work.

 

// true: populate collection with default values
ForAll([6,5,4,3,2,1,0],
Collect(colTimesheetDetails,{
'Employee Email':varUser.Email,
'Week End': DateValue(LblWeekEndDate.Text),
WeekEndNum: Text(DateValue(LblWeekEndDate.Text),"yyyymmdd"),
'Day of Week': DateValue(LblWeekEndDate.Text)-Value,
DayofWeekNum: Text(DateValue(LblWeekEndDate.Text)-Value,"yyyymmdd"),
'Day Start': {Value:If(Value=6||Value=5,"00:00",varDayStart)},
'Lunch Start': {Value:If(Value=6||Value=5,"00:00",varLunchStart)},
'Lunch Finish': {Value:If(Value=6||Value=5,"00:00",varLunchEnd)},
'Day End': {Value:If(Value=6||Value=5,"00:00",varDayEnd)},
BreakHours:0,
PaidHours:If(Value=6||Value=5,0,7.5),
Project: {Value:("4 Work", varProject)},
'Approval Status': {Value:"In Progress"}

 

It does not like the code for setting the Project value to the default of 4 Work.

 

Then on the app pages I use the function OnChange on the drop down to trigger a patch to update the value in the collection but this is not working either.

 

Patch(colTimesheetDetails,ThisItem,{Project:DdProject.Selected,});

 

I have tried all sorts but this is based on another field in the template, when I run the app it just switches back to the first item in the list and so is not updating the page.

 

Anyone able to help me out?

0 Replies