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

Problem Populating a Dialog from Tables and Loading Primary Keys

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

    Problem Populating a Dialog from Tables and Loading Primary Keys

    I have a dialog with first/previous/next/last navigation buttons. I�m using the action script �Load Primary Keys� in the onDialogInitialize event. This works fine when the dialog is run by itself and not launched from another component.

    I also want to open this dialog from a grid and pass the dialog a primary key value. I want the dialog to populate the controls with the data for the primary key value that I�m passing to it. I�m using �Populate Dialog from Tables� to automatically populate the controls for the given primary key. This works as well.

    My problem is that I want to use both �Load Primary Keys� and �Populate Dialog from Tables� when the dialog is opened from a grid so that it will populate the dialog with the correct row and also allow the user to navigate to other rows using the nav buttons. When I use both action scripts, the �Load Primary Keys� seems to override the �Populate Dialog from Tables� and always displays the first row. It doesn�t matter which order I call them. I have even converted the �Load Primary Keys� action script to xbasic and removed the line of code that navigates to the first record - "{dialog.object}.navigateRecord('first').

    Does anyone know how to do this? I haven�t spent too much time looking through the �Load Primary Keys� xbasic code because I�m hoping there might be a more elegant way.

    Thanks

    #2
    Re: Problem Populating a Dialog from Tables and Loading Primary Keys

    Hi Dave,
    I was messing with this a while ago
    http://msgboard.alphasoftware.com/al...d+primary+keys
    Check out post #17

    Comment


      #3
      Re: Problem Populating a Dialog from Tables and Loading Primary Keys

      Hi Jinx,

      That is exactly what I'm already doing, but since it worked for you, I'm wondering if I could have forgotten to save the child dialog. I sometimes forget to save the child and wonder why my changes did not take effect when I launch the child from the parent. I'm so used to not saving minor tweaks and such during testing because A5 uses the component in memory, but when you are testing a child component by opening it from a parent, the changes have to be saved. I will go back and try again. I was hoping this was possible without having to hardcode and modify the action script code in the onDialogInitialize.

      As for the line of code to remove, I had inserted an "if" statement which checks to see if I passed an argument which means the dialog was opened from the grid. If not, then it performs the line of code. If so, it skips over it.

      Thanks

      Comment


        #4
        Re: Problem Populating a Dialog from Tables and Loading Primary Keys

        Even with it working when I tested it, I still had an annoyance. Even though it loaded the proper record, when I clicked a nav button it reindexed to the first record in the grid. Have you found a way to make it keep it's place and have it actually go to the next or previous record from the one you loaded?

        Comment


          #5
          Re: Problem Populating a Dialog from Tables and Loading Primary Keys

          Yes, but it's a little tedious.

          First, you do not need to use the �Populate Dialog from Tables� action script to initialize the dialog with data for a given row if you are already using the �Load Primary Keys� action script. You should just use one or the other.

          If the dialog should be positioned at the beginning of the table, you do not need to do anything. The action script works �as is�. If you are positioning the dialog to a row other than 1, you will need to figure out the row number or index number for the primary key. The index must be based on the same order as your "Load Primary Keys" action script. You can loop through the result set using "rs.data" and "rs.NextRow" to calculate the index number for your primary key value.

          Replace the following line:

          javascriptSetPrimaryKeys = javascriptSetPrimaryKeys + "{dialog.object}.navigateRecord('first');"

          with:

          javascriptSetPrimaryKeys = javascriptSetPrimaryKeys + "{dialog.object}.navigateRecord(� + index + �);"

          Replace the following line:

          var currentKey = {dialog.object}._primaryKeyList[0].d1;

          with:

          var currentKey = {dialog.object}._primaryKeyList[zero-based index].d1;

          The second line change will take a little more work because it is embedded in a "%txt%" directive. The �zero-based index� must be the actual numeric index number minus 1. For example, if you want to populate the dialog with data for row number 10, the JavaScript output for the two line changes above would be as follows:

          javascriptSetPrimaryKeys = javascriptSetPrimaryKeys + "{dialog.object}.navigateRecord(10);"

          var currentKey = {dialog.object}._primaryKeyList[9].d1;


          Hopefully in the future, Selwyn will add an option in the "Load Primary Keys" builder to initially position the dialog at a given key value so we do not have to do all of this work.

          Comment


            #6
            Re: Problem Populating a Dialog from Tables and Loading Primary Keys

            Originally posted by DaveF View Post
            Hopefully in the future, Selwyn will add an option in the "Load Primary Keys" builder to initially position the dialog at a given key value so we do not have to do all of this work.
            When I corrisponded with him over this he seemed to think the idea of doing what we are doing was strange and didn't see a need for it. Basically, he said "why?" and I said "why not?" haha. Maybe I was the first and only one that was bugging him about it or something. A few more little birds in his ear might be a good thing.

            Comment


              #7
              Re: Problem Populating a Dialog from Tables and Loading Primary Keys

              I will see what I can do. I like providing a user option that automatically brings up the record you were last accessing. It's nice when you have several dialogs based on the same master table like an employee table for example.

              Does anyone else out there want a new property added to the "Load Primary Keys for Parent Table" action script that allows you to specify which record to initially display? If left blank, it would work like it does now and display the first record.

              Comment


                #8
                Re: Problem Populating a Dialog from Tables and Loading Primary Keys

                Hi All,
                I'm trying to modify my Load Primary Keys action script with the lines of code from post #5 above but, i'm having trouble locating the below line of code to change it. I'm trying to accomplish the same (use navigation options within a dlg and have the same starting record in dlg window from the grid row when the dlg is initialized). Dave mentioned that it is embedded in a "%txt%" directive. Any advice on how to access this or any other solutions? Thanks

                var currentKey = {dialog.object}._primaryKeyList[0].d1; change to
                var currentKey = {dialog.object}._primaryKeyList[zero-based index].d1;

                Comment

                Working...
                X