Hot Topic (More than 10 Replies) traversing full complete records (Read 2499 times)
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
traversing full complete records
Sep 7th, 2005 at 8:33pm
Print Post Print Post  
I looked and couldn't find an answer to my question here but I'm new to Sesame so excuse my terminology.

I have experience with flat database files and writing code to interact with these files. Right now I have been given a Sesame app with 4 databases and multiple forms. I need to extract complete records from the database, null values and all. When I do file I/O on any given element I only get the output of what exists in that column or field, if there are 10,000 records but only 20 unique values in any given field, thats all I recieve in my output. I guess I need to know if there is a function that will allow me to traverse through the [u]complete[/u] records one by one and extract or do whatever to the fields contained in that record?
Thanks for any help.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #1 - Sep 7th, 2005 at 9:11pm
Print Post Print Post  
How are you currently doing the "extraction" that gets you the 20 unique values?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #2 - Sep 7th, 2005 at 9:52pm
Print Post Print Post  
I have been using the Text File I/O Functions in conjuction with other functions to try to increase the scope of fields such as GlobalValue.
Thanks for the help!, I sure can use it.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #3 - Sep 7th, 2005 at 9:56pm
Print Post Print Post  
Take a look at @XLookupAll and some of the other X-commands.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #4 - Sep 7th, 2005 at 10:10pm
Print Post Print Post  
I have actually looked at the X functions and used XListValues but it still just seems to return fields that are populated. I was hoping that I would get just ;; for empty values but didn't.
Maybe I'm missing something with the design of the initial application concerning the linking of fields? The data was apparently in Q&A before Sesame if that sheds any light on my problem concerning linking?
Thanks again.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #5 - Sep 8th, 2005 at 12:05am
Print Post Print Post  
Can you post a more specific explanation of what you are trying to accomplish.

Is this a one time extraction?

How do you plan on running rhis routine?

The more specific, the easier it is for people to help with a solution. Smiley
  

Team – Together Everyone Achieves More
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: traversing full complete records
Reply #6 - Sep 8th, 2005 at 1:22am
Print Post Print Post  
Are you looking for something that looks like a flat file spreadsheet type of format so that you can step through each record and select which ones you want to process?
  



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


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #7 - Sep 8th, 2005 at 2:20pm
Print Post Print Post  
What Bob Hansen asked is right on the money. Thats exactly what I'm looking for. Hopefully its possible with  Sesame?
Its going to be run a couple of times a year. The records need to be taken from the database and placed in an ascii file with an accompaning definition for each field , one after the other, ~10000 records in total.
Thanks again for the help.
  
Back to top
 
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #8 - Sep 8th, 2005 at 10:05pm
Print Post Print Post  
I've hit a wall, I can't seem to figure out how to retrieve complete records(with their fields disperced among 5 databases, one .db) and use file I/O to export them to an ascii file one complete record at a time. I must be missing something? PLease help! Thanks.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #9 - Sep 8th, 2005 at 11:02pm
Print Post Print Post  
[quote author=North_Guy  link=1126125207/0#8 date=1126217100]I've hit a wall, I can't seem to figure out how to retrieve complete records(with their fields disperced among 5 databases, one .db) and use file I/O to export them to an ascii file one complete record at a time. I must be missing something? PLease help! Thanks.[/quote]

North_Guy,

A record, by definition, consists of the fields from a single database. If you have five databases (even within the same db), you will have to give us some detail as to how one determines which records in each of the five databases go together to form one large "Record".
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #10 - Sep 8th, 2005 at 11:39pm
Print Post Print Post  
North_Guy

For starters do not panic. There are ways to achieve your goal. Second I would highly recommend attending an integrating Sesame with External Applications class offered by Hammer Data systems. It teaches how to create files like you are looking for.

You also might look into the Lantica product called Extractor. I do not know if it only reads 1 database at a time or all databases in an application. A Lantican will need to answer that question.

If I understand the process you need in lay terms you have an application that has 5 databases with the data in each database related to each other. You want all the related data from the database as one line in an ASCII file.

What form of linking did you use, Natural or relational?

If my statements above are correct the basic steps you need to do is

Get all data per record into elements or variables
Open a file to write to in a format you choose
Format the data with the correct separators
Write the line to the file
Close the file.

One basic method you can use to get all data per record together is by creating a form with each of the remaining databases as subforms. The elements on the main form are then available to export and by creating variables and using  @formfieldValue() you can then have all the related data available to export. Example

vpropertystreet = @formfieldValue("property","propertyStreet",0)

Then format the data with the separator you need. Example


     vData = VpropertyStreet + "^" + VpropertyCity + "^" + VpropertyState + "^" + VpropertyZip + "^" + VpropertyFirst + "^" + VpropertyLast + "^"+ VFirmname + "^"+ vpropQuotedRate + "^" + vLoanSizeDesired + "^" + vPropertyType + "^" + VMarketValue + "^" + VMarketValueestorap + "^" + VuseridFullName + "^" + VuserEmail + "^"

Then use the file commands to open, seek, write and close the file. Look at

fileOpen()
fileSeek()
fileWriteLn()
fileClose()


There are cleaner methods I am sure but hopefully this  example should get you started in the correct direction.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #11 - Sep 9th, 2005 at 2:55pm
Print Post Print Post  
Thanks BOBSCOTT, I appreciate the advice and will look into the workshop.
Unfortunately I don't know if natural or relational linking was used because I didn't create the application, it was given to me already created. I will look into it though and see if I can find out, I'm sure it can be easily done through the menu, like I said I'm green to Sesame, seen it for the first time less then 2 weeks ago, I have experience with Access and MySQL and a little with Oracle but that was with mainly flat files and I wrote code, Perl/Java, to interact with the databases mostly through web applications.
The method you suggested is exactly what I tried, using the @formfieldValue function and file i/o, but the problem was scope and doing what you suggested, making the remaining databases subforms, would solve that problem I guess! Thanks, I appreciate it.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #12 - Sep 9th, 2005 at 3:22pm
Print Post Print Post  
North_Guy,

Sesame is not SQL based, nor is it structured like a true relational database engine. If you try to make it behave like Access or my SQL, you are doing the square peg - round hole thing.  If you were to write an SQL query to get the data you want from mySQL, how would it look? I speak SQL, so this will let us see exactly what you are trying to accomplish.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #13 - Sep 9th, 2005 at 4:00pm
Print Post Print Post  
Thanks Hammer, thats a good idea. It would be a simple:
select * From 'table_name'
where field1 = 'someVariable'

with 'someVariable' being a unique field value already retrieved  with a select or maybe even produced by loop and counter.
Of course this would be wrapped in some language like java that places the result/record in an array or maybe use functions like getStatement().executeQuery("Select.......) in java and move through the resultset using resultset.next() and do the required output formatting to get the final product.
Hope this helps clearify what I'm trying to do, actually BOBSCOTT explains what I'm trying to do nicely.
Thanks again Hammer.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #14 - Sep 9th, 2005 at 4:27pm
Print Post Print Post  
Okay, I only see one "table" in your SQL, therefore, @XLookupSourceListAll should do it for you. Have you tried this? If so, what was wrong with the result?

Please be specific. Remember that we can't see anything you have or are doing.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #15 - Sep 9th, 2005 at 5:23pm
Print Post Print Post  
Thanks Hammer, sorry for not being specific, I'm still trying to learn Sesame and how it works and terminology.
In my SQL example I used one table because thats what I would want to have ideally but I have 5 tables/databases in this application in Sesame. In Access these tables would be joined on common columns and I would use those to retieve the complete record from the 5 tables, but in Sesame I can't figure on how to do that but its like you said, maybe its because its not SQL based or a true relational database engine(which makes me curious on exactly how the seperate elements in the 5 databases I have are part of one complete 'record' and how they know where to point to one another?) .
I will talk to the creater of the application and find out how he created the file as far as the linking goes because I think thats the key problem here. Maybe a redesign or mod to the design is needed in order to accomplish what I'm trying to do.
Thanks again for all your help.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #16 - Sep 9th, 2005 at 6:32pm
Print Post Print Post  
I was actually expecting you to show me SQL that included JOIN statements.

Let us know what you find out and we'll try to help.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #17 - Sep 12th, 2005 at 8:55pm
Print Post Print Post  
BOBSCOTT Wrote:
"One basic method you can use to get all data per record together is by creating a form with each of the remaining databases as subforms. The elements on the main form are then available to export and by creating variables and using  @formfieldValue() you can then have all the related data available to export. "

I have tried this but still I can't see the elements on the subforms? I added a new database and new form under that database and then added 2 subforms which were forms from 2 other databases in the same application. But when I open it up in runtime and do an F10, no data shows up in the subforms that are on the new form I just created.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #18 - Sep 12th, 2005 at 10:36pm
Print Post Print Post  
It sounds like the data is not linked.
When you created your subforms did you select natural or Relational?
If you selected natural try entering a new record completely.
Make sure all data populates correctly.

If it all works correctly now try running your Sbasic programming that retrieves all the values and see if it is working correctly on that particular record.
This will tell us that the Sbasic you are using is correct and then all we have to do is get all your data linked up properly. Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #19 - Sep 13th, 2005 at 8:40pm
Print Post Print Post  
I have tried using both types of linking. When I do a search now I still get no data showing on the forms but I placed a command button on the form and wrote code behind it(@xLookupSourceListAll) and when I do that I can at least retrieve data from the form specified in the function parameters but I need to retieve data from all the subforms, not just one subform at a time. I guess thats where the linking comes in. Any suggestions about where to look in the manual regarding my linking problem?

Maybe I'm wrong but I've been thinking about this and the only way I can traverse through the complete records 1 at a time is by using the @FormFieldValue function with all the field values being on one form.
Am I wrong?
Thanks once again.
  
Back to top
 
IP Logged
 
North_Guy
Member
*
Offline


No personal text, yet.

Posts: 25
Location: Alberta, Canada
Joined: Sep 7th, 2005
Re: traversing full complete records
Reply #20 - Sep 16th, 2005 at 5:24pm
Print Post Print Post  
I've tested my SBasic and I can retrieve data that I have added to my subforms(created using natural linking), so I guess its the linking problem again, any help on how to link the data from the original form to the subform would be appreciated, Thanks.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: traversing full complete records
Reply #21 - Sep 16th, 2005 at 5:37pm
Print Post Print Post  
Quote:
guess its the linking problem again, any help on how to link the data from the original form to the subform would be appreciated, Thanks.


A Lantican may be able to give you a simpler or better method.

The method I have used was to export my data and then import it into my revised database. Look in the users guide starting at page 342 Importing Data. If i understood what you are trying to do, this should help.

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged