cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TWolsten
Level: Powered On

Replace text of a DataCardValue on Button click

Hello,

 

I am trying to replace the value of a DataCard on the click of a button.

 

As a bit of a background I have created a SharePoint Edit Form that is split into two Screens ('Approval' & 'Change'). Each Form has a Button to submit any changes.

 

There is a DataCard on both Screens called DataCardValue44 (aka Requires Approval).

 

I would like that:

If you click the Submit Button on the Approval Screen it populates DataCardValue44 with Yes

&

If you click the Submit Button on the Change Screen it populates DataCardValue44 with No.

 

I have tried on the Submit Button:

OnSelect: 
UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

But this isnt working, would anyone know what the issue is?

1 ACCEPTED SOLUTION

Accepted Solutions
PK_Hong
Level 8

Re: Replace text of a DataCardValue on Button click

Hi @TWolsten

 

OnSelect: UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

From the above, I would suggest to check on:

- Inside the DataCardValuee44, which I assume to have a LABEL (which has a TEXT value) or TEXTINPUT (which has a DEFAULTS value).

Please set with a Context Variable, say myresult

- Label.Text = myresult or

- TextInput.Default = myresult

 

then

UpdateContext({myresult: "Yes"})

 

We are updating the Context Variable, NOT the name of the DataCard.

 

Hope this helps,

View solution in original post

4 REPLIES 4
PK_Hong
Level 8

Re: Replace text of a DataCardValue on Button click

Hi @TWolsten

 

OnSelect: UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

From the above, I would suggest to check on:

- Inside the DataCardValuee44, which I assume to have a LABEL (which has a TEXT value) or TEXTINPUT (which has a DEFAULTS value).

Please set with a Context Variable, say myresult

- Label.Text = myresult or

- TextInput.Default = myresult

 

then

UpdateContext({myresult: "Yes"})

 

We are updating the Context Variable, NOT the name of the DataCard.

 

Hope this helps,

View solution in original post

TWolsten
Level: Powered On

Re: Replace text of a DataCardValue on Button click

Thank you for that! It worked perfectly.

 

Out of interest I am trying to filter on a ComboBox Value, the forumla of:

 

Filter(lookup, DataCardValue109.SelectedItems.Results = Project_x0020_No_x002e_)

Does not work, would you know why this is?

PK_Hong
Level 8

Re: Replace text of a DataCardValue on Button click

Hi @TWolsten

 

Welcome.

Please always use

.Selected.Results

 

I am not sure why SelectedItems is there because I have also never successfuly used it.

 

Either in Dropdown or Combo, use Selected.Results or Selected.Value.

 

Please try. TQ

G9

MK1
Level: Powered On

Re: Replace text of a DataCardValue on Button click

Hi

In my scenario,

When we try to submit a new request to Add and Remove User.

I have two buttons, Add and Remove on my  one edit screen.

When we click on Add button  datacardvalue17 should be null.

when we click on Remove button datacardvalue17 should be populated as "Remove".

And the Datacardvalue should set to null once the form is submitted.

Any ideas how to fix this would help.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,293)