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

Linked Dialogs One to Many

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

    Linked Dialogs One to Many

    Hi Guys...

    I have a Dialog 2 component that I am trying to link to another Dialog 2 component in a One To Many Relationship.

    Brokerage to Brokers
    A Brokerage firm can have many brokers working for it.

    When I try to set the binding to One to Many it complains that I need repeating sections. I don't want repeating sections. I want to open the other dialog component in a window with a list view on one side showing all of the brokers at that brokerage.

    I'm using this linking as it allows me to pass the value using a button to the Broker dialog without using variables. Think targeting in a Grid Component to Grid Component button. I've done this in One to One instances and it works fine. Now I need One to Many. If I leave relationship set to One to One the button only pulls one linked record even though many exist. When I attempt to navigate it tells me I have not loaded the Primary Key. YET, I have a on DialogInitialize event that does load the Primary Key. If I Preview just the Broker Dialog I can navigate record by record so I know that the Keys are loading.

    I've tried using the variable method but have been unsuccessful in my attempts. My latest attempt was to put an in-line javascript to get the Brokerage_Id to a variable.

    brokerLink={dialog.Object}.getValue('BROKERAGE_ID');

    Then on the Broker dialog Server side event I put an Action Javascript (Poplulate Dialog with Data from One or More Table(s)).

    - ReadFromVariable
    - Variable that contains the primary key is set to brokerLink

    If anyone can shed some insight on what I may be doing wrong OR another way of going about this I would greatly appreciate it.

    Thanks.
    Joe
    Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

    #2
    Re: Linked Dialogs One to Many

    I'm not sure I'd have an answer for you but your table layout would help. Usually, you'd have a master or header table and then a repeating section, or sections. The master would be unique and your repeating section tables could have many to many or what have you. Are you using this to enter data? If so, what you want entered where would also help answer your question.

    Worst case, an xbasic function could take care of the populating, submitting, and deleting if all else fails.

    Comment


      #3
      Re: Linked Dialogs One to Many

      Thanks Jinx but I don't think this a case where I would need a linking table. This is a simple one to many relationship where a Brokerage has many Brokers. Not a Many to Many relationship. The Brokers table has a Foreign Key that links a Broker to a Brokerage. Brokerage_Id -> Brokerage_Id_Fk

      This works as a Grid. I'm not trying to do this as a Dialog.

      Joe
      Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

      Comment


        #4
        Re: Linked Dialogs One to Many

        Originally posted by cavj1 View Post
        Thanks Jinx but I don't think this a case where I would need a linking table. This is a simple one to many relationship where a Brokerage has many Brokers. Not a Many to Many relationship. The Brokers table has a Foreign Key that links a Broker to a Brokerage. Brokerage_Id -> Brokerage_Id_Fk

        Joe
        I'm sure what you want is possible, I'm just having a hard time understanding what you are going for here and I think others are too, otherwise there would be more replies. Can you start from scratch with your explaination?
        1. Table layout (table a has this, table b has this)
        2. What data you're entering (I need blank from table a and blank get's saved into table b)
        3. How you want the dialog or not dialog to function for the user(User see's a screen with a dropdown box that does blank, then a second blank does whatever)

        See what I'm getting at here? It's all in your head and your working on it so you know, but the rest of us need a little help.

        Originally posted by cavj1 View Post
        This works as a Grid. I'm not trying to do this as a Dialog.
        Do you mean NOW trying to use this as a Dialog?
        If not, I'm really confused.

        Comment


          #5
          Re: Linked Dialogs One to Many

          Sorry for the delay. I will try to make it clear. Sometimes it's hard to verbalize what's in my head...

          Brokerage Table looks like:
          Brokerage_Id
          Company
          Address1
          Address2
          City
          State
          Zip
          Phone
          Website
          Created
          By
          Modified
          By

          Broker Table is:
          Broker_Id
          Brokerage_Id_Fk
          First Name
          MI
          Last Name
          E-Mail
          Phone
          Fax
          Created
          By
          Modified
          By

          The only thing that should go from Brokerage to Broker is the linking Id. In this case Brokerage_Id would populate the Brokerage_Id_Fk field on the Broker table.

          As for my "Grid" statement. I have both Brokerage and Broker Grids created that are currently in production. The Brokerage Grid has a button that opens the Broker Grid. When it does it targets the Brokerage_Id_Fk in the Broker table. In doing so it either brings up all the related records where Brokerage_Id = Brokerage_Id_Fk or brings up a new record to enter the first Broker for that Brokerage.

          I'm now attempting to recreate this function using a Dialog. If I put a button that opens another grid I can only get it to work in a One to One relationship. When I attempt to navigate to the other Brokers that are related to a Brokerage it tells me I have not loaded the Primary Key. If I change the relationship to One to Many in my binding on the Dialog it complains about no repeating sections existing. I'm not attempting to load the Broker Dialog using a Variable passed from the Brokerage Dialog.

          I added an inline javascript action before the Open Dialog Action
          brokerLink={dialog.Object}.getValue('BROKERAGE_ID');

          On the Broker Dialog I put a Server-Side onDialogInitialize action

          "Poplulate Dialog with Data from One or More Table(s)".
          Primary Key Source - ReadFromVariable,
          Variable that contains the Primary Key - brokerLink

          Doesn't work...

          Not sure what I'm doing wrong or not doing. Hope I explained myself this...

          Thanks for your help
          Joe
          Last edited by cavj1; 01-23-2013, 07:30 PM. Reason: Formating
          Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

          Comment


            #6
            Re: Linked Dialogs One to Many

            I think I'm beginning to understand. I've had the primary key loading problem as well but in my case it was when I was trying to delete records. I don't think that error has too much to do with what you're trying to do (I could be wrong of course).

            Did you put a variable to read in your onDialogInitialize event like the videos show? Something like:

            Dim id as c
            id = "1" (or whatever unique id you want for testing)

            Then should be the populate from tables action scripting.

            You still want the primary key source to be read from variable but that variable should be "id"
            There's another box in the action scripting setup where you have to put _data as well. That's the one that actually will get pulled when running live.

            I'm not near my computer right now or I'd be more specific. I'll check back later.

            Comment


              #7
              Re: Linked Dialogs One to Many

              I believe I have it set right on the event.

              Screenshot:
              http://screencast.com/t/Be3heBZY
              Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

              Comment


                #8
                Re: Linked Dialogs One to Many

                The Event should look more like this:
                Code:
                '---------- Simulate a user value passed to the dialog
                dim id as c = "1"
                
                
                'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
                ExecuteServerSideAction("Populate Dialog from Tables::Populate_a_Dialog_with_data_from_Layouts")
                Remember, the id = 1 is only for use during the working preview otherwise nothing would come up. you can use brokerLink if you want, it doesn't really matter.

                Inside your action scripting box it would then look something like this:
                Primary key source: ReadFromVariable
                Variable that contains the primary key: id (or brokerLink or whatever you set it to in the onDialogInitialize event)

                Capture Raw Data should be CHECKED. (Your's is not checked)
                Dot variable name for captured data: _data (at least that's what it is when you go from grid to dialog)

                Does that help?

                P.S. if you put a debug(1) switch into your event you should be able to see what comes through in the _data variable when you go from grid to dialog or dialog to dialog.

                Comment


                  #9
                  Re: Linked Dialogs One to Many

                  Sorry but I think I'm not understanding something. My id's are numeric so I think I have to do this:

                  dim id as n = "brokerLink"

                  On my button that launches the Broker Dialog I have: brokerLink={dialog.Object}.getValue('BROKERAGE_ID');
                  I should still have that correct?

                  PRF App Brokerage - Broker.zip

                  I know I need to use that to populate the linking field for new records too.

                  On Dialog onRenderComplete - {dialog.Object}.setValue('BROKERAGE_ID_FK',brokerLink);
                  Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

                  Comment


                    #10
                    Re: Linked Dialogs One to Many

                    Check out these two videos:
                    http://www.ajaxvideotutorials.com/V1...Data_part1.swf
                    http://www.ajaxvideotutorials.com/V1...Data_part2.swf
                    Part 2 especially, is what I was talking about in my post

                    P.S. I think you may have to dim the variable as "c" whether or not the table is "n". I think it has something to do with passing the variable as a url. My table is an numeric integer value for the id as well but dimming it as c works fine.
                    Last edited by -Jinx-; 01-24-2013, 07:10 PM.

                    Comment


                      #11
                      Re: Linked Dialogs One to Many

                      Thanks Jinx, I'm sorry....I'm completely missing something here. I'm not seeing the relationship of what I'm trying to do vs the videos. Yes, there is a one to many relationship but it is using repeating sections. I'm not looking to use repeating sections. I want to open the broker dialog from the brokerage dialog in a new window. I can get the Repeating sections to work but I find repeating sections very rigid. If you look at the screen shot the form is way to wide with a repeating section and any break I put gets ignored. Not sure why...I guess that is by design.

                      http://screencast.com/t/nN6cHqeky5

                      Using a button to open the other grid yields an error when trying to navigate:

                      http://screencast.com/t/R1w7OPtSvmt

                      Joe
                      Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

                      Comment


                        #12
                        Re: Linked Dialogs One to Many

                        No worries, I might be completely missing something as well.

                        So, you're able to open the first dialog without an issue (from a grid I assume? or are you just opening it straight away to navigate records?). It's when you try to open the second dialog (please don't use grid if you mean dialog, I'm already confused...hahah.) that you are getting the error. Right?

                        I'll see if I can mess around with it a bit. The last time I got this error, (whenever I tried to delete a record WITH repeating sections) I just made an Xbasic function do it because it had me so frustrated.

                        I'm guessing that your problem may be in passing your variable.

                        You shouldn't need the javascript line, I don't think, and it may not even work because populating the new dialog is a server side action. What you may need is the e.dataSubmitted.BROKERAGE_ID That should be stored when you push a button to open the other grid. You'd have to populate with that. I'm not sure what you'd put in for the "Dot variable name for captured data" in your "populate the dialog with data" action scripting event though. Might take a little fiddling

                        Comment


                          #13
                          Re: Linked Dialogs One to Many

                          Well, I see your issue now.
                          It has to do with going from dialog to dialog as near as I can tell.
                          You can put a debug() switch in just after your populate action script and dig into the variables to see what I mean.

                          If you go from grid to dialog it seems to work fine. If you set it up as said in the videos your data get's transfered under the e.rtc._data variable. Mine for instance is saved under e.rtc._data.unique_id

                          However, if you go from a dialog to a dialog that variable doesn't exist after the populate from tables action script. The closest thing I can come up with for something to grab is e.rtc.javascriptresponse but it's a character field and you'd have to mine your ID out of that.

                          If I open up the second dialog by itself (not from a dialog component) the record navigation works fine.

                          So, you could try to mine the data out of the javascriptresponse variable. Or you could wait and see if anyone else who knows more than me (which is pretty easy) knows where that variable get's it's data or knows a better way entirely.

                          If you could use a grid in the place of your first dialog or a grid in place of the second dialog I think you could work it out that way as well. Maybe even using a dialog with an embedded grid.

                          Comment


                            #14
                            Re: Linked Dialogs One to Many

                            Yes, Dialog to Dialog is where I've been pulling my hair out. My goal was to get it so that the second dialog (Brokers) would open showing a list view already populated with the Brokers who work at the Brokerage. I think that would be pretty sleek and usable for staff but getting there has been way over my head.

                            Thank you for your help...I'm going to continue to noodle and see if I come up with something off of the variable you mentioned above.
                            Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

                            Comment


                              #15
                              Re: Linked Dialogs One to Many

                              Ugh....I can't even get this to work from a grid to a dialog. If I open the dialog only, it will navigate records without issue but if I open a dialog from anywhere else (a grid or a dialog) I get the stupid primary key error. This has got to be a bug. I can't delete a record either when opening it from another component which is now; I remember, why I made an xBasic Function for that.

                              Comment

                              Working...
                              X