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

UX Populate Data from other Tables

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

    UX Populate Data from other Tables

    Hi All

    I have a UX Component linked to a number of tables and all works well.

    When creating a new record I do an Edit Lookup and the user can populate the UX with all the details from a previously entered record - in effect this is used as a template for a new record.

    The issue that I have is that it also populates what I call the ipm_id field with the previous data - this is the primary key for the UX and is also an auto increment field.

    Is there a way that this field won't be filled in so that when I submit the record a new record is created with a new ipm_id rather than overwrite the record that I have used as the template.

    Chris

    Thanks

    #2
    Re: UX Populate Data from other Tables

    Is your table key an auto number? Your Lookup is filling in the Key because... it is the key... so you don't have a choice there... right?

    Could you do a...

    Code:
    {dialog.Object}.setValue(UXControlName,value [,honorChangeEvent] )
    so...

    Code:
    {dialog.Object}.setValue('ipm_id','' )
    or whatever your UX control name is... may not be ipm_id... after your lookup?

    Comment


      #3
      Re: UX Populate Data from other Tables

      Hi David

      Yes it is an auto increment (as I would call it) and yes it is filling in the key.

      I click on a button to populate and it runs the action javascript for the table populate and I have entered the above as next in the list to execute in the onclick event but it doesn't change the value.

      Where would I put this command?

      Chris

      Comment


        #4
        Re: UX Populate Data from other Tables

        Try adding another Action Javascript right after your Lookup. There's an Action Javascript "Ajax Callbacks and Javascript" that allows you to choose In-line Javascript.
        Play around with the Run synchronously setting at the bottom... see if you need it.

        Comment


          #5
          Re: UX Populate Data from other Tables

          Hi David

          Thanks very much for the top tip.

          I had it all setup correctly but I didn't have the run synchronously ticked. Once ticked and all was ok.

          Although the technique I am using with a button that populates the form - a better way of doing it is shown in the video.

          http://www.screencast.com/t/hlSNBSuD - How would I nullify the ipm_id doing it this way.

          Can I execute {dialog.Object}.setValue('ipm_id','' ) within XBasic just after the execute command?

          Thanks

          Chris

          Comment


            #6
            Re: UX Populate Data from other Tables

            Chris,

            In the UX onDialogInitialize event you'll see...

            Code:
            'You can set the initial value of any field by setting the property (see comment at end for Javascript technique to use when setting values for a large number of controls)
            'e.control.<fieldname>
            'For example:
            'e.control.firstname = "Fred"
            'e.control.lastname = "Jones"
            and

            Code:
            'To specify any javascript that you want to execute set the  e.javascript property. For example:
            'e.javascript = "alert('hello');"
            You could use either to set the value of the ipm_id control... although the first method is better.

            Try...

            Code:
            e.control.ipm_id = "";
            I would think this is the preferred method

            Or

            You could put your setValue method in e.javascript because e.javascript gets executed when the onDialogInitialize event finishes.

            Code:
            e.javascript = "{dialog.Object}.setValue('ipm_id','' );"
            Do all this AFTER your ExecuteServerSideAction

            Comment


              #7
              Re: UX Populate Data from other Tables

              Thanks for that.

              The only problem that I have is that I currently use the UX to also Edit the current record as well as copy it. Is the solution to have 2 UX's which in effect are the same apart from the onDialogInitialize event.

              Chris

              Comment


                #8
                Re: UX Populate Data from other Tables

                Since you're passing the ID from the Grid in a variable... pass in another variable... "Edit" or "New"... something like that.

                Test for it in the UX onDialogInitialize and code accordingly.

                Comment


                  #9
                  Re: UX Populate Data from other Tables

                  Cheers I will give that a go at work in the morning. Its very late here so off to bed - thanks for all our help.

                  Chris

                  Comment


                    #10
                    Re: UX Populate Data from other Tables

                    Hi David

                    I am a little confused as to what I should put where.

                    The Logic is that I have a grid with buttons that Create a New Record, Copy an existing Record or Edit the Existing and all 3 of those buttons would take me to a UX.

                    Presumably I would setup Session Variables:-

                    dim session.edit_ipm as c = ""
                    dim session.copy_ipm as c = ""
                    dim session.new_ipm as c = ""

                    Set the Variable to Yes in the OnClick Event of the Button - Can you set session variable in JS?

                    I would test for the Variable in the UX inthe OnDialogInitialize Event and reset the ipm_id etc depending on which button that was pressed.


                    Thanks

                    Chris

                    Comment


                      #11
                      Re: UX Populate Data from other Tables

                      Hey Chris,

                      No... this won't work. The UX, as you have it set up, is set for a SQL Update. I'm going to have to look at this more.

                      Comment


                        #12
                        Re: UX Populate Data from other Tables

                        Hi All

                        I am giving this a bump as I never sorted the issue out and I now really need to as the second round of reviews is coming up and this feature will be used.

                        Any help will be greatfully recieved.

                        Thanks

                        Chris

                        Comment


                          #13
                          Re: UX Populate Data from other Tables

                          it is after 12 posts and I went through all of them. the intent and logic are not clear to me, to say the least.

                          you have a grid and you want to call a dialog to edit the record from the row or insert a new record. that much clear to me.
                          edit the record: for this to work you will need one button in the grid that will call the dialog and prefill with the data from the row.
                          insert a record: for this to work you will need one action button in the navigation toolbar of grid that will call the dialog.
                          you can use the same dialog.
                          now comes the confusion. you seem to have implied that you are going to "use this as a template for a new record". do you mean to say copy fields from a record and prefill the dialog with that data except the primary key and submit as a new record. so all the columns will be the same except a new record will be created with a new primary key?
                          if that is the case you might want to consider placing a second button on the grid itself not an action button in the navigation toolbar. call the first one "edit" the second "copy"

                          for the second button onClick event you can get the rownumber with selectedRow property and set however many fields you want to the window object using grid.object getvalue property. and open the dialog and on initialize event check for the existence of window object and assign the values to the dialog objects controls.

                          I have not worked out a working example or tried this concept yet, since I do not know if this is what you are looking for.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment


                            #14
                            Re: UX Populate Data from other Tables

                            I'd probably use the various Action Javascript actions for Edit or Add a record from a Grid using a UX... but... if you really, really want to use 1 UX to Edit or Add this works pretty good... and I think it uses almost every aspect of Alpha... which is, in itself, cool. Well... maybe not everything... but lots...

                            http://www.youtube.com/watch?v=imUjeKaFtHg

                            Comment


                              #15
                              Re: UX Populate Data from other Tables

                              Ghandi - Thanks for the reply.

                              David,

                              I have put it together a little differently.

                              1 I have a Button on the Status Bar that Runs an Action Javascript "Open a UX component to Edit Current Record in Grid, or add a new record" I have EnterNewRecord as the Mode.

                              2 The Record opens and within that Record I have a drop down that will show me all Records that are currently Live. I choose the Record that I want and click the Populate button that runs the Action Javascript Populate Contros in a UX Component with Data from Tables - The New Record is then Populated from the Selected Record.

                              3 The issue I have is it also copies the Key which is an Autonumber Field and when the record is submitted it tries to save that ID.

                              Is there anyway round this?

                              Chris

                              Comment

                              Working...
                              X