Alpha Video Training
Results 1 to 6 of 6

Thread: question

  1. #1
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,960

    Default question

    the scenario is I have three tables

    makes 1 field (Ford, Chrevrolet, etc)
    models 2 fields, make and model
    make = Ford, model = F150, etc
    make = Chevrolet, model = Impala, etc
    tickets 2 relevant fields - make and model
    make is a table lookup to the makes table
    model is a lookup to the models table

    both are setup as dropdowns, force closest match, user may add items

    model has the filter make=tickets->make
    this works perfectly
    but
    trying to figure how how to force a model added to be for the currently selected make

    ie - in tickets you add a ticket, get to makes, select ford, but when you get to model, you need to add a new model and want the model to be forced to use the make Ford

    hmmmmmmmmm - may have just thought of a way: 1. use a custom form for adding models 2. [adding records] in field rules, at the onwritefield event for makes, set the value to a global variable; and at the caneditrecord [editing] event get the value in the same variable and put that variable in the custom form for adding.

    will try - let u know


    IT WORKS!!!!
    Last edited by martinwcole; 12-11-2009 at 05:01 PM.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  2. #2
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,032

    Default Re: question

    Martin,

    If it helps, I have a lookup table based on the first 8 digits of the vin#. Would it help you? I also wrote a script somewhere that makes sure it gets updated with anything new. Also a script where the tables is searched for things like chev and changes it to chevrolet.

    Would these help you?


    .
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  3. #3
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,960

    Default Re: question

    sure - glad to have - another field is the Vin, which might fill in all of them.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  4. #4
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,032

    Default Re: question

    I sent you an email


    .
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  5. #5
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,487

    Default Re: question

    For anyone searching and landing on this thread, here is an Xdialog box that adds the model to the make.

    'Date Created: 22-Jun-2008 09:24:50 AM
    'Last Updated: 28-Oct-2008 06:11:32 PM
    'Created By : Barry Rochford
    'Updated By : User
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED vc_make as C="Acura"
    DIM SHARED vc_model as C
    DIM SHARED varC_result as C
    DIM SHARED vc_other_model as c=""
    auto_list_vc_make = table.external_record_content_get("veh_lookup","Make","Make",".t. .and. unique_key_value()")

    temp_count = w_count(auto_list_vc_make,crlf())
    DELETE a_vc_make
    DIM a_vc_make[temp_count] as c
    a_vc_make.initialize(auto_list_vc_make)

    auto_list_vc_model = table.external_record_content_get("veh_lookup","Model","Model","make='"+vc_make+"'")

    'temp_count = w_count(auto_list_vc_model,crlf())
    DELETE a_vc_model
    DIM a_vc_model[50] as c
    a_vc_model.initialize(auto_list_vc_model)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Make and Model Selector",<<%dlg%
    {region}
    {watch=vc_make!changed}
    Select Make here:| [.20,25vc_make^#a_vc_make]|{sp=1}|Select Model here:| [.20,25vc_model^#a_vc_model];
    {endregion};
    {region}
    {sp=35}Or type unlisted model here: [.20vc_other_model]
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    if a_dlg_button="changed" then
    a_dlg_button=""
    a_vc_model.clear()
    auto_list_vc_model = table.external_record_content_get("veh_lookup","Model","model","make='"+vc_make+"'")
    a_vc_model.initialize(auto_list_vc_model)
    end if
    %code%)
    if varC_result<>"ok" then
    cancel()
    end
    end if
    if vc_model="Any"
    vc_model=""
    end if
    if varC_result<>"OK" then
    vc_make=""
    vc_model=""
    end if
    if vc_other_model<>"" then
    t=table.open("veh_lookup")
    t.enter_begin()
    t.make=vc_make
    t.model=vc_other_model
    t.enter_end()
    end if
    It is built on a table called veh_lookup, with the following structure:
    Make Character 23 0
    Model Character 23 0
    If you want a copy of the table I have, write me. It is part of an auto appraisal program I have.
    Jay
    Jay Talbott
    Lexington, KY


  6. #6
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,960

    Default Re: question

    love to have the table
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

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
  •