cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Leandross89
Frequent Visitor

Problem to create a Edit form in a custom form in sharepoint

Hi Dear,

 

I have a small problem to final my custom form in Sharepoint.

What happens, When I want to edit a item in a sharepoint list my dropdown with the function distinct carry the first item automatically, but it isn´t showing the item on my list.

 

1.JPG

 

In powerapps studio My formula for the field 'Tipo Equipo' is: Distinct('Meter/Panel';Tipo).

 

The "Tipo" or "Tipo Equipo" has two types that it is: Panel and DIB6.

 

For the form new it works well but When I edit a registry it goes wrong.

 

Could you help my please

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @BrianS 

 

I got to finish my problem, in Default of my dropdown I created a formula:

If (!IsBlank (ThisItem.'Tipo Equipo'); Parent.Default)

 

Now If exist a item in sharepoint it´ll bring the item and if not exist a item I´ll carry my formula distinct of the Item of the dropdown.

 

Thank a lot for your help.

View solution in original post

7 REPLIES 7
Drrickryp
Super User II
Super User II

Hi @Leandross89 

The distinct function creates a one column table of unique values and renames the column "Result".  You would use Result in any subsequent formulas that rely on the the value selected.  So for example

If a Dropdown1 has an Items property of 
Distinct(SPlist, columnname)
Then the items property of a gallery using that dropdown as a filter would be:
Filter(SPlist, columnname = Dropdown1.Selected.Result)
BrianS
Super User
Super User

If I understand what is happening correctly you need to add an If statement in your Default property so that when the form is new it uses what you want for the default and if it is editing you use the value in the list. Something like

If(formName.Mode=New, "Panel", Parent.Default)
 

 

@Leandross89 
An if statement isn't necessary.  I prefer this syntax for simplicity in my apps as the Default property of the controls in the cards.

 

Coalesce(Parent.Default, SomeOtherValue)

 

The Parent Default is always blank in a New form so that function will return SomeOtherValue.  When it is not blank, then it returns Parent.Default  ref. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty 

It's an uncommonly used PowerApps function but I like it!. Then again, some think my suggestions are weird.igor-eye-wobble.gif

Leandross89
Frequent Visitor

I´m going try to explain with more detail What it´s happening with my form.

 

I´ve had created 3 form to customize my sharepoint list.

1- new

2 - edit

3- view

 

To create a registry it works well. so my new form is ok.

 

the only thing that lack to finish my customization is give to my dropdown the action distinct and show the item that is seing edited.

 

Why I use distinct? I have 2 list.

1 Fail Report (Main)

2 Meter/Panel (Where I search my item in dropdown)

 

Meter/Panel has multiple registries with diferents items like:

Serial                                    Tipo

11100011DIB6
11100012DIB6
11100013Panel
11100013DIB6
11100014DIB6

 

This dropdown needs something like distinct because there are multiples equals registry  on the column.

 

When I click to edit a registry in Sharepoint, I want to show the item in the dropdown in my form edit and view, and if I want to change the item in my form edit it could show the option distinct item (Dib6 or Panel)

 

Example: 

In edit form below the error is showing dib6 rather than Panel.  my registry was record with panel not DIB6. 

The formula in edit, new and view form is Distinct (MeterPanel, Tipo), it should be an error in edit and view form, because it works well in new form.

1.JPG

 

How I´ve said I need the option distinct at this dropdown because If use only the function filter it is going to show repeated items.

 

correct form: Edit and view form is showing the same item Panel registried in sharepoint. 

2.JPG

And in Edit form I need to show the only two option (DIB6 and Panel) case someone to changes it.

 

3.JPG

I don´t know if exist other function to use rather than Distinct.

 

I´m sorry if I explain something wrong.

 

 

@Drrickryp 

@BrianS 

Do you understand?

I think I understand. I would create a collection during start - something like:

ClearCollect(col_Tipo,Distinct(MeterPanel,Tipo))

Use that as the source for your dropdown. You can select "allowed values as a type when you create the cards in the form. That will give you the items to select from. Those should then be saved into your SP list. 

If the problem is that what is selected is not being saved in the SP list, then I don't know if I have an answer for that.

Hi @BrianS 

 

I got to finish my problem, in Default of my dropdown I created a formula:

If (!IsBlank (ThisItem.'Tipo Equipo'); Parent.Default)

 

Now If exist a item in sharepoint it´ll bring the item and if not exist a item I´ll carry my formula distinct of the Item of the dropdown.

 

Thank a lot for your help.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,104)