cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TWolsten
Helper II
Helper II

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
Resolver II
Resolver II

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
Resolver II
Resolver II

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

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?

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
Helper IV
Helper IV

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

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

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (37,346)