web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / I have a problem with ...
Power Apps
Unanswered

I have a problem with NULL (Blank()) values in Gallery+Form application; Dropdown component

(0) ShareShare
ReportReport
Posted on by 75

I have a typical canvas App that has a Gallery. Its data source is a table of SQL Server. The gallery is editable. We can change a field New Patient directly in the Gallery; it is available as Dropdown:

VictorSotnikov_3-1665408776209.png

 

The Allowed Values are [Blank(), "Y", "N"] in App. The corresponding column in the DB table is NULLable.

A user also can open a Form (for a selected Gallery row) and modify the field New Patient there (as a Dropdown component):

VictorSotnikov_4-1665408776210.png

 

 

I have met a problem when the field has NULL (blank) value. The scenario is the following:

 

I am in the Gallery. There is a row where the New Patient field is “Y”:

VictorSotnikov_5-1665408776211.png

 

I change the dropdown value to blank. Then I look at the DB table and see – yes, the corresponding row has acquired value NULL, as expected.

Then I open the Form and see that the New Patient field displays value Y, not blank.

Then I (without modifying anything in the Form) close the Form; and open it again. Now the New Patient field has blank value, as expected. In other words, the Form has shown the correct (blank) value in the dropdown only after the Form was re-opened.

 

Why the Form did not show blank value in the field the first time; why it shows the blank value only after it was re-opened? Should I call some Reset() or anything like this somewhere?

 

I can add that I see the same behavior in the both situation when the App is run: when I do Preview or when I do Play (of a published version).

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @VictorSotnikov 

    What is the Items property of your Gallery and the Item property of your form?

     

  • VictorSotnikov Profile Picture
    75 on at

    “What is the Items property of your Gallery” – it is a complicated one:

     

    ….

    SortByColumns(Filter('data.VisitType', te_DataSourceKey_Filter.Text in DataSourceKey, te_VisitType_Filter.Text in VisitType, If(IsBlank(te_IsNewPatient_Filter.Text),true,te_IsNewPatient_Filter.Text in isNewPatient)) ,varSortPriority,If(SortDescending,Ascending,Descending))

    ….

     

    The 'data.VisitType' is the data source (corresponds to the SQL table). The te_DataSourceKey_Filter etc are text fields that play role of a filter. The varSortPriority is a session variable with sorting column name. The SortDescending is a session variable that contains either true or false.

     

    “the Item property of your form?” – it is the following: gl_Type.Selected. The gl_Type  is the Gallery component name.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @VictorSotnikov 

    Not too complex, although you can simplify a little with:

    SortByColumns(
     Filter('data.VisitType', 
     te_DataSourceKey_Filter.Text in DataSourceKey, 
     te_VisitType_Filter.Text in VisitType, 
     IsBlank(te_IsNewPatient_Filter.Text) || (te_IsNewPatient_Filter.Text in isNewPatient)
     ),
     varSortPriority,
     If(SortDescending,Ascending,Descending)
    )

    This just primarily removes the If statement in the formula - which should be avoided!

     

    Next, I need to know your terminology.  You stated - "close the Form; and open it again" Does this mean that you display the EditForm in your app again, or that you close the App and then reopen it?

    You also stated - "The gallery is editable" does this mean that you are performing the edits in a Gallery or in the EditForm (or both)? (I assume both based on your further description)

    How are you updating that to your datasource in the Gallery?

     

     

  • VictorSotnikov Profile Picture
    75 on at

    “…Does this mean that you display the EditForm in your app again, or that you close the App and then reopen it?...” – this means that I open the EditForm in my app again.

     

    “You also stated - "The gallery is editable" does this mean that you are performing the edits in a Gallery or in the EditForm (or both)? (I assume both based on your further description)” -  yes, I am performing the edits in both the Gallery and EditForm. But in the given error scenario I did not do any real edit in the EditForm; I did not modify any component. I just saw that the Dropdown does not display the expected blank value – and immediately closed the EditForm; then immediately opened it again.

    BTW, here is the code that works in the EditForm when I click Close button:


    Event: OnSelect;  Code: ResetForm(Form1);Back()

     

    Please ask more details if you need them.

  • VictorSotnikov Profile Picture
    75 on at

    I have found the following solution: 

    in OnSelect event of the button that opens the Form I do the following:

    EditForm(Form1);
    Navigate(VisitTypeForm, ScreenTransition.None);
    ResetForm(Form1);

    Do you have any comment on that?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard