For  reset update

Chapter - 08

Visit to buy the book on Citizen Development https://go.amitpuri.com/buynow

Code Snippet #10

For reset update

This code snippet performs a series of operations to reset and update the state of a user interface related to the display and management of referral data. The operations include resetting context variables, refreshing a data source, and filtering data for display.

    UpdateContext(
    {
        locSortOrder: false,
        locFiltered: false
    }
    );

    Reset(txtSearch);
    UpdateContext(
        {
            locSortOrder: false,
            locFiltered: false
        }
    );
    Refresh(Referrals);
    UpdateContext(
        {
            tabReferrals: Filter(
                Referrals,
                'Referrals (Views)'.'My Referrals'
            )
        }
    ); 

Explanation

  • Setting Initial Context Variables:- UpdateContext({ locSortOrder: false, locFiltered: false });: This line initializes or updates two context variables: locSortOrder and locFiltered, setting both to false. These variables likely control the sorting and filtering state of data displayed in the app.

  • Resetting the Search Text Input Control:- Reset(txtSearch);: This function resets the txtSearch control, which is likely a text input field. This action clears any text the user might have entered.

  • Reiterating Context Variable Updates:- The code again updates the same context variables locSortOrder and locFiltered to false. This appears to be redundant, as these variables were already set to false in the previous step.

  • Refreshing the Data Source:- Refresh(Referrals);: This function refreshes the Referrals data source. It ensures that the app is working with the most up-to-date data, reflecting any changes that might have occurred outside of the app or in other user sessions.

  • Updating Context Variable with Filtered Data:- UpdateContext({ tabReferrals: Filter(Referrals, 'Referrals (Views)'.'My Referrals') });: This updates the tabReferrals context variable with data filtered from the Referrals data source. The Filter function is used to select only those records that meet the criteria defined by 'Referrals (Views)'.'My Referrals', which is likely a specific view or subset within the Referrals data source.

In summary, this code snippet is designed to reset certain user interface elements and states, refresh the data source to ensure current data is being used, and update a context variable with a filtered set of referral data. This type of functionality is common in applications where data needs to be reset or reloaded based on user interactions or other application events, ensuring that users are always presented with the most relevant and current information.

Happy #low-code learning

Visit: www.amitpuri.com

Id: Chapter-08-CS00010

Category: Chapter 08

Amit Puri, Advisor and Consultant, Strengthening Digital Experiences, Modernize Cloud Journey with AI-Driven Transformation!

Code Snippet # 9
Chapter-08-CS00009 - Code Snippet # 9
Code Snippet # 4
Chapter-06-CS00004 - Code Snippet # 4
Code Snippet # 2
Chapter-08-CS00002 - Code Snippet # 2