cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nagaviswanath
Kudo Commander
Kudo Commander

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
v-yamao-msft
Community Support
Community Support

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.

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

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

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.

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
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.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

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

Top Solution Authors
Top Kudoed Authors
Users online (84,882)