cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sgokul95
Helper I
Helper I

Access the controls of the newly created record in the Gallery

Hi Everyone, 

 

I have a Gallery which contains a CheckBox, TextInput(holds Name) and DropDown(holds the Status) in each of its rows.

 

Also I have a button called "New" in my App which when pressed will create a new record in the Gallery with default empty values using below code:

(ccProjects is a collection created in the App using a SharePoint list and is set as the DataSource for the Gallery)

Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""}
    }
)

 

I need to get this record from the Gallery and mark its checkbox as checked when the New button is clicked. Can anyone please help me out here?

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @sgokul95 ,

 

Since you are wanting to change the check box value inside the Gallery with the button outside, please consider using AddColumns function to add a new column when creating the collection.

ClearCollect(ccProjects, AddColumns(...., "Check", false))

 

OnSelect of the create button:

Set(varNEW, Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""},
        Check: true
    }
  )
)

This variable is exact the new created record.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
Nogueira1306
Super User
Super User

Hey! When you click a button, set a var

Set(varCheckBox; true)

In the Checkbox, set the default to be the varCheckBox

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

Hi @Nogueira1306 ,

 

Thanks for your quick reply.

 

The New button is not present in each row of the Gallery. It is present outside the Gallery. 

So when I created and set the varCheckBox in the "New" button in my App and then set the varCheckBox to the Default property of the CheckBox, the CheckBox in each of the row becomes "Checked" instead of the particular new record that I had created. 

 

 

Ok.. Try to check your data source to check if it is already created.

Something like this:

 

If(CountRows(Filter('DataSource', ID = ThisItem.ID)) >= 1, true, false)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

v-jefferni
Community Support
Community Support

Hi @sgokul95 ,

 

Since you are wanting to change the check box value inside the Gallery with the button outside, please consider using AddColumns function to add a new column when creating the collection.

ClearCollect(ccProjects, AddColumns(...., "Check", false))

 

OnSelect of the create button:

Set(varNEW, Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""},
        Check: true
    }
  )
)

This variable is exact the new created record.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,140)