Alpha Video Training
Results 1 to 4 of 4

Thread: using autoincrement for subfolders

  1. #1
    Member
    Real Name
    Ms Morgan
    Join Date
    Mar 2008
    Posts
    5

    Default using autoincrement for subfolders

    I'm setting up a database to track grants for a grantmaking organization. The primary table is the organization (grant recipient) table. There can be multiple grants made to the same organization. Each grant has a separate grant record, which is a child of the organization record.

    I'm assuming if I simply set up the grant number field in the grant record as an autoincrement field, each grant will be numbered relative to the last grant that was entered for any organization, in essence giving me a chronological numbering of all grants as a single group, is that correct?

    What I'd like instead is for grant records to autonumber PER ORGANIZATION. However, I'd still like each grant number to be unique, so that a record for grant "1" is distinct (since any organization that ever received a grant will have a grant "1"). One idea I had about this was to prefix the autoincrementing number with an acronym for the organization, so the first grant to the Pacific Humane Society would be PHS001. The acronym for each organization would have to be unique, of course, but I could set that up as a user-entered field in the Organization table.

    Assuming it's possible to use autoincrement in this way, how would I set it up?

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: using autoincrement for subfolders

    Assuming it's possible to use autoincrement in this way, how would I set it up?
    It's not. Autoincrement is autoincrement. You start with a "seed value" and increment it.

    You can define your own rules to populate the linking field.

  3. #3
    Member Lee Bjornson's Avatar
    Real Name
    Lee Bjornson
    Join Date
    Jul 2000
    Location
    Escondido, CA
    Posts
    23

    Default Re: using autoincrement for subfolders

    Stan's right, Ms. Morgan. The table containing your grants will increment the next added record, no matter which Organization is its parent, to the next highest value.

    You would need to create a table that tracked each Organization in a single record, and kept the last used Grant # in a field. Then, for a new Grant, you could read that #, increment it by 1, use the new # for the Grant, and write the new # back to the "tracking" table.

    Another option would be to track the Grant # in the Organization table: set up the fields / tables to use the Posting field rule - it really just does the above sequence.

    One last option - on the Form you use to ADD a new Grant (with the Organization as the Parent in a set), display a browse that shows all of the Grants & their number; then have the user manually enter the new Grant number.
    Lee Bjornson
    EnabledMicrosystems.com
    760-735-9520 (10a - 9p Pacific)

  4. #4
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: using autoincrement for subfolders

    Hi Ms Morgan,

    Here is some code I have on a button to fill a field in a browse that duplicates the value from the previous record. It should be very easy to add 1 for the new value. This was all done with Action Script.

    The other idea is Row Numbers, I'm sure there is some items on this forum for that.

    'Go to previous record in current form at Browse2 level.
    topparent:Browse1.fetch_prev()

    'Get 'Value' property of 'Browse1:Supplier' in Form 'Order' .
    DIM SHARED V_supp AS c
    V_supp = parentform:Browse1:Supplier.value

    'Create a new variable called 'v_Supp_Id' and set its value to '=Order_Items->Supp_Id
    dim Shared v_Supp_Id AS C
    v_Supp_Id = convert_type(a5_eval_expression("=Order_Items->Supp_Id",local_variables()),"C")

    'Go to next record in current form at Browse1 level.
    topparent:Browse1.fetch_next()

    'Set 'Value' property of 'Browse1:Supplier' in Form 'Order' .
    parentform:Supp_id.value = v_Supp_Id
    parentform:Browse1:Supplier.value = V_supp

    'Activate object 'BROWSE1: Description' in current form.
    topparent:BROWSE1:Unit_price.activate()
    Here is link for Row Numbers

    Hope you can see the wood but for the trees.
    Last edited by Keith Hubert; 03-03-2009 at 02:23 AM.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

Similar Threads

  1. Web Security and Subfolders
    By Nathan Zeiset in forum Application Server Version 8
    Replies: 9
    Last Post: 06-02-2008, 02:03 PM
  2. Web components in subfolders
    By Nathan Zeiset in forum Application Server Version 8
    Replies: 2
    Last Post: 08-03-2007, 11:00 AM
  3. Importing Outlook Inbox SubFolders
    By acant05 in forum Alpha Five Version 5
    Replies: 5
    Last Post: 11-18-2005, 01:44 AM
  4. Runtime and Subfolders
    By Sandy Garrett in forum Alpha Five Version 6
    Replies: 0
    Last Post: 07-04-2005, 12:45 PM
  5. Subfolders and Network Optimize
    By mark buonagurio in forum Alpha Five Version 5
    Replies: 4
    Last Post: 04-08-2004, 05:46 AM

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
  •