Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Counting fields with Sesame (Read 4284 times)
Blightman
Member
*
Offline


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Counting fields with Sesame
May 12th, 2004 at 7:51pm
Print Post Print Post  
I want to count the number of entries retrieved from a specific field only if it meets certain criteria. For example, if the field is "Maryland," then another field counts the number of "Maryland" entries the field has, even if there are different entries in that field, i.e. if it has "Virginia," then "Virginia" gets counted in a different field. Any thoughts on how to do this?
  
Back to top
 
IP Logged
 
TJCajun
Junior Member
**
Offline


"Laissez les bons temps
rouler"

Posts: 72
Location: Louisiana
Joined: Nov 25th, 2002
Re: Counting fields with Sesame
Reply #1 - May 12th, 2004 at 8:26pm
Print Post Print Post  
If I'm understanding your question, you have a single field (more properly known as a Layout Element in Sesame), such as a "State" field that might contain numerous repetitive values for any of the "States".  ie, maybe 14 Marylands, 5 Virginias, 13 Utahs, etc.

Do you then have separate layout elements on the form (on screen) to show the counts for each of the possible entries?  Lets say you only have 5 different states to choose from for valid entries.  Do you then have 5 different layout elements names, one for each valid entry showing on the form? 

Or do you just need to design a Report in Sesame, that will give you the counts of the various values in the single layout element?  Something that might look like:

STATE   COUNT
Maryland  14
       Virginia       5
           Utah     13

(ignore the possibly mis-aligned columns above)

  
Back to top
IP Logged
 
Blightman
Member
*
Offline


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #2 - May 12th, 2004 at 8:36pm
Print Post Print Post  

I have a layout element (say, Maryland, Virginia, Utah for each state).  I also have the one layout element where I  where the states are imported. 

There is another layout element that separates the "state" layout element into the appropriate locations so that each state gets counted according to the results, just how you (TJCajun) have listed.  Any suggestions?

Sans souci, monsieur.
  
Back to top
 
IP Logged
 
TJCajun
Junior Member
**
Offline


"Laissez les bons temps
rouler"

Posts: 72
Location: Louisiana
Joined: Nov 25th, 2002
Re: Counting fields with Sesame
Reply #3 - May 12th, 2004 at 11:29pm
Print Post Print Post  
I'm going to sort of apologize in advance, because I can't offer specific programming statements to solve your needs.  I hope by asking questions, and offering some "conceptual help" or ideas, that I'll be of help to you.  Maybe others with more experience will jump in and offer some more definite ideas.

I'm still trying to get a feel for your application, so you may need to correct me, and/or offer more explanation.  It sounds like you have the single layout element that you import the "State" data into, and then separate LE's (one for each state) - so this would be 50 LE's?  Somehow you then have programming to "mark" the proper individual LE for the correct state.  All this sounds a bit complicated to me, and be quite a bit of programming to set up.

Are there other LE's that receive imported data, such as for Address, City, Phone# and so forth?  Maybe if you can describe the application a little more, it will make more sense.

Unless you need to see on the screen, as you are looking at records, a cumulative "total" of the counts for each state, then I think what you should be using is a Report.  Please do clarify if you want to see these counts while looking at records on-screen.  (and maybe WHY you need this?) Or would it be satisfactory to generate a report to show the listing of states and the count for each state?  Such a report should be fairly easy to set up. 

Wink  I live in the central part of Louisiana., but don't speak French other than a very few words, or phrases.  "Let the good times roll" is one of those!
  
Back to top
IP Logged
 
Blightman
Member
*
Offline


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #4 - May 13th, 2004 at 12:46pm
Print Post Print Post  
I'm still trying to get a feel for your application, so you may need to correct me, and/or offer more explanation.  It sounds like you have the single layout element that you import the "State" data into, and then separate LE's (one for each state)

This statement is exactly correct. 

There are other LE that have other pieces of information that I import into the database.  You asked what the purpose of the database is.  My company has assigned me to build a database to compile a huge amount of information in relation to our client contracts.  The database includes their name, client number, address, our costs with them, the amount of materials we received from them, and lots of other miscellaneous pieces of information that we need to track.

The LE in question is actually not a state--I just used that as an easier way to state my problem.  The LE is really imported from a Microsoft Excel spreadsheet.  I used to keep track of everything in Excel, but it was ridiculously time consuming, so I starting building this database to take the raw data and sort it into the appropriate fields and perform certain calculations along the way.  Everything is completed with the database except for this and one other issue.

I have programmed one LE to give me a total calculation--that's the easy part.  I import the data into the various parts of the database, and one of them tracks the errors that were made.  There are certain key words in that LE that I want to count in a different LE based off a key word.  For example, if the word "dry ice" is found in the LE, then there is another LE that counts that key word with the previous records that also contained the word "dry ice" in the retrieved records.  There are about twelve different key words that I have in the LE that need to be sorted.  I need to sort them because of the legal or regulatory issues involved.  I hope this helps.

"Sans souci, monsieur" means "without a care, sir."
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Counting fields with Sesame
Reply #5 - May 13th, 2004 at 12:53pm
Print Post Print Post  
Are the keywords in the form of a semicolon separated list?
i.e.: Maryland;Virginia;Virigina;Vermont;New Hampshire

  

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


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #6 - May 13th, 2004 at 3:43pm
Print Post Print Post  
Are the keywords in the form of a semicolon separated list?
i.e.: Maryland;Virginia;Virigina;Vermont;New Hampshire

The keywords are separated in an Excel spreadsheet and saved as a comma spliced version.  When they are imported into the database in the specific layout element, they are not separated with semicolons.  Instead, each new state is added to a new record.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Counting fields with Sesame
Reply #7 - May 13th, 2004 at 4:24pm
Print Post Print Post  
Blightman,

I'm having trouble getting a clear picture of what data you have and what needs to be done with it. I can't tell if we have an LE with a list of states or a batch of records with one state each that needs to be counted or something else entirely. I'm also not sure where the counts are meant to end up.

Could you clarify what you need to do? Perhaps you could upload your db/dat to somewhere where we could actually see it, as a point of reference?
  

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


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #8 - May 13th, 2004 at 8:41pm
Print Post Print Post  
If you give me an e-mail address, I can send you the .dsr/.dat files as an attachment.  Thanks.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Counting fields with Sesame
Reply #9 - May 13th, 2004 at 9:26pm
Print Post Print Post  
Send them to support@lantica.com marked to my attention.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Counting fields with Sesame
Reply #10 - May 16th, 2004 at 2:34pm
Print Post Print Post  
Quote:
1. In the .dsr file: New Database->Forms->Redesign a form->New
database->Main report card.  On the "violations" sub form, "violation code" layout element, I will import data into this field, and the codes will be according to the "summary" sub form and  the "CIN," "CKL," etc. layout elements.  With each succeeding record, I want the "CIN" layout element to count each "CIN" from "violation code" from the retrieved records.   I think a loop is what I need.


Okay, I think I see what you are trying to do here. Each record has a single violation code on the Violations tab. The Summary Tab is meant to contain a running total from all "previous" records. Is this right?

If so, the problem is with the concept of "previous". Databases store records in a randomized order. Just because a record is "before" another does not mean it always will be. You can resort your records at will, thus blowing your running totals. This is the kind of information that should be generated on the fly, as needed, using a Report or a Mass Update. Would you like an example of this? 

If so, do you want it to print to a printer or display on screen?
These report cards appear to summarize violations by state. Is this correct?

Quote:
2.  In the .dsr file: New Database->Forms->Redesign a form->New
database->Main form.  This is just a bunch of command buttons.  Using the "by cost" command button, I want that button to retrieve the records from the "main report card" database according to the "enter beginning date" and
"enter ending date" and put the information into New
Database->Reports->Redesign a report->New database->By cost.  I cannot figure out how to do this.  How do I do that?

The Inside Sesame article I mentioned has examples of doing exactly this. See the example of using GlobalValue. Also see the example of using date ranges for how to set the date element in the Retrieve Spec.
  

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


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #11 - May 17th, 2004 at 3:41pm
Print Post Print Post  
Okay, I think I see what you are trying to do here. Each record has a single violation code on the Violations tab. The Summary Tab is meant to contain a running total from all "previous" records. Is this right?

This is correct.


If so, the problem is with the concept of "previous". Databases store records in a randomized order. Just because a record is "before" another does not mean it always will be. You can resort your records at will, thus blowing your running totals. This is the kind of information that should be generated on the fly, as needed, using a Report or a Mass Update. Would you like an example of this?   

I don't need a running total--just the total for the "search results retrieve."  That number will change according to the date range that I want.  An example of this would be wonderful.


If so, do you want it to print to a printer or display on screen?
These report cards appear to summarize violations by state. Is this correct?

This, too, is correct.  Thanks for 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: Counting fields with Sesame
Reply #12 - May 17th, 2004 at 6:50pm
Print Post Print Post  
Blightman,

I was trying to make you an example, but I can't find any field on your Form that shows the State. I can't summarize by State without a State value. In addition, most of your sample records are empty of everything but a code. Those that are filled in reference Santiago, Chile and Nowheresville, USA. I'm going to need some guidance regarding what I'm meant to be summarizing by.

Actually, at closer look, you talk about the Violations subform, which does exist, but your Main Report Card form does not display this subform. Instead, it has it's own separate set of Violations elements. You appear to have many of your fields and elements repeated three times in various databases.

This is just a suggestion, but I think you may need to finalize and clarify your design before we worry about these programming routines.
  

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


No personal text

Posts: 17
Location: D.C. person living in Utah
Joined: May 12th, 2004
Re: Counting fields with Sesame
Reply #13 - May 18th, 2004 at 1:43pm
Print Post Print Post  
Let me clarify a few things.  "I can't find any field on your Form that shows the State. I can't summarize by State without a State value." 

There really isn't a state value on the .dsr form that I sent you.  That was just an example that I used when I first wrote my question here in the forum because I felt that by discussing this as a state and state value would make it easier for others to understand.  The "Santiago Chile" and "Nowheresville USA" were just test files to make sure that the database would work properly.  They will be deleted once all the problems are worked out.  I haven't imported all the files into the database.  I can delete those, import the files that I will really use, and then send them over to you so that you can manipulate them, if you would like.


"Actually, at closer look, you talk about the Violations subform, which does exist, but your Main Report Card form does not display this subform. Instead, it has it's own separate set of Violations elements."

I think I wrote the wrong terms here.  "Violations subform" should be "violations tab."  "Summary subform" should be "summary tab."  Both of these are on the "main report card" database.  I want the "violation code" layout element to be the determining factor on the "summary" tab.  The "CIN," "CKL," etc. layout elements will count the matching "violation code."  That might clear up some confusion. 


"You appear to have many of your fields and elements repeated three times in various databases."

I have these fields in other databases because when I was first learning the program, I built some databases that I thought I would use.  As time went on, I decided that it would be easier to put everything in one database ("main report card").  Once I figure out everything, I will delete all the databases in "NewDatabase0" and "Samples."

Thanks again.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Counting fields with Sesame
Reply #14 - May 18th, 2004 at 2:27pm
Print Post Print Post  
Quote:
There really isn't a state value on the .dsr form that I sent you.  That was just an example that I used when I first wrote my question here in the forum because I felt that by discussing this as a state and state value would make it easier for others to understand.  The "Santiago Chile" and "Nowheresville USA" were just test files to make sure that the database would work properly.  They will be deleted once all the problems are worked out.  I haven't imported all the files into the database.  I can delete those, import the files that I will really use, and then send them over to you so that you can manipulate them, if you would like.


Having real data to work with will be very helpful, both in terms of producing the examples, and also in terms of you understanding what was done.  Smiley
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print