cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 378 members 4,004 guests
Please welcome our newest community members: