Inkey Solution Logo
banner

Blogs

Performing CRUD Operations in Power Apps using any Data Source – Part V

, August 19, 2023 1752 Views

In the previous 4 blog parts, we have shown what data source we are using, Data Model View, how to connect to any data source in Power Apps, how to read data from any Data source, how to create records using the Patch method for column of any data type, how to update existing records from any Data source, and deleting a record from Data Source. You can check the forth part here.

In this blog, we will be showing how to perform all the CRUD operations using Forms. Basically we are going to explain in two points : 

  • Screen Setup for CRUD Operations.
  • Performing CRUD operations using Forms.

Screen Setup for CRUD Operations

In this method we’re using “scr_View” to view our records and then we have created 2 more screens, “CreateScreen” and “DetailsScreen”, respectively. [Note: we have shown the creation of the ‘scr_View’ in Blog Part II of this 5-part blog series]

  • Create a new screen and rename it to “CreateScreen”
  • Update the OnVisible Property of the “CreateScreen” screen with following code:
    //—————— Logged In User (mail, displayName) —————————

Set(gv_loggedInUserEmail,Office365Users.MyProfileV2().userPrincipalName); //storing Email of the user in this variable.

Set(gv_loggedInUserDisplayName,Office365Users.MyProfileV2().displayName); //storing DisplayName of the user in this variable.

Master CRUD Operations in Power Apps

  • Add an input control, “Edit form” on the screen, and rename it to “Form_AddEdit”
  • Set the “DataSource” of the “Form_AddEdit” to SharePoint list “list_PatchingFromPowerApps” 
  • Set the “Items” property of the “Form_AddEdit” to “gal_ViewOnlyRecords.Selected”
  • Add the “Fields” property of the “Form_AddEdit” to the fields which we are working with.
    Refer below screenshot.

Master CRUD Operations in Power Apps

 

  • Do change the “Items” and the “DefaultSelectedItems” property of the Teacher Combo-box of the “Teacher” field as shown in below images and set the DisplayMode property to “Disabled”

Master CRUD Operations in Power Apps

Master CRUD Operations in Power Apps

  • Add button, and rename it to “Close” which should navigate to “scr_View”, i.e., on its OnSelect Property write “Navigate(scr_View)”
  • Add button, and rename it to “Submit” and on its OnSelect Property write “SubmitForm(Form_AddEdit)”
  • Create a new screen, “DetailsScreen” which will be a View Only Records Values type of Screen.

Master CRUD Operations in Power Apps

  • Make some modifications in the “scr_View”  as shown in the image below. The red icons in the image will be used to operate CRUD operations using the FORMS.
    + Icon: To create new records using Forms
    Edit Icon: To edit existing records using Forms
    Eye Icon: To view the records.

Master CRUD Operations in Power Apps

#Explanation

 

B. Performing CRUD operations using Forms.

Create New Records:

  • Press + icon of scr_View.

Master CRUD Operations in Power Apps

  •  You will navigate to “CreateScreen”. Add dummy values in the controls as shown in below image and press the Submit button.

Master CRUD Operations in Power Apps

  • On pressing the Submit button, you will be navigated back to “scr_View” and you can see your record.

Master CRUD Operations in Power Apps

 

Edit Existing Records:

  • Click “Edit” icon. You will be navigated to “CreateScreen” with default pre-filled values in respective controls. (Ignore other data in gallery)

  • Edit some values of the controls as shown in the image and press the Submit button.

  • On press of Submit button, you will be navigated to “scr_View” where you can view the edited record’s values.

View Existing Records:

 

  • Press Eye icon of “scr_View”. You will be navigated to “DetailsScreen”

 

mm

Inkey

INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?