cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ellenmflor
New Member

Fill the last row using patch fuction

Hi y'all!

I've a list with many columns, so, my app will have many screens with 3 questions maximum.

What I want is save the next information (2º Screen) in the last row (ID 35). But, I don't know how to use patch function to do it.

Could you help me pls? 

List with two rowsList with two rows

1º Screen with patch1º Screen with patch

 

2º Screen with patch2º Screen with patch

 

Thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ellenmflor ,

You left out the most important line of code

With(
   {
      wID:
      First(
         Sort(
            'Check-list de Conformidade em Subestações';
            ID;
            Descending
         )
      ).ID
   };
   Patch(
      'Check-list de Conformidade em Subestações';
      {ID: wID};
      {
         'Todas as tomadas estão identificadas com nível de tensão?': Radio1.Selected.Value;
         'O Livro de Visitas está disponível e em utilização?': Radio1_1.Selected.Value;
         'Qual a última data de utilização do livro de visitas?': DatePicker1.SelectedDate
      }
   )
);;
Navigate(
   'Página 4';
   ScreenTransition.Fade
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @Ellenmflor ,

Firsly, please post any code as Text also - I had to OCR the below, so watch spelling

With(
   {
      wID:
      First(
         Sort(
            'Check-list de Conformidade em SubestaçÔes';
            ID;
            Descending
         )
      ).ID
   };
   Patch(
      'Check-list de Conformidade em SubestaçÔes';
      {ID: wID};
      {
         Subestaçào: Dropdownl_l.Selected.Value; 
         Concessäo: Text(Label2.Text)
      }
   )
);;
Navigate(
   'Pàgina 3';
   Fade
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz 🙂

Firstly, I'm sorry about the code.
Thank you for helping.
I've tried to use sort function as you showed, but it didn't work. Results from 2º Screen jumped to another row as you can see bellow:

Results after applying new codeResults after applying new code
_______________________________________________________________________________
****Code 1º Screen:****
Patch(
'Check-list de Conformidade em Subestações';
{
Subestação: Dropdown1_1.Selected.Value;
Concessão: Text(Label2.Text)
}
);;
Navigate('Página 3';ScreenTransition.Fade)
;;
Reset(Dropdown1_1)

****Code 2º Screen:*****
With(
{
wID:
First(
Sort(
'Check-list de Conformidade em Subestações';
ID;
Descending
)
).ID
};
Patch('Check-list de Conformidade em Subestações';
{
'Todas as tomadas estão identificadas com nível de tensão?': Radio1.Selected.Value;
'O Livro de Visitas está disponível e em utilização?': Radio1_1.Selected.Value;
'Qual a última data de utilização do livro de visitas?':DatePicker1.SelectedDate
}
)
);;
Navigate('Página 4';ScreenTransition.Fade)

Hi @Ellenmflor ,

You left out the most important line of code

With(
   {
      wID:
      First(
         Sort(
            'Check-list de Conformidade em Subestações';
            ID;
            Descending
         )
      ).ID
   };
   Patch(
      'Check-list de Conformidade em Subestações';
      {ID: wID};
      {
         'Todas as tomadas estão identificadas com nível de tensão?': Radio1.Selected.Value;
         'O Livro de Visitas está disponível e em utilização?': Radio1_1.Selected.Value;
         'Qual a última data de utilização do livro de visitas?': DatePicker1.SelectedDate
      }
   )
);;
Navigate(
   'Página 4';
   ScreenTransition.Fade
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz !

 

It worked like a charm! Thank you very much. 🙂 🙂 🙂

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

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.

<
Users online (3,827)