Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Xdialog box used to search for last name in database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Xdialog box used to search for last name in database

    Hello everyone,

    I try and search the forum as much as I can being new...but I am stuck. I am trying to make an Xdialog box (last name search of database) that prompts for parameters and then goes to a specified record on the parent form.

    I followed the step by step instructions in an Intellectual Business book on Alpha Five V9. I think it is something wrong with my conditional If statement...but I might be wrong. I am new to coding and Alpha Five.

    I am getting the following error message:

    Script: OnPush line: 50
    top.parentrecno_goto(var_recno_target)
    Record number is past the end of table


    Here is my code:

    'Create an XDialog dialog box to prompt for parameters.
    'In order to evaluate expressions using the eval() function, in the context of
    'the current form, the "form_name" variable is defined.
    DIM form_name as C
    if is_object(topparent.this) then
    form_name = topparent.name()+".this"
    else
    form_name = ""
    end if
    DIM SHARED vTypeInName as C
    DIM SHARED vSelectName as C
    DIM SHARED varC_result as C
    DELETE expression_result
    expression_result = eval("\"\"",form_name)
    vTypeInName = convert_type(expression_result,"C")
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    DIM vSelectName_rl_def_orig as C
    vSelectName_rl_def_orig = "kl=customer,{keylist_build(\"H=.05,1:25[Last_Name],2:25[First_Name]\",''+recno(),left(''+Last_name,25),left(''+First_name,25))}{[varC->vTypeInName] $ Last_name}"
    DIM vSelectName_rl_def as C
    vSelectName_rl_def = replace_parameters(vSelectName_rl_def_orig,local_variables())
    varC_result = ui_dlg_box("Q Formula - Customer Search",<<%dlg%
    {region}
    Type in customer last name here:| [.25vTypeInName!vTypeInName_changed];
    Search Results:| [%@vSelectName_rl_def%.40,5vSelectName];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    If a_dlg_button = "vTypeInName_changed" then
    vSelectName_rl_def = replace_parameters(vSelectName_rl_def_orig,local_variables())
    a_dlg_button = ""
    end if
    %code%)

    'Conditional code follows. Executes only if the condition expression is True.
    IF a5_eval_expression("=Var->varC_result=\"OK\"") THEN
    'Go to a specified record number in current form at parent level.
    DIM var_recno_target as N
    var_recno_target = val(varC_result)
    topparent.recno_goto(var_recno_target)

    END IF

    'End the current script
    END

    Thank you for any and all suggestions!

    Paul

    #2
    Re: Xdialog box used to search for last name in database

    In your xdialog I'm not sure what you want to do with "Search Results". Anyway, the code at the end of your routine...

    varC_result is the button result from the xdialog - OK or Cancel... and then you're trying to go to that record - where OK = 0... so... that doesn't look right and you're getting an error. Topparent.recno_goto is going after a record number.

    If you're just trying to type in a name and get to that record try this:


    'Conditional code follows. Executes only if the condition expression is True.
    IF a5_eval_expression("=Var->varC_result=\"OK\"") THEN
    'Go to a specified record number in current form at parent level.
    ' DIM var_recno_target as N
    ' var_recno_target = val(varC_result)
    ' topparent.recno_goto(var_recno_target)
    parentform.index_set("your index name goes here")
    parentform.find(var->vTypeInName)

    You may need to create an index for the field you're going after.

    Comment


      #3
      Re: Xdialog box used to search for last name in database

      I think David is on the right track but I see it a bit different.

      In the following code
      Code:
      DIM var_recno_target as N
      var_recno_target = val(varC_result)
      topparent.recno_goto(var_recno_target)
      varC_result is equal to "OK". First off, you cannot make an alpha character into a number and believe this is why it is failing---if a variable in the xdialog equals a record number then this is what is needed for the argument in the .recno_goto().

      Or maybe it's late and just reading it incorrectly! :)


      LATER: Guess I am just too much of a hands on person as I cannot even get values for the various variables in the xdialog. If a sample is presented so that this is in context I will try again....others may very well not need it.
      Last edited by MikeC; 04-05-2009, 12:42 AM.
      Mike
      __________________________________________
      It is only when we forget all our learning that we begin to know.
      It's not what you look at that matters, it's what you see.
      Henry David Thoreau
      __________________________________________



      Comment


        #4
        Re: Xdialog box used to search for last name in database

        Mike,
        The code presented in the original post can be made to work in a button placed on the customer form in Alphasports. Change the field names in the keylist_build() function by removing the underscores to match them to the Alphasports names.

        The value returned in vSelectName is a character equivalent of recno() as specified in the keylist_build function.

        Paul,
        The conditional code is fine and so is the recno_goto code except as has been pointed the wrong variable has been used in the val() function. As David said the VarC_result returns the last action/event from the dialog box (which technically is the value contained in the system variable a_dlg_button) That is why it is used in the If conditional to check for 'OK'.

        The variable you want to use there instead is vSelectName as this holds the character version of the recno you want.

        This code looks like the code generated by Action Scripting. If you still have the script as an action script then just select the correct variable in the goto record number action.

        The reason for the error code is that you were most likely passing a value of 0 to the recno_goto() function.

        Mike,
        So yes it may have been late but you were definately reading correctly :)
        Tim Kiebert
        Eagle Creek Citrus
        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

        Comment


          #5
          Re: Xdialog box used to search for last name in database

          Thanks Tim! You were definitely in the "others may very well not need it. " group I alluded to! :)

          made to work in a button placed on the customer form in Alphasports
          I guess this either relates to my laziness or simply unfamiliarity with AlphaSports as I simply have not even opened AlphaSports more than a few times ever and so did not think of doing that. I found AlphaSports just way too confusing when I was first learning and did not use it as a learning tool...and never went back really except for the multi-state button.
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: Xdialog box used to search for last name in database

            You might want to take a look at the "Progressive Lookup" function that has been around for a while.

            It can easily be modified to look up any field in any table using any index.

            Once you get the hang of how it works, those mods are quite easy.

            Do a search on "Progressive Lookup" on V8 forum, or maybe a later version may be on the V9 forum. It's a quick, reliable way to do lookups.

            D

            Comment


              #7
              Re: Xdialog box used to search for last name in database

              I use Tom's example in this thread as a good reference for progressive lookup.

              http://msgboard.alphasoftware.com/al...ght=LV_example
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: Xdialog box used to search for last name in database

                Thank you all for answering my question. I have been working on other aspects of the form until I had more time to look over your responses. This program does have a learning curve.

                I know once I learn a few more things...it will become easier. I will try a few of the suggestions that you all have offered over the next few days and let you know how they worked. I appreciate your patience as I am sure some of you have answered these same questions many times.

                Paul

                Comment

                Working...
                X