Alpha Video Training
Results 1 to 12 of 12

Thread: Run command after pressing submit

  1. #1
    Member
    Real Name
    Robert Neil
    Join Date
    Nov 2008
    Posts
    41

    Default Run command after pressing submit

    I have created a dialog component with a few fields which feeds a table built to track inspections. I also have a child table used to track the inspection findings. I need to be able to open a page containing the child table once I submit the main parent dialog component.

    I have tried using a link field and it does work as long as I press the submit button prior to pressing the link. If I press submit (without a redirect) and than the link, everything works fine. My parent table is assigned an ID and that ID is feed to the child once the link is pressed.

    However, when I include the link url in a redirect statement in the aftervalidate event, my parent table recieves the correct ID data but my child table is assigned a value consisting of the child tables name.

    Is there any way to have a statement placed in the aftervalidate that will trigger the link control?

    Thanks.

  2. #2
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,841

    Default Re: Run command after pressing submit

    I think it would help explain your situation if you posted the code from your AfterValidate event.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

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

    Default Re: Run command after pressing submit

    Hello
    This is what I have in the bottom of my dialog's AfterValidate that brings me to a grid in another table once I press my dialog's submit button.

    CurrentForm.RedirectTarget = "Em_Reg.a5w?Userid=CurrentForm.controls.userid.value"
    Eric

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

  4. #4
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,841

    Default Re: Run command after pressing submit

    Eric,

    Do you mean:

    CurrentForm.RedirectTarget = "Em_Reg.a5w?Userid=" + CurrentForm.controls.userid.value
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

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

    Default Re: Run command after pressing submit

    Hmmm, you are probably correct Steve. The method I suggested does also work (for me) but you are probably correct.
    Eric

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

  6. #6
    Member
    Real Name
    Robert Neil
    Join Date
    Nov 2008
    Posts
    41

    Default Re: Run command after pressing submit

    Thanks for the help guys but it that hasn't solved it.

    Here goes:

    My safetyround (Dialog) component has 4 fields:

    Tour_id (Textbox - 20 Character)
    Dept_id (Dropdownbox)
    Tour_type (Dropdownbox)
    Tour_date (Textbox - Date)

    I have an initialize event of:

    CurrentForm.Controls.Tour_id.value = ctime(now() )

    I am using this value as my *unique* id for the Tour_id

    I have an aftervalidate event of:

    t = table.open("[pathalias.adb_path]\safetyrounds")
    t.enter_begin()
    t.Tour_id=(CurrentForm.Controls.Tour_id.value)
    t.Dept_id=alltrim(CurrentForm.Controls.Dept_id.value)
    t.Tour_type=alltrim(CurrentForm.Controls.Tour_type.value)
    t.Tour_date=convert_type(CurrentForm.Controls.Tour_date.value, "d")
    t.enter_end()
    t.close()

    CurrentForm.RedirectTarget = "newsafetyrounddetails.a5w?Tour_id=" + CurrentForm.Controls.Tour_id.value

    **************

    The newsafetyrounddetails.a5w page contains a component named safetyroundfindings.

    My safetyroundfindings (Grid) component has 3 fields:

    Tourd_id (Textbox - 6 Character)
    Tour_id (Textbox - 20 Character)
    Tourd_finding (Textbox - 150 Character)


    ***************

    So, when I press submit on the parent (safetyround), all information, including my Tour_id value generated with my initalize event is entered in to it's associated table and I am than redirected to my newsafetyrounddetails.a5w page containing the safetyroundfindings component. None of the fields, including Tour_id are populated. When I press submit, the data entered in to the Tourd_finding field is transfered but the Tour_id field is empty.

    One more thing, both components are set to "Add only".

    Thanks in advance for offering your assistance.

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

    Default Re: Run command after pressing submit

    When you say "add only" for your grid, do you mean, "add records only?" If yes, then anytime you access this grid you will have empty fields. It is set up to think you want to create another record.

    If your goal is to initially enter data into your dialog then click submit and go to this grid and see the data you just entered (and already saved in your table) then in your grid's properties, un-check add records only. If you wish to add additional information into this grid...in update settings, check "allow insert"
    Last edited by EricN; 12-03-2008 at 05:15 PM.
    Eric

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

  8. #8
    Member
    Real Name
    Robert Neil
    Join Date
    Nov 2008
    Posts
    41

    Default Re: Run command after pressing submit

    My goal is to first create a new safety round event using the first component(safetyround). I than would like to be redirected to the safetyrounddetails component where I can add the details for the safety round event I just created. The two are linked via the Tour_id field.

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

    Default Re: Run command after pressing submit

    Ok. It looks like I'm correctly understanding what you hope to accomplish and what I just described above (#7) should help.

    This is very similar to what I do in my app.
    Eric

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

  10. #10
    Member
    Real Name
    Robert Neil
    Join Date
    Nov 2008
    Posts
    41

    Default Re: Run command after pressing submit

    Thanks for your help Eric but I don't want to waste your time with my problem.

    I have tried what you have suggested but is still does not work.

    You see, when I press submit on the first component (safetyround), it only adds a record in the parent table (safetyround), including the Tour_id number generated in my initialize event. No records, associated with this new event, have been added yet in the child table (safetyroundfindings). Therefore, there is nothing yet linking the two tables.

    What I am trying to do is to add a new record in to the child table (safetyroundfindings) and have the Tour_id value (generated by my initailize event and recorded in the parent table) autotomatically entered in to the Tour_id field on the child table (safetyroundfindings) thereby creating my parent to child link.

    As I said above, I really do appreciate the help but please don't feel obligated to conitue to spend time on this issue.

    Thanks again.

  11. #11
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,841

    Default Re: Run command after pressing submit

    You can never pre-populate a "blank" record in a GRID. Your safetyroundfindings needs to be a Dialog unless you actually create the safetyroundfindings record in the previous process and then open that record in a grid via a filter.

    Once you switch to a dialog, Eric's good advice about Add Only will no longer apply. Add this to your safetyroundfindings Activate Event:

    CurrentForm.Controls.Tour_id.value = Tour_id

    Tour_id will be a Page Variable and available to the dialog.

    Also, keep your component names less than 15 characters else you may get some conflicts down the road.

    And don't worry about how much effort others put in to your problems. That is the way everyone learns how to best use the product. Eric's rise as a developer is a perfect example.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  12. #12
    Member
    Real Name
    Robert Neil
    Join Date
    Nov 2008
    Posts
    41

    Default Re: Run command after pressing submit

    Hi Steve,

    Fortunately, I learn from my mistakes, and after four or five hours of trying to pre-populate a grid I finally figured out that it doesn't work. It is safe to say that I will never try to do that again. I do prefer to use dialog components anyhow where possible.

    The component now works like a charm...Yes!...AND, I learned a lot in the process. I will take your words to heart regarding others efforts and I promise to pay back some other newbie down the road.

    I do have an extensive background in MS Access and I use to have a good handle on VB. It is starting to come back to me a bit.

    BTW, I have now modified all of my tables, fields and component names to be 15 characters or under. Thanks.

    Rob

Similar Threads

  1. Need Help Configuring a Button to run External Program with special command line.
    By jimmyhd in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 10-03-2008, 05:30 PM
  2. Run-Time / Control-Set Focus Command
    By Rudy16 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 17
    Last Post: 04-14-2008, 10:06 PM
  3. A5 ver 6 crash on Script run command
    By kgilroy in forum Alpha Five Version 6
    Replies: 19
    Last Post: 04-18-2006, 11:55 AM
  4. Windows Run command
    By George Corder in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-30-2004, 04:00 PM
  5. How to run reports from command line
    By brett s in forum Alpha Five Version 5
    Replies: 7
    Last Post: 02-25-2003, 12:39 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
  •