cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sifu
Responsive Resident
Responsive Resident

Summary of gallery changes is not saved correctly

Hi,

have an app with multiple screens that is kind of based on few SharePoint list and with PowerApps i just customized one of those and connected to other as well.

All together i am connected to 6 lists and one MS 365 users connector.

 

One screen has a gallery that looks inside one of these SPO lists. Gallery items is:

 

 

 

Filter(tna,UPN=upn_label_5.Text, YearMonth=Dropdown_month.SelectedText.Result)

 

 

 

  • upn - text field
  • upn_label_5.text: label with 

 

 

 

Microsoft365Users.MyProfileV2().userPrincipalName​

 

 

 

  • yearmonth -  number
  • Dropdown_month - dropdown that looks again into tna lists and offers user items where his upn is used....: 

 

 

 

Distinct(Filter(tna,MonthlyApproval="Open",UPN=upn_label_5.Text).YearMonth,YearMonth).Result

 

 

 

 an item in gallery has 23 elements but only few are visible (+/-4 depending on conditions the user is saving)

 

at the bottom of the screen i have few label fields that look into the gallery and give me some kind of summary, for example how many days are recorded and similar... one example would be this "sum_days_office_value":

 

 

CountIf(Gallery3.AllItems, IsBlank(activitygallery.Text),Value(hoursworked.Text)>0)

 

 

and even it gives me correct result on the screen, once i save this to SPO list, its wrong!

 

Saving happens following

 

 

 

// save values to tna and change the column monthlyapproval from OPEN to PENDING
ForAll(Gallery3.AllItems,
    UpdateIf(
        tna, ID = Value(idvalue.Text),
        {StartTime:from.Text, EndTime: to.Text, TimeAtWork: Value(hoursworked.Text), BreakInHours: Value(break.Text) , PassiveTravelTimeStart: pttstart.Text, PassiveTravelTimeEnd:pttend.Text, PassiveTravelTimeDurringWorkTime: pttdw.Text, MonthlyApproval: "Pending"}
    )
);

// save request to AR
Patch(
    'Absence Request',
    Defaults('Absence Request'),
    {
        TypeOfRequest: "TimeSheet",
        TimeSheetPeriod:Dropdown_month.SelectedText.Value,
        UPN: upn_label_5.Text,
        ApprovalStatus:"Pending",
        DaysInOffice: Value(sum_days_office_value.Text),
        DaysInHomeOffice: Value(sum_days_homeoffice_value.Text),
        DaysOnBT:Value(sum_days_biztrip_value.Text),
        DaysOnHoliday:Value(sum_days_holiday_value.Text),
        RequiredTime: Value(totalreqtime_value.Text),
        YourTime: Value(totalyourtime_value.Text)
    }
);

 

 

 

 

Question: how to make the fields like sum_days_office_value correct in SPO list? I suspect the value might change in process of saving

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sifu
Responsive Resident
Responsive Resident

i guess i solved it(?)... patch had to be first/before updateif ...some stuff i realize when i have to describe it 😄

 

 

// save request to AR
Patch(
    'Absence Request',
    Defaults('Absence Request'),
    {
        TypeOfRequest: "TimeSheet",
        TimeSheetPeriod:Dropdown_month.SelectedText.Value,
        UPN: upn_label_5.Text,
        ApprovalStatus:"Pending",
        DaysInOffice: Value(sum_days_office_value.Text),
        DaysInHomeOffice: Value(sum_days_homeoffice_value.Text),
        DaysOnBT:Value(sum_days_biztrip_value.Text),
        DaysOnHoliday:Value(sum_days_holiday_value.Text),
        RequiredTime: Value(totalreqtime_value.Text),
        YourTime: Value(totalyourtime_value.Text)
    }
);

// save values to tna and change the column monthlyapproval from OPEN to PENDING
ForAll(Gallery3.AllItems,
    UpdateIf(
        tna, ID = Value(idvalue.Text),
        {StartTime:from.Text, EndTime: to.Text, TimeAtWork: Value(hoursworked.Text), BreakInHours: Value(break.Text) , PassiveTravelTimeStart: pttstart.Text, PassiveTravelTimeEnd:pttend.Text, PassiveTravelTimeDurringWorkTime: pttdw.Text, MonthlyApproval: "Pending"}
    )
);

 

View solution in original post

1 REPLY 1
Sifu
Responsive Resident
Responsive Resident

i guess i solved it(?)... patch had to be first/before updateif ...some stuff i realize when i have to describe it 😄

 

 

// save request to AR
Patch(
    'Absence Request',
    Defaults('Absence Request'),
    {
        TypeOfRequest: "TimeSheet",
        TimeSheetPeriod:Dropdown_month.SelectedText.Value,
        UPN: upn_label_5.Text,
        ApprovalStatus:"Pending",
        DaysInOffice: Value(sum_days_office_value.Text),
        DaysInHomeOffice: Value(sum_days_homeoffice_value.Text),
        DaysOnBT:Value(sum_days_biztrip_value.Text),
        DaysOnHoliday:Value(sum_days_holiday_value.Text),
        RequiredTime: Value(totalreqtime_value.Text),
        YourTime: Value(totalyourtime_value.Text)
    }
);

// save values to tna and change the column monthlyapproval from OPEN to PENDING
ForAll(Gallery3.AllItems,
    UpdateIf(
        tna, ID = Value(idvalue.Text),
        {StartTime:from.Text, EndTime: to.Text, TimeAtWork: Value(hoursworked.Text), BreakInHours: Value(break.Text) , PassiveTravelTimeStart: pttstart.Text, PassiveTravelTimeEnd:pttend.Text, PassiveTravelTimeDurringWorkTime: pttdw.Text, MonthlyApproval: "Pending"}
    )
);

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (4,669)