Monday, June 15, 2015

'Globals' Vs 'GET_APPLICATION_PROPERTY'


'Globals'  Vs  'GET_APPLICATION_PROPERTY' 


      In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,


     In spite of  'Global variable's downsides,  in some cases, it is still a good    alternative  solution  

       'Global variables'  are initialized once to hold e.g. user's name value and it persists or lasts  with you till the form's  end of  session

   No  'Global variable' downloads can exist that may affect your  application in terms of  system efficiency and resources. 


      On the other hand, you should also recognize alternatives e.g. getting user names, has another alternative you can use as follow: 

GET_APPLICATION_PROPERTY (USERNAME) built-in 

   You can assign the return value of Get_Application_Property(USERNAME) built- function to a variable or a form item to get the current user name.


       Two methods with one output:


          If  you know there are two ways to get your out put then you should learn why you have to choose then decide what to choose. This depends upon specific system criteria as follow:

       why to choose vs. what to choose...?


o   If your application is Not Large so it is more efficient to use  GET_APPLICATION_PROPERTY (USERNAME) built-in, it does not make sense to think about  'Global variable' to hold the current data base user name whereas it is already stored and can be easily retrieved from the database.

o   If your application is Large and/or you do expect to build different integrated systems supported by a security application system then  'Global variables'  is the best choice. This logically leads us to understand how  'Global variables'  lives and dies.
     The main LOGIN  form in all applications almost have buttons that holds both one single value of each Global variables and one single call to other sub-main forms for each module system.

          Intialization:

     The question is...  where to initialize it...?  
         In your main application login-form.
         Globals are usually intialized in One main form that holds valuable and popular data that are commonly used,  e.g. user names,  financial year and the company's branch or the location_id.  
   
          The question is...  when to initialize it...?  
       It is recommended to use either PRE-FORM or WHEN-NEW-FORM-INSTANCE form level triggers.

         The question is...  how to initialize it...?    
       U can use any technique to initialize 'Global variables' .


            The login form is the main form application where user inputs data into it's text items. The text items's data values are assigned internally to  'Global variables'  to be passed to any sub-main form application system the user choose upon his request with one button click or what so ever...
     
       Passing Globals from main login form to other applications

         Each sub-main form can receive the Globals from the main application  login form either by assigning the Globals to the local parameters form or by directly reference to Globals by Global's names. 
     
       Erase Globals

             it is strongly recommended to  destroy 'Global variables'  at the moment you don't need anymore.


  The question is...  where to erase it...?  
     In your main application login-form.
   
      The question is...  when to erase it...?  
    U can use key-exit or when-window closed form-level triggers.
  
      The question is...  how to erase it...?    
    U can use  Erase built-in.


     

Hope it helps…

My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.




No comments :