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

Getting Value of Field in Edit Forms invisible

Hi All

 

I have column in my data source, which is bound to a dropdown

 

I need to bind the dropdown to variable (varGrade), as there are several buttons that can change the grade (not just user choosing from List. The dfault value for this is ThisItem.Grade, I'm changing this to varGrade

 

I understand the best way to accomplish this is in the OnVisble event of the form. (I need to do this fro several items)

 

Even if I use a literal string, the label bound to varGrade shows nothing

 

UpdateContext({varGrade: "Grade 4",});

 

So my plan is to get the value of Grade and save in VarGrade, Then my buttons will update varGrade. Problem is I don't know how to get varGrade

 

Tried a few things

 

UpdateContext: ({varGrade: ThisItem.Grade});  this says invalid use of "."

or

UpdateContext: ({varGrade: ([@tblCrops].Grade)});  this causes the controls bound to varGrade to give and error (expects Text)

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Mark2457 ,

Could you tell me the data type of Grade column?

I've made a similar test for your reference:

1)if it is a choice column.

Set the drop down's Items:

Choices(listname.Grade)

Set the Grade datcard's Default:

{Value:vargrade}

Set the screen's OnVisible:

UpdateContext({varGrade: "Grade 4",})   //you could not test it untill you are running the app, in edit mode the action will not perfrom

2)if it is a text column.

Set the drop down's Items:

Distinct(listname,Grade)

Set the drop down's Default:  (this datacard has been customized, so it is useless to set the datacard's default)

vargrade

Set the screen's OnVisible:

UpdateContext({varGrade: "Grade 4",})   //you could not test it untill you are running the app, in edit mode the action will not perfrom

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

From my understanding of your question, why don't you bind the DataCardValue.SelectedItems to the context variable? Or this that not what you're trying to achieve?

thqanks for reply. I'm not sure how I'd do that.

 

attached are a few screen shots of my form

 

datacard.png

 

 

dropdown.png

Hi @Mark2457 ,

Could you tell me the data type of Grade column?

I've made a similar test for your reference:

1)if it is a choice column.

Set the drop down's Items:

Choices(listname.Grade)

Set the Grade datcard's Default:

{Value:vargrade}

Set the screen's OnVisible:

UpdateContext({varGrade: "Grade 4",})   //you could not test it untill you are running the app, in edit mode the action will not perfrom

2)if it is a text column.

Set the drop down's Items:

Distinct(listname,Grade)

Set the drop down's Default:  (this datacard has been customized, so it is useless to set the datacard's default)

vargrade

Set the screen's OnVisible:

UpdateContext({varGrade: "Grade 4",})   //you could not test it untill you are running the app, in edit mode the action will not perfrom

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (5,443)