cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrit2020
Responsive Resident
Responsive Resident

Similar to a timesheet submission app

I need to create a sort of "timesheets" app, but monthly not daily or weekly. 

 

So I have the following:

 

jbrit2020_0-1621353078012.png

 

My issue here is the structure in which I want to store the data.

 

I dont want a column per month, I want to store all the dates in a single column:

 

jbrit2020_1-1621353229713.png

I'm currently storing it in a very painful PATCH DEFAULT process where there's a patch default that looks at each textinput control and pastes that information on a new row.

 

I'm sure there's a better way of doing this, but can't think of any. It would also be good to find a way of with the same button switching between Patch Default and Patch (to only update a value in case it already exists)

 

 

3 REPLIES 3
CNT
Community Champion
Community Champion

@jbrit2020 Use the Concatenate( ) to build a comma separated string of values. For example if there are 3 months, you can use Concatenate(TextImput1.Text, ",",TextImput2.Text, ",",TextImput3.Text). This will give an output something like "10,,30" (in this case the second value is empty). You can store this in a single text column in your data source. When you read it back you can use the Split() function to split it into separate records. In our exampleif we split the returned value, you will get a table with three rows, "10","","30". You can display these values in your TextInputs in Power Apps. Hope that helps. 

jbrit2020
Responsive Resident
Responsive Resident

Hi @CNT that will unfortunately end up being the same as having 12 columns on my database one for each month. I need each month to result in an individual row in SQL for analytics reasons. I don't want to have to go pivoting my tables for Tableau or PowerBI as it will cause performance issues when querying the data live.

 

Good shout though

CNT
Community Champion
Community Champion

@jbrit2020 That's even easier, Have a collection with 12 records corresponding to your 12 months. Add a Horizontal Gallery with this collection as your data source and add a Text Input in the Gallery (you will end up having 12 Textboxes b'coz u'r collection has 12 records). To patch the records just loop through the gallery ForAll(gallery.AllItems,.......) and add your logic inside the ForAll to Patch that records in your DB. Hope that helps. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (858)