Skip to main content

Notifications

Apps with Batch Saving & Single Record Updating [Part 3: Final]

Continue from Part 2…

 

In the previous Chapter, I had shared on the basic coding for SAVE New data.

In this Final Chapter, let's concentrate on how can we UPDATE a single record using

- UpdateIf function based on CONDITION

 

Why use Toggle?

As I was responding to @OlaH’s question, and understand that using Toggle looks more gorgeous and App’s like looking, I also found that Toggle is very suitable for small screen, user-friendly and widely used in most of the Apps.

 

Anyhow, as Toggle hasmany behavior action, this shall be selected carefully:

- OnCheck

- OnUnCheck

- OnChnage

- OnSelect

 

The main reason that I use OnSelect is because I wish to have the UpdateIf being triggered only when selected, NOT OnCheck or OnUnCheck.

[OnChange must be avoided here because when I change the Date, the defaults values will make the Toggle value change to either true / false (defaults value), and this will trigger UpdateIf, In which this is supposed not to happen.]

 

Formula

 

Toggle1.OnSelect =

 

UpdateContext({LoadingIcon: true});

UpdateIf(TableAttendance,

Date = 'Today-Date'.Text && Grade = DropdownGrade.Selected.Result && StudentName = 'Student-Name'.Text && Attendance <> Text(Toggle1.Value),

{Attendance: Toggle1.Value, Reason: DropdownReason.Selected.Value, Teacher: DropdownTeacher.Selected.Result}); UpdateContext({LoadingIcon: false})

 

Select Reason, Change Attendance (Toggle)Select Reason, Change Attendance (Toggle)                    Update in processUpdate in process

Rational Reason

 

What happens when toggle is SELECTED (or changed, and after RELEASE of the toggle button):

  • Since the …. (left to right dots indicating saving in process) is not obvious, again, I use a GIF file to remind of the saving process & turn off after completion of updating
  • -When Date/Grade/StudentName MATCH and Current Selected Attendance (Toggle selected value, either true to false OR false to true) is NOT EQUAL to the actual Attendance Value in Existing datasource, UpdateIf will fire.
  • - {…………} will be used to Update selected field. In this example, Attendance (key reason) is updated, Reason and so does the Teacher (who did the change)
  • For me, the is the most tricky part. Play with it and rest assure you that you will do better than me.
  • -UpdateIf is much faster compare to PATCH or UPDATE because it only save on selected row of records / columns

 

Lastly

 

Patch, ForAll, UpdteIf, with conditions formula, altogether are sufficient in creating a CRUD environment.

[I do not include DELETE in this sample as it is not my intention to delete data]

Appreciate comments for improvement and at the same time, wishing those who needs equivalent application will benefit from this detailed explanation sample.

Feel free to see the:

- Sample Apps

- Sample Data

- Simple demo video

Comments

*This post is locked for comments

  • JenC Profile Picture JenC
    Posted at
    Apps with Batch Saving & Single Record Updating [Part 3: Final]

    Hi there! Thanks for sharing your app! I'm working on something that would provide me with similar functionality to the app you built, but I need to navigate between multiple screens. The trouble i run into is when i navigate from 1 screen to the other and back again, my filtered results gallery disapears. Is there anyway i can get the gallery to stay on the current item selected when i navigate back to my "DailyAttendance" screen? 

     

    Daily Attendance ScreenDaily Attendance ScreenProduction Hours ScreenProduction Hours ScreenHit Cancel, back to daily attendance. Gallery is emptyHit Cancel, back to daily attendance. Gallery is emptyClick on drop down, gallery re-populatesClick on drop down, gallery re-populates

  • hpkeong Profile Picture hpkeong 2,944
    Posted at
    Apps with Batch Saving & Single Record Updating [Part 3: Final]

    You are most welcome and hope something can be improved further....

  • Audrie101 Profile Picture Audrie101
    Posted at
    Apps with Batch Saving & Single Record Updating [Part 3: Final]

    Thank you so much for adding the attachment sample!