M Mahares Expert Licensed User Longtime User Jan 9, 2016 #1 Since most variables are preferably declared in the Starter Service module, how about create an alias attribute for the ‘Starter’ module to tidy up the code. For instance: in the starter we will have: Code: Copy #Alias: S 'or whatever user wants And in the activity module instead of: Code: Copy If Starter.SQL1.IsInitialized = False Then Starter.SQL1.Initialize(Starter.SQLDBPath, Starter.SQLDBName, True) End If We will have this: Code: Copy If S.SQL1.IsInitialized = False Then S.SQL1.Initialize(S.SQLDBPath, S.SQLDBName, True) End If
Since most variables are preferably declared in the Starter Service module, how about create an alias attribute for the ‘Starter’ module to tidy up the code. For instance: in the starter we will have: Code: Copy #Alias: S 'or whatever user wants And in the activity module instead of: Code: Copy If Starter.SQL1.IsInitialized = False Then Starter.SQL1.Initialize(Starter.SQLDBPath, Starter.SQLDBName, True) End If We will have this: Code: Copy If S.SQL1.IsInitialized = False Then S.SQL1.Initialize(S.SQLDBPath, S.SQLDBName, True) End If
Dave O Well-Known Member Licensed User Longtime User Jan 9, 2016 #2 I agree that having to use "Starter" as a prefix is cumbersome. However, as discussed in this Starter service thread, we can work around this if we declare our Process_Globals variables in another module with a intentionally short name. (I use a "common" code module that I renamed to "c".) Once it's declared there, I can code the following in Starter > Service_Create: Code: Copy c.SQL1.Initialize(c.SQLDBPath, c.SQLDBName, True) The prefixing problem itself is nicely solved in other languages by the WITH or USES keywords, as wished for in this post. Last edited: Jan 10, 2016
I agree that having to use "Starter" as a prefix is cumbersome. However, as discussed in this Starter service thread, we can work around this if we declare our Process_Globals variables in another module with a intentionally short name. (I use a "common" code module that I renamed to "c".) Once it's declared there, I can code the following in Starter > Service_Create: Code: Copy c.SQL1.Initialize(c.SQLDBPath, c.SQLDBName, True) The prefixing problem itself is nicely solved in other languages by the WITH or USES keywords, as wished for in this post.
Erel B4X founder Staff member Licensed User Longtime User Jan 10, 2016 #3 I know that this is just an example. However you should initialize SQL1 in Service_Create of the starter service.
I know that this is just an example. However you should initialize SQL1 in Service_Create of the starter service.
Dave O Well-Known Member Licensed User Longtime User Jan 10, 2016 #4 Erel said: I know that this is just an example. However you should initialize SQL1 in Service_Create of the starter service. Click to expand... Thanks Erel, I've updated my example above to make this a bit more clear.
Erel said: I know that this is just an example. However you should initialize SQL1 in Service_Create of the starter service. Click to expand... Thanks Erel, I've updated my example above to make this a bit more clear.