Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Data Lookup Tables
Hi All,
I use a lot of user-defined functions to look up names, telephone numbers, IP addresses, email, etc to customize my macros for my various users. To enroll users, I just add their names to the look up functions like this:

Copy      Help
function str&userlogin str&fullname str&lastname
if userlogin = "User1
,lastname = "Smith"
,fullname = "John Smith"
if userlogin = "User2"
,radlastname = "Doe"
,radfullname = "John Doe"
if userlogin = "User3"
,radlastname = "Johnson"
,radfullname = "Jack"

and then call them from a specific macro/function like this:

Copy      Help
str userlogin fullname lastname
NameLookup userlogin fullname lastname

This works fine but I want to now build an admin panel which will enroll new users to the system through a dialog with text-entry fields rather than having the admin having to actually dig into the actual script.

I can think of many ways to do this:
populate a xml or csv file or a Sqlite database. I can then load the specific file at time of QM launch from the network drive and then update it through the admin dialog. I think this won't be too hard and I am very comfortable now with using Sqlite to populate to and from a QM grid in a dialog (Thanks Gintaras for your amazing integration of sqlite!!!!!!).

I geuss my question is: is there a best recommended way of doing this from other people's experience? Are there any problems, I should be aware of? I plan on loading the dtabase file locally at QM startup rather than reloading or accessing the database on the server each time a query is done. I would estimate that just about every macro has one or two calls to a user-define function and therefore would need to address the database similarly frequently. Do you think this will be much slower than doing the user-defined function as above?

I can do the code, just looking for strategy. I would like to avoid a lot of trial and error and go straight to the elegance!!! (though I know that is almost never possible!). Big Grin

Thanks for any insight!
I don't have experience in this. Managing users database etc. I think, for similar tasks usually are used databases. Sqlite is one of fastest database types. I think in most cases the speed should be acceptable. Need to measure. Also, you can use database speed optimizations, eg create index.
thanks!!!!, I will let you know my experience and post my code.

Forum Jump:

Users browsing this thread: 1 Guest(s)