cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fpc-kdrosario
Helper I
Helper I

Drop Down list not showing default value upon Editing the Form

Hello humans,

 

I have a form that has a Drop Down field called 'Contractor'.

It has a card the has a Default value of 'admin_contractor' which is from the collection I created.

The Drop Down list has a Default value of Parent.Default, which is also 'admin_contractor' in general.

 

Everything looks good in the new form, you can create a record, select a Contractor then submit the form.

The created record is successfully in the collection and you can see it on the Gallery on another screen.

The gallery row of the record contains the status of the form and I also included the value of the Contractor which is also displayed on its sub label.

 

The Issue is, when a user clicks the record created which takes them to the screen that has an edit form for that selected record,

the Contractor field/ lookup is not showing the value for the record. The field just display a BLANK / nothing in the field where the value should be.

 

Any idea on why is this happening? I have other fields that is also drop down but they don't experience this issue.

 

I hope someone could help. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @fpc-kdrosario ,

 

Since the data source/Items of arrAdminContractor is from coll_contractors, so the Default property should also be from coll_contractors.

Please modify the Default of arrAdminContractor as follows:

 

LookUp(coll_contractors, keyvalue= ThisItem.admin_contractor).keyvalue

Or

 

LookUp([@coll_contractors], keyvalue= ThisItem.admin_contractor).keyvalue

Hope this helps.

Sik

View solution in original post

7 REPLIES 7
v-siky-msft
Community Support
Community Support

Hi @fpc-kdrosario ,

 

What is the data source of the form? what's the type of Contractor column?

We need more information, codes, screenshots of the app so that we can provide further assistance.

Sik

Good day @v-siky-msft ,

 

The datasource of the form is a collection named 'coll_FPC402_Form'.

The Contractor column is also a collection named 'coll_contractors'.

 

First, I created a new form with this contractor:

W1.png

 

 

Then I saved the form. This is how I save the collection (just an overview to protect other private data):

Collect(
    coll_FPC402_Form,
    {
        MODIFIED_BY: User().Email,
        admin_contractor: arrAdminContractor.Selected.keyvalue,

 

Then on the gallery, the saved form is found along with the contractor set.

The value shown is the “keyvalue” column from the coll_contractor collection instead of the label column. I’ll be showing the structure of the coll_contractor collection on the latter part.

W2.png

 

 

Then upon clicking the record from the gallery, I am redirected to the edit form and this is what I see:

W3.png

 

 

Checking the collection coll_FPC402_Form (where the record of the form is being saved), there is a value for the Contractor of this record:

W4.png

 

 

Below is the default value for the cardAdminContractor and arrAdminContractor:

W5.png

 

 

cardAdminContractor default:

W6.png

 

 

arrAdminContractor default:

W7.png

 

 

Items of the arrAdminContractor:

W8.png

 

 

Collection coll_contractors:

W9.png

 

 

EditMainForm DataSource:

W10.png

 

The defaulting of the other similar field values works fine except for this Contractor field which does not show the Contractor value of the form being edited.

 

Please let me know if you need anything else.

I hope you can help me on this.

 

Thank you! 😄

Hi @fpc-kdrosario ,

 

I got some questions:

1. how did you set the collection to the data source of EditForm since I think the collection is not supported to EditForm? 

2. What is the Items property of Eidtform?

 

Your codes all look good, but it seems that you forget to set the Items property of Form, so ThisItems code return blank.

When you clicked the record on the gallery, you should set the Form to EditMode, and the Items property of Form should be bound to the specific record.

Gallery.OnSelect: EditFrom(FormName);Navigate(FormScreen)

EditForm.Items:

Gallery.Selected // If the gallery data source is 'coll_FPC402_Form'

Or

LookUp('coll_FPC402_Form', 'admin_contractor'=Gallery.Selected.keyvalue // If the gallery data source is 'coll_contractors'

 

Hope this helps.

Sik

Good day @v-siky-msft ,

 

Below are my answers to your questions:

 

1. how did you set the collection to the data source of EditForm since I think the collection is not supported to EditForm? 

- I created a form from a table from a database source, then I changed the Datasource into a collection so that the fields I need will automatically be created for me.

 

2. What is the Items property of Eidtform?

- BrowseGallery2.Selected (this is the name of the gallery where I show the saved forms)

 

Your codes all look good, but it seems that you forget to set the Items property of Form, so ThisItems code return blank.

When you clicked the record on the gallery, you should set the Form to EditMode, and the Items property of Form should be bound to the specific record.

Gallery.OnSelect: EditFrom(FormName);Navigate(FormScreen)

EditForm.Items:

Gallery.Selected // If the gallery data source is 'coll_FPC402_Form'

Or

LookUp('coll_FPC402_Form', 'admin_contractor'=Gallery.Selected.keyvalue // If the gallery data source is 'coll_contractors'

Actually, I will show you other fields that behaves okay while this Contractor field doesn't.

 

- Below, I will enumerate the steps I do.

 

1.) Create and save form with these values (I've censored some items for confidentiality):

SC1.jpg

2.) The form is now saved and found on the BrowseGallery2 along with the value of the Contractor.

SC2.jpg

 

3.) Upon clicking the form, I'm now redirected to the editform. Since the Contractor value is found on one of the labels in the BrowseGallery, that definitely means that the value is saved in the collection. You may refer to my previous reply here where I included the screenshot of the collection data. Here as you can see, the values for the fields 1 and 2 are there, but the value for Contractor is not.

SC3.jpg

 

4.) This is the default value of the card of the 1st field:

SC4.jpg

and this is the default value of the drop down of the 1st field.

SC6.jpg

 

5.) Now, this is the default value of the card of the Contractor field which is generally the same as the 1st field.

SC5.jpg

and this is the default value of the drop down for Contractor.

SC7.jpg

 

 

I really find it weird since the other values are set to their default correctly, unlike this Contractor field.

 

I hope you can help me on this further.

Cheers!

Good day @v-siky-msft ,

 

Below are my answers to your questions:

 

1. how did you set the collection to the data source of EditForm since I think the collection is not supported to EditForm? 

- I created a form from a table from a database source, then I changed the Datasource into a collection so that the fields I need will automatically be created for me.

 

2. What is the Items property of Eidtform?

- BrowseGallery2.Selected (this is the name of the gallery where I show the saved forms)

 

Your codes all look good, but it seems that you forget to set the Items property of Form, so ThisItems code return blank.

When you clicked the record on the gallery, you should set the Form to EditMode, and the Items property of Form should be bound to the specific record.

Gallery.OnSelect: EditFrom(FormName);Navigate(FormScreen)

EditForm.Items:

Gallery.Selected // If the gallery data source is 'coll_FPC402_Form'

Or

LookUp('coll_FPC402_Form', 'admin_contractor'=Gallery.Selected.keyvalue // If the gallery data source is 'coll_contractors'

Actually, I will show you other fields that behaves okay while this Contractor field doesn't.

- Below, I will enumerate the steps I do.

 

1.) Create and save form with these values (I've censored some items for confidentiality):

SC1.jpg

2.) The form is now saved and found on the BrowseGallery2 along with the value of the Contractor.

SC2.jpg

 

3.) Upon clicking the form, I'm now redirected to the editform. Since the Contractor value is found on one of the labels in the BrowseGallery, that definitely means that the value is saved in the collection. You may refer to my previous reply here where I included the screenshot of the collection data. Here as you can see, the values for the fields 1 and 2 are there, but the value for Contractor is not.

SC3.jpg

 

4.) This is the default value of the card of the 1st field:

SC4.jpg

and this is the default value of the drop down of the 1st field.

SC6.jpg

 

5.) Now, this is the default value of the card of the Contractor field which is generally the same as the 1st field.

SC5.jpg

and this is the default value of the drop down for Contractor.

SC7.jpg

 

 

I really find it weird since the other values are set to their default correctly, unlike this Contractor field.

 

I hope you can help me on this further.

Cheers!

Hi @fpc-kdrosario ,

 

Since the data source/Items of arrAdminContractor is from coll_contractors, so the Default property should also be from coll_contractors.

Please modify the Default of arrAdminContractor as follows:

 

LookUp(coll_contractors, keyvalue= ThisItem.admin_contractor).keyvalue

Or

 

LookUp([@coll_contractors], keyvalue= ThisItem.admin_contractor).keyvalue

Hope this helps.

Sik

View solution in original post

Good day @v-siky-msft ,

 

It actually worked like M-A-G-I-C. I'm pretty sure in a logical sense, using ThisItem.admin_contractor shouldn't be a problem because I used the same approach on the other fields, but using your approach fixed it.

 

I'm still wondering why it didn't work as is without the lookup. Any thoughts? 😄

 

Cheers! 

K.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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