Alpha Video Training
Results 1 to 6 of 6

Thread: Problem with "Displaying a Selected Record in a Dialog"

  1. #1
    Member eduran582's Avatar
    Real Name
    Eric Duran
    Join Date
    Jun 2006

    Default Problem with "Displaying a Selected Record in a Dialog"

    Because of the current inability to change a field based on another fields drop-down selection in a grid component (see previous thread "Filtering drop-down from prior selection"), I resorted to using a dialog component that now allows this feature. However, I'm having a problem linking the selected record from the grid to the dialog.

    I followed the help file instruction ("Passing a Record From a Grid to a Dialog") and everytime I select the record from the grid, it stops at the transition.a5w page and I get the following error:

    "...500 Internal Server Error
    Script Error
    Error:line:9 Missing or invalid keyword

    Alpha Five/7.0 Build/4076-3031 at ..."

    The grid page is "user_accounts.a5w"
    The grid component is grid component is "user_list"
    The "key" field is "Logon_Id" which is also in the "results" a5w page (user_update.a5w).
    The "link properties" in the "Logon_Id" field in the grid has "Computed from fields in the Grid" selected in the "Link address type" and the "Link Address" is as follows: "transition.a5w?logon_id={Logon_Id}" (without the quotes).

    The transition page is "transition.a5w" that contains the following code (right from the help file with appropriate variable changes):

    if (eval_valid("Logon_Id") = .F.) then
    end if
    dim t as P
    dim url as C
    t ="login")
    url = "user_update.a5w?logon_id="+alltrim(t.Logon_id)+"&name="+alltrim(t.Name)+"&fname="+alltrim(t.Fname)+"&lname="+alltrim(t.Lname)

    Not being familiar with XBasic (long time Delphi programmer), I'm not sure if the error is pointing to the line: t.fetch_find(logon_id) or the line prior or after. I tried using quotes (t.fetch_find("logon_id")) but it made no difference.

    I might mention, at this point, that I also tried using the help file "Displaying a Selected Record in a Dialog" instruction but the result page would always return the first field even though the URL showed the correct "key" variable. If anyone wants more detail on THAT issue, just ask =)

    I've tried to explain the problem as best I could but probably missed something somewhere. Any help in this issue would be GREATLY appreciated!

    Thanks, Edward, for the info on version 8 release and thanks to everyone for reading this long post!
    Last edited by eduran582; 06-20-2006 at 12:34 PM.

  2. #2
    Real Name
    Martin Horzempa
    Join Date
    Oct 2005


    hi Eric

    i think that you need to get a pointer to an index or query


    in the help file

    dim tbl_product as P
    dim indx_1 as P
    tbl_product ="c:\data\product.dbf")
    indx_1 = tbl_product.index_primary_put("id_index")

    like this before you do your fetch_find


  3. #3
    Member eduran582's Avatar
    Real Name
    Eric Duran
    Join Date
    Jun 2006


    Thanks, Martin, for the info on the "pointer" and the link to the related help section. I tried what you (and the help) suggested but was met with the same syntax error.

    I think I'm going to abandon this line of "linking" and see what I can come up with (another post) using "Displaying a Record in a Dialog". It does not need the intermediate page (transition.a5w, I used in this case) and if you have a large number of fields would probably make the URL generated too long. The "Displaying a record..." method is simpler and I can always use the "lookup" feature and "AfterUpdateRecords" Event to minipulate any fields that have to be adjusted using XBasic (I think) before saving the record.

    Thanks again for your help!

  4. #4
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    United Kingdom



    I am at the same point as you and need to establish a method to incorporate cascading dropdowns in a dialog and pass this information to a table. If/When you manage to find a solution, could you please post it.

    Thanks in advance.


  5. #5
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Oregon, USA


    One idea to go from the grid to the dialog would be to set a session variable in the link and then set the value of the dropdown equal to the session variable.

    So, for example, you have a grid that contains a field "user_id" and you want to go to a dialog that has a dropdown of user_Id's, and you want the one you linked from to show as selected. Name the dropdown box in the dialog as vUser_Id.

    So, the link would be


    Now, in the initialize event for the dialog, set the value equal to the session variable.

    If eval_valid("session.User_Id")=.t.
    end if

    So, now if you go to the dialog box page and there is no session.User_Id set, you will see all the dropdown choices, but if the session variable is set, that one will be selected.


  6. #6
    Member eduran582's Avatar
    Real Name
    Eric Duran
    Join Date
    Jun 2006


    Hi, Pat
    Thanks for the suggestion. However, if I have the same User_Id in several records (in my case it's "Access") the link would probably give me the first instance it finds. The uniqe field in my case is the Logon_Id and the field I would be changing, using a drop-down, would be Access which is actually one of a couple that would be changed.

    Here's what I've got:
    I have a grid with several fields and want to be able to select one of them and go to another dialog, grid, or whatever that will allow me to change certain fields based on a multi-selection component (drop-down). The result of that change would also change other fields based on the selection.

    Here's my far (incomplete):
    I've resorted to using the [simple] grid with Detail View and in the fields I want to change, I'm now using "lookup". I can select the desired value from the grid that is presented by clicking on the lookup and insert it into the field I want to change. This seems to work well as the resulting selection is replaced when I save the record.

    Now to part 2 of my problem:
    I am having a time trying to figure out how to take this changed selection (or any field for that matter) and based on it's value, change another field. Most of my problem lies in me learning XBasic, it seems, as some of the functions seem similar to another language I've used for years (Delphi). Not only am I having issues with the syntax but also what seems like something simple: WHERE to put the code?

    Example: The field with the lookup is called "Access" with the variable "accessw" which is a character field ("LINE STAFF", "SUPERVISOR") and the values from the lookup are located in a db which also lists the appropriate access_level (numeric: 1, 3). What I want to do when "Submit" is pressed is to be able change the access_level value based on the accessw value before the record is saved. I've found a function I think might work but cannot figure out how or where to put it or even if the syntax is correct:
    access_level=case(accessw="LINE STAFF",1,accessw="SUPERVISOR",3)

    A simpler version would be where the grid contains a LastName and FirstName field and you want to save it to another field called FullName where (I suppose) you could use:
    FullName=alltrim(Lastname)+", "+alltrim(FirstName)

    Either way I still need help in the syntax and where to put it. ANY help to get me on the right track will be appreciated!

    Oh, and Denis you can bet I'll post whatever solution I find. I don't know if you saw that version 8 is suppose to have the drop-down selection feature available in the grid component. But until then, I've got to find a solution for the current version.


Similar Threads

  1. Replies: 19
    Last Post: 06-07-2006, 08:39 AM
  2. Replies: 5
    Last Post: 05-20-2006, 07:01 PM
  3. Duplicating a "Parent" record complete with "Children"
    By Peterg in forum Alpha Five Version 7
    Replies: 4
    Last Post: 02-23-2006, 10:40 AM
  4. Is there a way to "mark", "selected
    By Stephen Katz in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-15-2003, 07:22 AM
  5. Displaying "Please wait" during sys_shel
    By Jeff Fried in forum Alpha Five Version 5
    Replies: 12
    Last Post: 01-04-2003, 12:57 PM


Posting Permissions

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