cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ntg_007
Regular Visitor

ForAll Patch needs two clicks?

For some reason my ForAll Patch only works when clicked a second time. I'm not sure why - here's my code on the OnSelect of the button

 


Set(var_startsurvey, Gallery5_3.Selected.Name)
;
UpdateContext({Timergo: false})
;
Reset(Timer2_1)

;
UpdateContext({Popup: true})
;
UpdateContext({Timergo: true})
;


ForAll(
Gallery2.AllItems,
Patch(
'SCW Data Mappings',

{Definition: Label_definition_n.Text},
{'Common Problem': Label_common_problem_n.Text},
{'Core Service': Label_coreservice_n.Text},
{Sector: Label_sector_n.Text},
{'SOW Service': Label_sowservice_n.Text},
{'Sub Category': Label_subcategory},
{Name: var_startsurvey},
{Trade: Label_Trade_n.Text}
)
)

 

2 REPLIES 2
C-Papa
Super User
Super User

Hi, what is the timer doing when the time is reached? If you run the ForAll first you should get an idea if the rest of the code is causing an issue. i would re arrange it like the below. also you haven;'t specificied if you want to update an existing item or create a new item in the patch. i have adjusted it to create a new item each time. if you want to edit an item you will need to change Defaults('SCW Data Mappings') with {ID:ID}

 

ForAll(Gallery2.AllItems,Patch(
'SCW Data Mappings',
Defaults('SCW Data Mappings'),
{Definition: Label_definition_n.Text,
'Common Problem': Label_common_problem_n.Text,
'Core Service': Label_coreservice_n.Text,
Sector: Label_sector_n.Text,
'SOW Service': Label_sowservice_n.Text,
'Sub Category': Label_subcategory,
Name: var_startsurvey,
Trade: Label_Trade_n.Text}
))

;Set(var_startsurvey, Gallery5_3.Selected.Name)
;UpdateContext({Timergo: false, Popup: true, Timergo: true})
;Reset(Timer2_1)

ntg_007
Regular Visitor

The timer stops a spinning animation and overlay. I was concerned that this was causing the issue but I can't figure out another way to set and update the variables when the button is clicked. 

I'm wondering if the second click works because the first global variable is already set? 

 

I've added the Defaults to the patch formula. Thanks for catching that. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,680)