Hot Topic (More than 10 Replies) Best way to turn a lookup table into a db (Read 1594 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Best way to turn a lookup table into a db
Aug 15th, 2006 at 9:07pm
Print Post Print Post  
My Q&A Workorder database had an associated Lookup Table which translated nicely, as another form in the application.  Several factors make me want to split it out into it's own separate database:
1) My Invoice database will have its own, completely different lookup table, and
2) The fewer things "under the hood" that I have to show to my users, the better.

From what I've read, the procedure to do this seems to be:
1) Make a copy of the main application
2) Rename it to the Lookup Table's db name
3) Go into the new app and trim out every form/database except the lookup table
4) Go into the old app and trim out the Lookup Table.

Is this correct?  Or is there a better (cleaner/faster) way to do it?
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Best way to turn a lookup table into a db
Reply #1 - Aug 15th, 2006 at 11:56pm
Print Post Print Post  
A lookup table in Sesame is a database. Do you mean application?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Best way to turn a lookup table into a db
Reply #2 - Aug 16th, 2006 at 6:20am
Print Post Print Post  
If you are talking about the Lookup Tables in Q&A....

This should have come into Sesame as a database originally.....but....

You can use QA4LOOK.exe utility to extract a Lookup Table into an ASCII file. 
This is a utility provided with Q&A.

Then import that into a Sesame database.  Only need a Sesame form with 5 elements.

« Last Edit: Aug 16th, 2006 at 2:47pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Best way to turn a lookup table into a db
Reply #3 - Aug 16th, 2006 at 1:28pm
Print Post Print Post  
I don't think I made myself clear.  Let me try again.

When I translated my Workordr.DTF into Sesame, I got 2 forms as a result.  One was the main Workorder database and the other was the associated lookup table.  When I merged Workordr into my main application, both came along for the ride.  So now in my main application I have:

Customer
Tariff
Workordr
Lookup Table
Equipment

Unlike the other four, the Lookup Table is nothing the user will ever have to see or access, so I would like to split it out of the application into its own file, after which I will change my Lookup programming to point to that .db.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Best way to turn a lookup table into a db
Reply #4 - Aug 16th, 2006 at 2:03pm
Print Post Print Post  
If you simply do not want the users to see that database then you can hide it using @HideTreeItem() found on page 122 of the Sesame 1.1 programming Guide. Just put it in the On Application Open Event.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Best way to turn a lookup table into a db
Reply #5 - Aug 16th, 2006 at 2:45pm
Print Post Print Post  
LookUP Table is already a separate database.

1.  Rename it.

2.  Change the programming in the original Workordr database to do XLU vs. the original LU commands.

3.  You can hide the table and forms on the Menu Tree so they are not visible.
You can toggle that visibility so only Administrator can see it and use it and do maintenance as needed.




  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Best way to turn a lookup table into a db
Reply #6 - Aug 16th, 2006 at 3:00pm
Print Post Print Post  
You might consider getting rid of the lookup table entirely and using GlobalValue instead. GlobalValues have a lot less overhead (read: "faster"), do not show up as a database in the command tree, and are much more flexible.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Best way to turn a lookup table into a db
Reply #7 - Aug 16th, 2006 at 4:53pm
Print Post Print Post  
OK, well, I split it off using Trim and XLookups are working.

Quote:
You might consider getting rid of the lookup table entirely and using GlobalValue instead. GlobalValues have a lot less overhead (read: "faster"), do not show up as a database in the command tree, and are much more flexible.


Sounds perfect, but I have no experiemce with Global Values and the book is frustrating.
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Best way to turn a lookup table into a db
Reply #8 - Aug 17th, 2006 at 1:38pm
Print Post Print Post  
Infinity wrote on Aug 16th, 2006 at 4:53pm:
Sounds perfect, but I have no experiemce with Global Values and the book is frustrating.


GlobalValues are really very simple. They are a way to store a data using a tag. The tag is used to retrieve the data.

Code
Select All
GlobalValue("MyName", "Mark")
 



Will store the string "Mark" under the tag "MyName". If I want to find out what is stored under "MyName":

Code
Select All
var aa as string

  aa = @GlobalValue("MyName")
 



That's pretty much all there is to it. They are stored inside your application file, so they don't go away at the end of your session.

To lookup, lets say a zip code lookup by city and state, first store it:

Code
Select All
var aa as string

  aa = CityName + "|" + StateName
  GlobalValue(aa, ZipCode)
 



And then look it up:

Code
Select All
var aa as string
var MyZipResult as string

  aa = CityName + "|" + StateName
  MyZipResult = @GlobalValue(aa)
 



Usually a table of GlobalValues would be created once, often using a mass update. Then the normal event code would look things up.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Best way to turn a lookup table into a db
Reply #9 - Aug 17th, 2006 at 4:32pm
Print Post Print Post  
Thanks Mark.  It does sound very useful.  I'll have to read some more about it and try a few experiments. 

Quote:
Usually a table of GlobalValues would be created once, often using a mass update. Then the normal event code would look things up.

Where is this table stored?  And where does this code go:
Code
Select All
GlobalValue("MyName", "Mark") 



Thanks again.
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Best way to turn a lookup table into a db
Reply #10 - Aug 17th, 2006 at 6:03pm
Print Post Print Post  
Infinity wrote on Aug 17th, 2006 at 4:32pm:
Where is this table stored? 


The data (its not really a table) is stored in the application file (.db and .dat).

Quote:
And where does this code go:
Code
Select All
GlobalValue("MyName", "Mark") 




If you are trying to eliminate a lookup database, you would run a mass update on that database, moving the data into GlobalValues. Once that data is in Global Values, you don't need that database, or the code in the mass update again (accept as a backup).
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Best way to turn a lookup table into a db
Reply #11 - Aug 17th, 2006 at 8:54pm
Print Post Print Post  
Quote:
If you are trying to eliminate a lookup database, you would run a mass update on that database, moving the data into GlobalValues. Once that data is in Global Values, you don't need that database, or the code in the mass update again (accept as a backup).


Ah, this helps a lot, I'm starting to understand what GlobalValues are and how they can be used.    In my case the items in my Lookup Table are things that will need to be edited once or twice a year (maybe more, if my boss feels like it) so I like having them in a separate database that I can access at my whim, instead of "built-in" to the structure of the app.  But I can see where such things could be handy if they never need to change.

Thanks Mark!
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Best way to turn a lookup table into a db
Reply #12 - Aug 17th, 2006 at 9:29pm
Print Post Print Post  
Infinity wrote on Aug 17th, 2006 at 8:54pm:
Ah, this helps a lot, I'm starting to understand what GlobalValues are and how they can be used.    In my case the items in my Lookup Table are things that will need to be edited once or twice a year (maybe more, if my boss feels like it) so I like having them in a separate database that I can access at my whim, instead of "built-in" to the structure of the app.  But I can see where such things could be handy if they never need to change.

Thanks Mark!


Even if they need to change occasionally, I would still recommend using GlobalValues. When you need to change some of them, write a 1 record mass update (don't affect the one record) that edits those Global Values to their updated value. When complete, you can probably just toss the code.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged