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 / The selected item in T...
Power Apps
Answered

The selected item in Table can not be recognized.

(1) ShareShare
ReportReport
Posted on by 10
Hi everyone,
 
I have built a powerapps to opitimize some transaction process in my company, I use a table to connect a datasource to Sharepoint List, but I have found that when I try to recogniaze the item selected in Table1 using .Selected method, sometimes it doesn't work, here are some structures of my App:
 
First, I use Clearcollect fuction to add the data from Sharepoint List to avoid delegation warning when applying filter on large dataset, the local data is as datasource of Table.
I want when user select a row in Table and press Verify button, then the app will navagate to next page, and data in Form of next page will be based on the selected item in Table1. But sometimes although I have selected an item in Table1, the Apps still recognize the condition of selection as null.
 
Here is the OnSelect property of Verify button:
 
I'm so confused of the selection logic here. Thanks for your help first!
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at
    Hi @vanzs,
    A bit hard when you have redacted all your code. Can you please post it all in Text and change all the list and field names if they are sensitive - also make a note of where the code is being used.
  • Suggested answer
    SwatiSTW Profile Picture
    741 Super User 2025 Season 2 on at
    The issue you are facing with the .Selected property not always recognizing a selection in your PowerApps table can occur due to several reasons 
    1.  If the data source (ClearCollect collection) is updated dynamically while the user interacts with the app, the selection may get reset. This can happen when the ClearCollect function is called again, overwriting the existing collection.
    2. Sometimes, there may be a slight delay in recognizing the selected item if the app is handling a large dataset or has many controls.
    Try below things
    1. Store the selected item in a variable like this: Set(SelectedRow, Table1.Selected)
    2. Check if an item is selected before navigation like this:
    If(
       !IsBlank(SelectedRow),
       Navigate(NextScreen),
       Notify("Please choose an item", NotificationType.Error)
    )
    3. On the next screen, set the form item to the variable like this: Form1.Item = SelectedRow
    4. Avoid calling ClearCollect frequently, only use it when refreshing data manually.
    5. Add a label to debug and check the selected item using this: SelectedRow.ID
  • vanzs Profile Picture
    10 on at
    Thank you for your reply @WarrenBelz@SwatiSTW,
     
    Here are some related codes in my App:
     
    1. In Home Page onVisible property, I use ClearCollect to store data from SharePoint List:
     
    If(UserRole="Role1" || UserRole = "Role2",
        ClearCollect(Localdata, Filter(Sharepoint List,Role.Value = Lower(User().Email))),
        ClearCollect(Localdata, Sharepoint List)
       )
     
    * I have another Sharepoint List to store users' email and their Role
     
    2. In Table1 property
    ItemsLocaldata
    OnSelect:  Set(SelectedRecord, Table1.Selected)
     
    3. Verify Button: Users press Verify button navagating to Verify page
    OnSelect:
    If(!IsBlank(Table1.Selected),
        If(
            Table1.Selected.Status.Value = "Completed" || Table1.Selected.Status.Value = "Approving",
            ViewForm(AForm);ViewForm(BForm);Navigate(Verify, ScreenTransition.Fade),
            If((UserRole = "Role3"|| UserRole = "Role3M") && Table1.Selected.Status.Value = "Verifying",
                ViewForm(AForm);EditForm(BForm);Navigate(Verify, ScreenTransition.Fade),
                If((UserRole = "Admin" || UserRole = "Role1" || UserRole = "Role1M") && Table1.Selected.Status.Value = "Verifying",
                    ViewForm(AForm);EditForm(BForm);Navigate(Verify, ScreenTransition.Fade),
                    If(UserRole = "Role2" || UserRole = "Visitor",
                    Notify("You do not have authentication to access the data!",NotificationType.Error),
                    ViewForm(QCVerifyForm);ViewForm(METVerifyForm);Navigate(Verify, ScreenTransition.Fade)
                    )
                )
            )
        ),
        Notify("Please choose an item",NotificationType.Information)
    )
    // Open form with different mode base on users' role and status.
     
    4. Refresh button: refresh Sharepoint list if something update.
    OnSelect:
    Refresh(Sharepoint List);
    If(UserRole="Role1" || UserRole = "Role2",
        ClearCollect(Localdata, Filter(Sharepoint List,Role.Value = Lower(User().Email))),
        ClearCollect(Localdata, Sharepoint List)
        );
    Notify("Refresh Sucessfully!",NotificationType.Success);
     
    5. I also have a filter part in my App, containning stauts, code, and date picker:
    In Apply button:
    Onselect:
    ClearCollect(Localdata, Sharepoint List);
    ClearCollect(Localdata,
        Filter(Localdata,
            Or(IsBlank(DropdownStatus.Selected.Value),Status.Value = DropdownStatus.Selected.Value),
            txtInput.Value in Code,
            Or(IsBlank(StartDatePicker.SelectedDate), CreateTime >= StartDatePicker.SelectedDate),
            Or(IsBlank(EndDatePicker.SelectedDate), CreateTime <= EndDatePicker.SelectedDate)
        )
    )
    In Reset button:
    OnSelect:
    Reset(txtInput);
    Reset(StartDatePicker);
    Reset(EndDatePicker);
    Reset(DropdownStatus);
    If(UserRole="Role1" || UserRole = "Role2",
        ClearCollect(Localdata, Filter(Sharepoint List,Role.Value = Lower(User().Email))),
        ClearCollect(Localdata, Sharepoint List)
    )
     
    If you need more infomation, please let me know.
  • Verified answer
    WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at
    Hi @vanzs,
    I was not expecting all of that, however I will get to some fundamental questions and observations to confirm as few things. Firstly, what type of control are using to select the record from. If it is a Modern Table, this is still under preview like many other Modern Controls which still have some inconsistencies. Try using a Classic Gallery and see if that works.
    As well using a Collection does not solve Delegation issues, just "masks" them as the record limit is the same as a non-Delegable query. Which piece of code where you getting the Delegation warning on ? If it was Lower(), you can have a Delegable query on the Items with (assuming here that UserRole is a Variable)
    With(
       {_Mail: Lower(User().Email)},
       Filter(
          Sharepoint List
          (UserRole <> "Role1" && UserRole <> "Role2") ||
          Role.Value = _Mail
       )
    )
    If you select one of these records in a Gallery, then 
    Set(
      SelectedRecord, 
      GalleryName.Selected
    )
    will set the Variable to the selected record. You can also cut down your Verify button a bit
    If(
       !IsBlank(GalleryName.Selected),
       If(
          GalleryName.Selected.Status.Value = "Completed" || GalleryName.Selected.Status.Value = "Approving",
          ViewForm(AForm);
          ViewForm(BForm),
          GalleryName.Selected.Status.Value = "Verifying" && 
    ​​​​​​​ (UserRole = "Role3" || UserRole = "Admin" || UserRole = "Role1" || UserRole = "Role1M"), ViewForm(AForm); EditForm(BForm), UserRole = "Role2" || UserRole = "Visitor", Notify( "You do not have authentication to access the data!", NotificationType.Error ), ViewForm(QCVerifyForm); ViewForm(METVerifyForm) ); Navigate( Verify, ScreenTransition.Fade ), Notify( "Please choose an item", NotificationType.Information ) )
    and as you have a Delegable query in your Gallery, there is no need to refresh or re-collect - a change in UserRole will automatically update the content.
    I will look at anything else after you confirm all of this.
  • vanzs Profile Picture
    10 on at
    Thank you for your suggestion @WarrenBelz
     
    I have modified my code with your reply, it's quite good for simplifying my code and ehancing the efficiency. And I agree that the selected item issue must be some inconsistencies or bugs of Modern Table. Anyway, thanks a lot for your help!

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard