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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Click issues while wor...
Power Apps
Unanswered

Click issues while working with the table stored as value to a record in a Collection

(0) ShareShare
ReportReport
Posted on by

Hi, 

I'm working with create, edit and update functionalities for a Table stored as value in a collection using a gallery, the functionalities work as expected, but now I'm  experiencing some click issues after implementing the functionalities.

 

Such as, the first click on a cell after entering data into a cell in the gallery Table is rejected, but the second is accepted.clicking issue (1).gif

 

 

 

 

 

 

 

This problem also occurs when trying to remove a record from the gallery table after making some updates to the gallery table

REMOVE ONLY WORKS ON DOUBLE CLICK AFTER ADDING A NEW VALUE.gif

 

 

 

 

 

On both the cases this issue occurs immediately after some value is entered in the gallery table. This only affects the items placed inside the gallery as the 'Add Rows' button placed outside the gallery is unaffected.

 

@rzuber   @Drrickryp @mdevaney @WarrenBelz @elseb 

/You may see the code below for further understanding/

Here's the code which I used to achieve this:

 

In OnStart():
//The answer table is stored as a value inside a collection

ClearCollect(
    colAnswers,
    {
        ID:0,
        Question:"",
        UserTable:Blank()//The table will be stored here
    }
);

//Initially a dummy collection is given in the place of the answer table, so that the table contains a row when first seen by the user

ClearCollect(
    colAnswerTableValues,
    {
        rowNo:1,
        input1:Blank(),
        input2:Blank(),
        input3:Blank()
    }
);
 
The code below is to update user given values in answer table and store it in 'colAnswers' and is given in the OnChange() of the three text boxes in the gallery table:

With(

//get record for the current question

    {

        thisQusestion:LookUp(colAnswers,(Question=galSubTopics.Selected.Question) )

    },

    If(

        IsBlank(thisQusestion),

//if this question record is blank then create a record for this question in 'colAnswers'

        Collect(

            colAnswers,

            {

                ID:Last(colAnswers).ID+1,

                Question:galSubTopics.Selected.Question,

                UserTable:

                ForAll(

                    Gallery1_8.AllItems,

                    {

                        rowNo:Value(lblRowNoSubmitForm.Text),

                        input1:TextInput4.Text,

                        input2:TextInput4_1.Text,

                        input3:TextInput4_2.Text

                    };)})

        ,

// if the question is not blank then edit the existing values for answer table in the record

        Update(

            colAnswers,

            thisQusestion,

            Patch(

                thisQusestion,

                {

                    UserTable: Update(

                        thisQusestion.UserTable,

                        LookUp(thisQusestion.UserTable,rowNo=ThisItem.rowNo),

                        {

                            rowNo:ThisItem.rowNo,

                            input1:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4.Text,

                            input2:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4_1.Text,

                            input3:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4_2.Text

                        })}))))

 The code below is to add a new record to the gallery table( given inside 'Add Rows' button):

With(

    {thisQuestion:LookUp(colAnswers,(Question=galSubTopics.Selected.Question))},

    If(

        IsBlank(thisQuestion.UserTable),

//if the answer table contains no values then add records to the dummy table

        Collect(

            colAnswerTableValues,

            {rowNo:Last(colAnswerTableValues).rowNo+1}

        ),

// if the answer table already contains some values then edit the values in the answer table 

        Update(

            colAnswers,

            thisQuestion,

            Patch(

                thisQuestion,

                {

                    UserTable: Collect(

                        thisQuestion.UserTable,

                        {

                            rowNo:Last(thisQuestion.UserTable).rowNo+1,

                            input1:Blank(),

                            input2:Blank(),

                            input3:Blank()               

})}))))

 

The code to remove a record from the answer table given inside the OnSelect() of'remove icon' in gallery table :

With(

    {thisQuestion:LookUp(colAnswers, (Question=galSubTopics.Selected.Question))},

//remove the selected record from the answer table

    Update(

        colAnswers,

        thisQuestion,

        Patch(

            thisQuestion,

            {

                UserTable: RemoveIf(thisQuestion.UserTable,rowNo=ThisItem.rowNo)

            })))

 

The code to switch data sources to the gallery when the answer table contains values:

With(
    {thisQuestion:LookUp(colAnswers, (Question=galSubTopics.Selected.Question))},
//if the answer table is not empty then keep it as the data source
    If(IsBlank(thisQuestion.UserTable),colAnswerTableValues,thisQuestion.UserTable)
)
 
Thank you for your time.
Categories:
I have the same question (0)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard