Skip to content

Basic Data Synchronization

This page provides information about the Basic Data Synchronization concept.

IFS provides a functionality to synchronize basic data throughout a set of companies. Currently there are several basic data pages supported by this functionality in Enterprise and Accounting Rules.

Use this page when you want to add more basic data pages to have this capability of synchronizing data.

Register Basic Data Pages

When you want to add the synchronization functionality to a basic data page the first step is to register the page in the Basic_Data_Window_Tab.

To do this, you will need to enter the page information in the BasicDataSyncLU.ins in the relevant component. The name of the file should be  <Component>BasicDataSyncLU.ins. If the relevant component does not have an existing file please refer the example and create a new ins file.

The call to insert page and LU information should have the following information.

Note:

...  
Attribute_Row_('LuName', 'Page Name');  
...

Refer example in RegistrationExample.ins

Server Changes

There are several new methods that should be written in the plsql file to support the synchronization functionality.

Public Methods

  • Copy_To_Companies_Svc
Parameter Name Comment
attr_ attribute string
run_in_background_ Run in background TRUE or FALSE
log_id_ id of the log created to show information regarding the synchronization
...  
   ELSIF (name_ = 'KEY1_LIST') THEN  
       key1_list_ := value_;  
   ELSIF (name_ = 'KEY2_LIST') THEN  
       key2_list_ := value_;     
...

The list of keys other than the Company ID should be fetched and passed to the Copy_To_Companies_For_Svc___ along with other parameters.

Refer example in ServerMethodsExample.plsql

Protected Methods

  • Copy_To_Companies_
Parameter Name Comment
attr_ attribute string

Note:

...  
ELSIF (name_ = 'ATTRIBUTE_LIST') THEN  
   attribute_list_ := value_;  
ELSIF (name_ = 'ATTRIBUTE_VALUE_LIST') THEN  
   attribute_value_list_ := value_;  
...

All keys except the company ID should be added to parameters as shown above.

Refer example in ServerMethodsExample.plsql

  • Copy_To_Companies_
Parameter Name Comment
source_company_ source company ID
target_company_list_ list of target companies
key1_list_ list of key one after the company ID
key2_list_ list of key two after the company ID
update_method_list_ update method list
copy_type_ manual or automatic synchronization
attr_ attribute string

Note:

...  
i_ := 0;  
ptr_ := NULL;  
WHILE Copy_To_Company_Util_API.Get_Next_Record_Sep_Val(value_, ptr_, attribute_list_) LOOP  
   ref_accounting_attribute_val_(i_).attribute := value_;  
   i_ := i_ + 1;  
END LOOP;  
...

This should be done for all the keys of the LU except the company ID.

Refer example in ServerMethodsExample.plsql

Private Methods

  • Copy_To_Companies__
Parameter Name Comment
source_company_ source company ID
target_company_ target company ID
key1_ key one after the company ID
key2_ key two after the company ID
update_method_ update method
log_id_ id of the log created to show information regarding the synchronization
attr_ attribute string

Note:

...  
log_key_ := key1_ || '^' || key2_;
...

The keys other than the company ID should be added to the log_key_.
Refer example in ServerMethodsExample.plsql

Implementation Methods

  • Copy_To_Companies_For_Svc___

This method is used to extract values from attribute string. This is called from method Copy_To_Companies_For_Svc.

  • Check_Delete___
...
IF (App_Context_Sys.Find_Value(lu_name_||'.copy_to_company_', 'FALSE') != 'TRUE') THEN
   IF (Company_Basic_Data_Window_API.Check_Copy_From_Company(remrec_.company, lu_name_)) THEN
      Error_SYS.Record_General(lu_name_, 'NODIRECTREMOVE: A record cannot be removed as :P1 window has been set up for copying data only from source company in Basic Data Synchronization window.', Basic_Data_Window_API.Get_Window(lu_name_));
   END IF;
END IF;
...

This should be added as pre-processing code.

  • Check_Common___
...
IF (App_Context_Sys.Find_Value(lu_name_||'.copy_to_company_', 'FALSE') != 'TRUE') THEN
   IF (Company_Basic_Data_Window_API.Check_Copy_From_Company(newrec_.company, lu_name_)) THEN
      Error_SYS.Record_General(lu_name_, 'NODIRECTINSERT: A record cannot be entered/modified as :P1 window has been set up for copying data only from source company in Basic Data Synchronization window.', Basic_Data_Window_API.Get_Window(lu_name_));
   END IF;
END IF;
...

This should be added as pre-processing code.

Refer examples in ServerMethodsExample.plsql

IFS Cloud Web Changes

These changes should be done to support Basic Data Synchronization in the relevant client and projection files.

There is a new fragment inside Enterp which should be included in the both client and projection.

Name of the fragment: CopyToCompaniesAssistant

The above fragment contains the implementation of the Copy To Companies Assistant. 

Following changes should be done in the client to support Basic Data Synchronization functionality.

  • Add CopyToCompaniesCommand

CopyToCompanies command should be added same as given below. Make sure to replace <LogicalUnit> and with correct information. e.g. AccountGroup, Account_Group_API.

command CopyToCompaniesCommand {
   label = "Copy to Companies";
   mode = SelectedRecords;
      variable CurrentCompanyVar;
   bulkexecute {
     call GetSelectedCompany(Selection) into CurrentCompanyVar;
     if [CurrentCompanyVar = null] {
       alert("All the selected records must be from the same company");
     }
     else {
        assistant CopyToCompaniesAssistant(CurrentCompanyVar, "<LogicalUnit>", "MANUAL", Selection, "<Package_Name_API>") {
           when OK {
              exit;
           }  
        }
     }
   }
}
  • Add 'after command' AutoCopyToCompaniesCommand in the page or list to support automatic update.
list AccountGroupList for AccountGroup {  
   orderby = AccntGroup;  

   crudactions {  
      after command AutoCopyToCompaniesCommand;  
   }  
   ...  
}
  • Add AutoCopyToCompaniesCommand as given below. Make sure to replace <LogicalUnit> and <Package_Name_API> with correct information. e.g. AccountGroup, Account_Group_API.
command AutoCopyToCompaniesCommand {  
   label = "Copy to Companies";  
   mode = SelectedRecords;  
   variable CurrentCompanyVar;  
   variable SelectionVar;  
   variable StateVar;  
   bulkexecute {  
      set CurrentCompanyVar = "${context.Company}";  
      call IsActiveLuExist(CurrentCompanyVar, "<LogicalUnit>") into StateVar;  
      if  [StateVar = "TRUE"] {  
        if [CreateCount > 0] {  
          set SelectionVar = CreateList;  
        }  
        if [UpdateCount > 0] {  
          set SelectionVar = UpdateList;  
        }  
        if [DeleteCount > 0] {  
          set SelectionVar = DeleteList;  
        }  
        assistant CopyToCompaniesAssistant(CurrentCompanyVar, "<LogicalUnit>", "AUTOMATIC", SelectionVar, "<Package_Name_API>") {  
           when OK {  
              exit;  
           }  
        }  
     }  
  }  
}

Refer Account.client, AccountHandling.projection, AccountGroups.client, AccountGroupsHandling.projection for more details about these examples.