cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

Store multiple control values in a single Datacard

Hello,

 

I am building an app to create timesheet entries using forms.I am using Common data service to store the data. I wanted to use multiple datepickers in a single data card to store values by row wise per each date. Would that be possible?

 

For below example, Date is DataCard1 and Billable hours is DataCard2 in a single form. (considered as one row in CDS database)

Datacard.png

 

 

 

 

 

 

 

 

So, I have created 3 DatePickers in DataCard1 and 3 TextPickers in Datacard2. However, is it possible to store data by Date wise in database?

I am not sure whether we can use multiple controls in one datacard, if so how? Please someone help here?

 

Regards,

 

Naga

 

 

Regards,

Naga

5 REPLIES 5
Highlighted
Community Support
Community Support

Re: Store multiple control values in a single Datacard

Hi Nagaviswanath,

 

It seems that it is not possible to use multiple Date picker controls in a single data card to store values and write back to data source.
I would suggest you don’t use a Form control. Please consider to use Patch function to write data back to the data source.

 

According to your description, I created a connection from PowerApps to CDS.
>On a blank screen, add three Datepicker controls, say Datepicker5, Datepicker6, Datepicker7.
>Then add two Text input controls, say Textinput5, Textinput6.
>Add a Button control, name it as “Save”, and set its OnSelect property as:
Patch(Entity1,Defaults(Entity1),{Date1: DatePicker5.SelectedDate,Date2: DatePicker6.SelectedDate,Date3: DatePicker7.SelectedDate,Hours1:Value(TextInput5.Text),Hours2:Value(TextInput6.Text)})
Then when I click the button the Date and Hours will be saved to Entity1.

1.png

 

Please try to use Patch function to save data to the data source but not using a Form. Hope my steps could be a reference for you.
About Patch function, please check this documentation for a reference:
https://powerapps.microsoft.com/en-us/tutorials/function-patch/

 

Please try if this works for you, and feel free reply if you need more help.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Kudo Collector
Kudo Collector

Re: Store multiple control values in a single Datacard

Hello Mabel,

 

Thanks for your inputs, done few modifications and have started using Patch funtion for create/updation of the rows in the CDS. However, i am not able to update the multiple rows of data by clicking on 'SAVE' button. Please see below:PatchFunction_Error.png

 

 

 

 

 

 

 

 

 

 

 

 

 

I am using following function for SAVE button; OnSelect = Patch(TimeSheet_Week1,Defaults(TimeSheet_Week1),{Day: Value(TextBox8.Text),Worked: Value(TextInput1.Text),Vacation: Value(TextInput2.Text),Sick:Value(TextInput3.Text),Overtime: Value(TextInput4.Text),Client: Value(TextInput5.Text),Location: Value(TextInput6.Text)},{Day: Value(TextBox10.Text),Worked:Value (TextInput7.Text),Vacation: Value(TextInput8.Text), Sick:Value(TextInput9.Text), Overtime:Value(TextInput10:Text), Client:Value(TextInput11.Text), Location:Value(TextInput12.Text)})

 

Please can you help on this?

 

Regards,

Naga

Highlighted
Kudo Collector
Kudo Collector

Re: Store multiple control values in a single Datacard

Hello,

 

I don't want to update the existing records in the database, but multiple rows needs to be added to the database once i click on Save button. Please help on this.

 

 

Regards,

Naga

Highlighted
Memorable Member
Memorable Member

Re: Store multiple control values in a single Datacard

Hey @Nagaviswanath

 

 

You can just use the Patch function like this:  Patch(TimeSheet_Week1,Defaults(TimeSheet_Week1),{Day: TextBox8.Text,...})

You don't need the Value() function for this operation.

 

Try to save it and then look in the OnSelect of the Save button to see if PowerApps doesn't give an error on the Patch function.

 

What entity are you using from the CDS?

I'll try and recreate your situation and let you know what my outcome is

 

Kind regards

 

 

Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Highlighted
Kudo Collector
Kudo Collector

Re: Store multiple control values in a single Datacard

Hello Tom,

 

Yes i am using CDS as my database and i don't think we can use Datacards for my requirement. So i am using text input to store values.

 

Regards,

Naga

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

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

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,349)