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

Adding new data to data source using a form

Hello again,

 

I'm trying to create a form to add new employee work hours to an existing Excel data source. The data source (EmployeeDetails) has the following columns:

 

Data source: EmployeeDetailsData source: EmployeeDetails

I want a form that allows me to enter all this information at once for one employee, that is, select the month from a drop-down list, select the employee from a drop-down list, and enter the value for each category (Lunch, Meetings, Work, Travel, Breaks) in separate fields, etc. 

ScreenNewHoursScreenNewHours

I'm using different data sources to populate the MonthYear drop-down (DropdownMonthYear) and Employee drop-down (DropdownEmployee) and the Category information:

Data source: MonthsDataData source: MonthsDataData source: EmployeeTableData source: EmployeeTableData source: CategoryTableData source: CategoryTable

Basically, the form should let you select the MonthYear from a drop-down list, the Employee from a drop-down list (these work), to display each category and allow you to enter a value for each category, and at the end submit this all to the EmployeeDetails data source. Is this possible? Is it possible to add information from one data source to another data source?

 

Any help/advice would be appreciated! 

13 REPLIES 13
Highlighted

Hi @Samurai89

Not necessary.  I'm suggesting in order to use best practices for creating your app, you will need 4 separate tables to describe what you have in the single spreadsheet table that you are currently using.  Each table must have an ID column (Primary Key) and in the case of the LeaveWork and TimeWorked tables, there would be a column for the Foreign keys of the other tables to create the relationships.  Please review my 4  posts in the Community blog to understand why this is desirable and why what you are doing with a single table is a poor design for an app. Please start with Database-Design-Fundamentals-and-PowerApps-An-Overview and then the three steps to building your tables in preparation for creating the app. In the meantime, could you post the excel file for your spreadsheet and I will help you out with it by recreating the tables that you can use in your app from the data you alread have.   

Highlighted

@Drrickryp Please find attached the Excel file with my data. In the meantime, I'll review Database-Design-Fundamentals-and-PowerApps-An-Overview. Thank you for your help.

Highlighted

Hi @Drrickryp,

 

Thanks a lot for your email and your attached app. However, I'm trying to add new records, not edit existing ones:

 

MainScreen.jpg

This is what I'm trying to accomplish: Add all this information on one screen and add it all to the 'EmployeeDetails' table. The boxes next to the categories are for 'HoursSpent' values, and the 'TotalHours' value is calculated as the sum of all the entered 'HoursSpent' values. 

 

The only way I figured out how to display all the categories at the same time is using a gallery, and then adding a Text input box next to them. I can format the text inputs as numerical values, but how do I save all this to my data source?

 

Highlighted

Hi @Samurai89,

You don't need a form or gallery to do what you want.  Since all of the items are entered once a month, change your Excel table to have them all in one row. Name the Table employeedata, 

 The HoursSpent column is calculated as shown in the box above the table.employeedata.PNG

 

 

Take a blank screen and add a Dropdowns for Month and Year. Put the Labels, Dropdowns and Textinput controls on it as you have shown in your figure above. The Submit button should have as the OnSelect property, 

Collect(employeedata, {ID: Last(employeedata).ID+1, Employee: Dropdown1.Selected.Value, Month: DropdownMonth.Selected.Value,
Year: DropdownYear.Selected.Value, Lunch: Value(TextinputLunch.Text), Meetings: Value(TextInputMeetings.Text),
Work: Value(TextInputWork.Text), etc.

You can add another button to reset the controls to blank after you enter the data for each employee. 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,505)