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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,068)