cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PPanfili
Helper I
Helper I

Submit to Multiple Forms with Different Datasources

Hello everyone!! 

I have been creating an App, for a school I am working in; in order to submit Discipline reports for students.

 

If you look at the attached screen, you will see various fields, inputting various types of information, into different datasources.  In total there are about 5-6 different spreadsheets behind this app.  In many of the spreadsheets, information will be duplicated.  For instance, Last_Name & First_Name are in all of the datasources.  I know this maynot be ideal, however, I have to keep it like this.  There are unique fields, which would be Last_Name, First_Name, Date, Incident, Discipline_Given.

 

My question is this.  Lets say someone inputs all the data on the attached screen; and then sends the data to the various datasources.  Then they realize that they made  mistake, perhaps, they put in the wrong grade or something.  

 

What would be the best method to Edit this information, in all of the Datasources.  Without have to do each one seperatly?  Basically, if I create an EditForm screen, would I be able to have the user search for this Record, and then edit the field, and then have it post to all the proper places?  I understand how to update only one of the datasources, but I want to be able to search, and update them all at once; to prevent redunancy, and to make it easier for the user.

 

Attached is a copy of the screenshot of the data that is entered it is tied to the following spreadsheets:  All, Log, Discipline, ISAP, Info...

 

I hope someon can shed some light on thisScreenshot.png

14 REPLIES 14

Luke,

 

Again, I cant thank you enough for this.  I think the next best approach to take to get this working, is for me to attempt to understand what is going on with the formula.  I did a little diagram thing of my interpreation of what is happening, perhaps you can assist me, and maybe do something similar, so I can attempt to work out the kinks....

I do think, my data maybe an issue to updating like this.  Unfortunatly, I am working with old data, on a system that hasnt been updated in probably a decade.  And am trying to streamline it the best I can.  

 

 

 

Untitled.png

Luke,

 

I hope I didnt lose you.  Ok I have some updates; and am almost at a solution.  I believe I sort of figured out how the formula works.  And for the most part adjusted it to almost entirely work.  Here are some details on what I adjusted, and what the code looks like now.  

 

The Log datasource is now the main datasource, and is tied to Form5.  This is the only form that will be on the screen, as the Log datasource has all of the fields in each of the datasources connected to the program.  There are four serperate datasources connected to the program.  Log, Discipline, ISAP, and ALL.  Each table has fields, that tie back to the LOG table.  

 

I attached a screenshot, showing the relationships of each of the tables, and what their corresponding columns, tie to one another.

 

The code at the bottom is what I am using thus far to update the ALL, and ISAP and LOG datasources.  The problem that I am having is when updating the First_Name, Last_name fields.  They are only updating on the LOG datasource, and none of the others.  I have a feeling it is becuase they are in the Lookup fields maybe?  And once I change something in the Lookup Field of the code, then it falls out of sync??Hopefully you can shed some light on this.  The other fields seem to be updating fine  

 

Patch(All, LookUp(All, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Infraction=DataCard42.Default), {First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, First_Name), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Last_Name), Infraction: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Student_Offense), Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Grade)}); Patch(ISAP, LookUp(ISAP, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default), {First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, First_Name), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Last_Name), Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Grade), Period: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, ISAP_Periods), Start_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Start_Date),End_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, End_Date),Todays_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Today_Date), Administrator: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Administrator)})

 

Tables.png

Hi again!

Yes, I'm still around. Sorry, delayed response was due to the new year.

 

I have annotated your image with my responses. Your understanding is just about perfect.

Untitled2.png

The issue you mentioned with the long formula you posted is interesting. I think you may be on to something with the fact that Last_Name and First_Name are used in the LookUp. I have re-formatted your formula to be easier to read below:

 

 

Patch(All, 
LookUp(All, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Infraction=DataCard42.Default), 
{
First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, First_Name), 
Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Last_Name), Infraction: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Student_Offense), 
Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Grade)
});

Patch(ISAP, 
LookUp(ISAP, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default), 
{
First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, First_Name), 
Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Last_Name), 
Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Grade), 
Period: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, ISAP_Periods), 
Start_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Start_Date),
End_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, End_Date),
Todays_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Today_Date), 
Administrator: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Administrator)
})

I expect the first Patch command to result in the update of "First_Name", "Last_Name", and "Grade" in datasource "All" to reflect the corresponding updated values in datasource "Log". For my understanding, the problem is that "Grade" update is working in "All" but neither "First_Name" nor "Last_Name" is. Correct?

Ok, finally got it working the way that I wanted.  I had to go ahead and add a few textboxes, in order to not break the Lookup fields, but so far everything is working good.

 

Thanks again, as I could of never figured this out on my own.

 

Here is the code.

 

Patch(All, LookUp(All, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Infraction=DataCard42.Default), {First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Label23.Text), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, LastUpdate.Text), Actual_Resolution_Date: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Acutal_Resolution_Date), Incident_Date: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Date_Of_Offense), Ethnicity: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Ethnicity), Gender: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Gender), Point_Assigned: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Points), Discipline_Assigned: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Disc_Assigned), Infraction: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, OffenseUpdate.Text), Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Grade)}); 

 

Patch(Discipline, LookUp(Discipline, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Student_Offense=DataCard42.Default && Date_Of_Offense=DataCard34.Default), {First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Label23.Text), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, LastUpdate.Text), Date_Of_Offense: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Date_Of_Offense), Points: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default &&Student_Offense=DataCard42.Default,Points), Discipline_Given: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Disc_Assigned), Student_Offense: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, OffenseUpdate.Text), Period: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Period_Of_Offense), Administrator: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Administrator), Date: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Today_Date), Code: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Code), Period_Given: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, ISAP_Periods), Date_Seen_Admin: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default && Student_Offense=DataCard42.Default, Date_Seen_Administrator), Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default &&Student_Offense=DataCard42.Default, Grade)});                                                                                                                                                                                                                                                                                                                                           Patch(ISAP, LookUp(ISAP, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default), {First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Label23.Text), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, LastUpdate.Text), Grade: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Grade), Period: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, ISAP_Periods), Start_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Start_Date),End_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, End_Date),Todays_Date: LookUp(Log,First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Today_Date), Administrator: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, Administrator)});                                                                                                                                                                                                                                                                                     Patch(Log, LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Student_Offense=DataCard42.Default), {Student_Offense: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, OffenseUpdate.Text), Last_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Start_Date=DataCard53.Default && End_Date=DataCard17.Default, LastUpdate.Text),First_Name: LookUp(Log, First_Name=DataCard31.Default && Last_Name=DataCard18.Default && Date_Of_Offense=DataCard34.Default, Label23.Text)})

View solution in original post

Anonymous
Not applicable

Hi!

i am struggeling with using many data sources for a long time without results, I will be totally  thankful if you can help,

i try to use two data sources in my gallery, one for fetching the data which is called ('Tickets') ,and another ("Work Inputs') for patch the tickets information which took from the Tickets DataSource and patches the Start and End time for the selected Ticket.

the App accept only one ticket and I can't found a way to add another ticket to use inside the gallery, although it added to the data sources list.

Thank you.
@PPanfili  @LukeW-MSFT  @

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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (73,485)