Alpha Video Training
Results 1 to 9 of 9

Thread: Count/total number of records for userid

  1. #1
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Count/total number of records for userid

    I found a similar post to this but I hope to place the calculated equation in my field rules table.

    My Table (users)

    Userid _____Count___Total
    Flyboy --------1-------3
    Sarass --------1-------4
    Flyboy -------1-------3
    Flyboy -------1-------3
    Sarass -------1-------4
    Sarass -------1-------4
    Grower --------1-------2
    Grower -------1--------2
    Sarass --------1-------4

    My count field has the calculated IF(USERID>"1",1,0). This works fine.
    My total field is where I’m in a quandary.
    I hope to look at the userid and for each occurrence of the userid, add 1 from the Count field.
    Number of times the userid is currently in the table

    Flyboy = 3
    Sarass = 4
    Grower = 2
    Last edited by EricN; 01-20-2008 at 06:44 PM.
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

  2. #2
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Re: Count/total number of records for userid

    Ok, how about this…
    Employers post their jobs on the “posts” table
    Employers registration information in the “users” table

    I want to set a limit (5) on the number of jobs the employer can have posted at any given time.

    In the users table, I have a field called “post_limits” currently set to numeric. When the employer registers, the employer starts out with the number 5 in this field.

    In the posts table, I have a field called, “ad_count” currently set to numeric with a 1 in the field for the ad.

    I would like to be able to subtract a 1 from the post_limits field each time the employer adds a job AND to be able to stop the employer from posting any jobs if the post_limits is 0.

    Spent today researching this but could not find any viable solutions.
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

  3. #3
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,635

    Default Re: Count/total number of records for userid

    Eric,

    I have a membership application, and we have been providing job postings for about 6 months from employers that may interest our members. Here's what we do:

    We have a logical field in the job table named "active", and in order for any job to display, it has to be true.

    So, as employers enter their jobs (we use an on line html editor so they enter them themselves) we send an automatic email to the placement chair. He reviews the job and checks the "active" checkbox if it is appropriate, follows up on missing information, and deletes the "genuine Rolex" watch ads.

    Active jobs appear in the job listing until the expiration date. We set that initially to 30 days, but allow the employer to extend it if necessary. Any change triggers another email.

    We get a count of the total number of jobs and total active jobs for each employer by using dbcount() and display that on the welcome screen as they log in.

    By the way, we also use a character prefix on the id code for the employers of "E" and for applicants of "A". That way it is a simple matter after login to check the first character of ulink and route them to the proper pages.

    Good luck,

    Pat

  4. #4
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Re: Count/total number of records for userid

    Pat
    Thank you for your response. Many jobs are posted daily and so I want to have this process automatic without any intervention from me.

    I'm looking at the posting method and calculated field rules. Also looking at the events area of a grid.

    In the desktop, I probably would be using the lookup() method in calculated fields somehow. Posting in desktop field rules does not work, correct?

    Thanks
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

  5. #5
    Member
    Real Name
    Doug Page
    Join Date
    Jan 2002
    Location
    Vancouver, BC Canada
    Posts
    963

    Default Re: Count/total number of records for userid

    Eric,

    I think Pat was trying to give you the hint of using the dbcount() function. That will very quickly give you the number of items in a table based on your specs so that it then just a matter of a simple "if" statement to redirect if more than 5.

    http://support.alphasoftware.com/alp.../DBCOUNT().htm

  6. #6
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Re: Count/total number of records for userid

    Thanks Doug and Pat
    I will look at dbcount(). Where would I put this if used?

    In the grid? Where in the grid?
    Field rules on desktop level?

    Thanks
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

  7. #7
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Re: Count/total number of records for userid

    I also want the flexibility of allowing a particular client to post more jobs than others when I wish. (Change the posting limits for individual clients). So I'm thinking this count or total would have to be stored in a field and modified (Posted?) from the grid.

    Just stuck on this.
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

  8. #8
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,635

    Default Re: Count/total number of records for userid

    Eric

    I would put the dbcount() in a page between the login and the entry/edit grid. That way, if they have reached their limit, I could redirect them to a page to pay an additional fee to post more jobs or give them the option to delete (inactivate) some jobs that have been filled to make room for additional jobs. I would also have dbcount in a "thank you for posting" page which they would go to after each post. If they have three jobs to post and have already posted 4, then you need to check the count after each entry.

    I would put the job limit in the employer record and look it up in the page after login where you gather all the other employer information from their record. That limit would only have to change if they pay for more jobs (or you give them more) or if their check bounces.

    Pat

  9. #9
    Member EricN's Avatar
    Real Name
    Eric
    Join Date
    May 2007
    Location
    Minnesota
    Posts
    553

    Default Re: Count/total number of records for userid

    I was beginning to place code in the beforeinsertrecord event area of the post jobs grid. Where it would check the number balance in the Ads_allowed field in the users database and if the Ads_allowed is still in the positive, user is allowed to post another jobs and at the same time, subtract 1 from the Ads_allowed field.

    If ads_allowed is 0, then the Result.cancel = .t.
    Eric

    Alpha Five Websites
    longlivepuppies.com
    socialservicenetwork.com
    -------------------------------------------------
    socialservicenetwork.org

Similar Threads

  1. How to : Count number of records in browse?
    By georgefurnel in forum Alpha Five Version 8
    Replies: 7
    Last Post: 11-09-2011, 10:33 AM
  2. How to count number of records
    By randbo in forum Alpha Five Version 8
    Replies: 3
    Last Post: 12-18-2007, 05:55 PM
  3. Count Values in Two Fields and Display Total on A5W Page
    By den1s in forum Application Server Version 8
    Replies: 6
    Last Post: 05-05-2007, 09:25 PM
  4. Report Running Total Page Count
    By Barbara Dansby in forum Alpha Five Versions 2 and 3
    Replies: 5
    Last Post: 03-15-2002, 05:55 PM
  5. grand total of count difficulty
    By martinwcole in forum Alpha Five Version 4
    Replies: 2
    Last Post: 07-08-2000, 04:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •