AppSynching - cWebApp

Returns True if the application is in an initializing state

Type: Function

Return Data Type: Boolean

Parameters: None

Return Value


Syntax
Function AppSynching Returns Boolean

Call: Get AppSynching to BooleanVariable


Description

Returns True if the application is in an initializing state. When True, either the application is being created or it is in the process of being synchronized with a client. In some cases, you will not want to execute certain code when the AppSynching is True.

This is most commonly used in DataDictionary events. Record finding occurs during initialization, which may trigger events that should be ignored. You would use AppSynching to test for this. The most likely events that would be impacted are OnNewCurrentRecord, Refresh and OnPostFind.

As an example, if you were using OnPostFind to set some additional defaults in your web view, you would not want this message to be fired during initialization. Normally, this kind of processing is coded at the DD object level as follows:

Object oInvt_DD is a Invt_DataDictionary
    Set DDO_Server to oVendor_DD
    
    Procedure OnPostFind Integer eMessage Boolean bFound
        Boolean bSynching

        // Each time an inventory item is selected we use the unit price as the
        // suggested price for the line item.
        
        Get AppSynching to bSynching
        // Do not perform this action while synchronizing DDO's to the WebApp Client
        If (not(bSynching)) Begin
            Send SetPriceDefault of oOrderDtl_DD Invt.Unit_Price
        End
    End_Procedure
End_Object 

:

Object oOrderDtl_DD is a OrderDtl_DataDictionary
    Set DDO_Server to oOrderHea_DD
    Set DDO_Server to oInvt_DD
    Set Constrain_File to OrderHea.File_Number

    // set the default price and adjust the display total
    Procedure SetPriceDefault Number nNum
        Set Field_Default_Value Field OrderDtl.Price to nNum
        Send Adjust_Display_total 
    End_Procedure
End_Object