cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sifu
Post Prodigy
Post Prodigy

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
Post Prodigy
Post Prodigy

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
Post Prodigy
Post Prodigy

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"}
    )
);

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,962)