cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Deivid
Resolver I
Resolver I

Record duplication in multiple tables

I have some items that come from a collection (arrMenu2):

 

1.png

 

Each item in arrMenu2 is linked to a Process (and every Process is linked to some client):

 

2.png

 

When I select a Process, a screen with arrMenu2 opens in a gallery:

 

3.png

 

Each item in arrMenu2 is a new screen and each of the screens is linked to a different table:

 

4.png

 

Within each screen, I bring the relationship of Customer and also of Process (of Process is the rel_Processo_NFSaida. This helps me to filter correctly, but I leave it by default Visible:False):

 

5.png

 

One of the functions requested by the client is to be able to duplicate a Process (as it ends up using a lot of similar information). I placed this button on the Process screen to duplicate records. These first two Patches are the first ones that I started to copy, and they are being copied correctly in the table of each one of them (using Dataverse).

 

6.png

 

Even making the copy correctly in Dataverse, I noticed that it is not able to bring the copied record, even if the IDs match (from what I checked):

 

7.png

 

What can I do?

10 REPLIES 10
BCBuizer
Super User
Super User

Hi @Deivid ,

 

Have you verified all fields in the copied item are populated in the data source?



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Yes, they are being filled.

BCBuizer
Super User
Super User

Hi @Deivid ,

 

Can you please post a screenshot, similar to the last one in the opening post (Form.Item), but with the cursor at the end of the formula and then Expanding the bottom of the formula bar like below:

 

BCBuizer_0-1659989087914.png

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Hi @BCBuizer 

 

Could not find any data:

 

1.png

BCBuizer
Super User
Super User

Hi @Deivid ,

 

My hypothesis is that when copying the process, you are also creating an entry in tbl_lp_NFsaidas, but with a reference to the original process, not the copied one:

 

BCBuizer_0-1660047513516.png

 

Can you check the data in tbl_lp_NFsaidas to confirm?



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Clear. Follow print:

 

tabela.png

BCBuizer
Super User
Super User

Hi @Deivid ,

 

You can see that both of the items have the same value in the rel_Processo_NFsaida column ("Titulo 9"):

 

BCBuizer_0-1660049687774.png

 

Looking at you earlier screenshot, the title of the process with ID "00034" is "Titulo 9 Copiado":

 

BCBuizer_1-1660049825985.png

Since this reference is off, when filtering tbl_lp_NFsaidas for the ID of the copied process, it draws a blank.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

But it is natural for rel_Processo_NFsaida to repeat itself (in this case, with "Title 9"), since it is from the relationship of the NFsaida table with Process, right? In the Process table it is here:

 

2.png

 

The same filter is placed on the InputText and it correctly brings up:

 

1.png

 

Do you recommend something so that it is not blank and brings the correct record?

BCBuizer
Super User
Super User

Hi @Deivid ,

 

My point is that when you are creating a copy of a process item, the also newly created item in tbl_lp_NFsaidas refers to the original process (ID=00009), not the copied one (ID=00034). This is the reason why your LookUp draws a blank: there is no item in tbl_lp_NFsaidas that matches the condition.

 

I suggest to include a line in the patch statement to correct this:

 

Patch(
    tbl_lp_NFsaidas;
    Default(tbl_lp_NFsaidas);
    Form_Cadastro_1.Updates;
    { Título: DataCardValue41.Text & " Copiado";
    rel_Processo_NFSaida: DataCardValue21.Text & "Copiado"
   }
)


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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