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

How to populate Unbound controls in a dialog?

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

    #46
    Re: How to populate Unbound controls in a dialog?

    Thanks Selwyn, but I'm not getting where I need to go.
    I've re-attached the components.

    1. CompanyNameUnbound: Yes, I had found that error after sending you the component

    2. onDialogInitialize
    OK - I understand that I was confusing Variable vs Control

    Your video shows how to pre-specify an OrderID and have the fields populate; nice, but not convenient to type each OrderID.

    Your video shows that I can add a control for WhatID, add a PopulateNow button, and have the fields fill in; nice, but not convenient to type in each orderID and click Populate

    3. Open a Dialog Component to Edit Current Record in Grid or Add New Record: Video 24

    a. OpenDialogForEditing - I have this working, altho I don't seem to be doing what you suggest
    the dialog's onDialogInitialize is set to SpecifyNow, and Primary key Value is null/blank
    when I click from the grid, the appropriate dialog opens
    I can alter the data and saving is done correctly
    It's lovely.

    b. OpenDialogforNewRecord -
    I do not have this working; I did have it working, but have lost functionality

    c. Dialog Component does not come up via Working Preview;


    4. Trying to have Unbound control populated: This is where I started this thread
    When the dialog opens for editing, I would like the unbound control, CompanyName, pre-populated.


    A5LearnLookupV2.zip
    MSQL since 2010
    A5V11 since Feb 2012

    Comment


      #47
      Re: How to populate Unbound controls in a dialog?

      ok, please watch this.

      http://screencast.com/t/377pWmn1

      i am still unclear as to what you want to put in the unbound column, but i made some assumptions and show how you could populate the unbound column when the dialog is opened.

      Comment


        #48
        Re: How to populate Unbound controls in a dialog?

        Selwyn - This is EXACTLY the functionality I was looking for -

        of course, it was not good for me to use a view in the grid. My apologies.

        As I suspected - I was using too many pieces from too many videos and suggestions, and was mixing apples and oranges and complicating things. I suspected the Cache toggle would be used, but I had too many things in the air to know what was what.

        The reality is very very simple

        I'm off to implement this is my real application, rather than Northwind.



        I had gotten bollixed up by 3 things:

        Calling the Dialog from the grid AND having the onDialogInitalize.ExecuteServerSideAction.Populate....
        I only needed to call the dialog from the grid.

        Turn off: Use Cache Dialog inside the ActionScript for OpenDialogtoEditCurrentRecord.....

        Trying to use SQL_Lookup without being able to access the raw data that is loaded into the Dialog in the Dialog's 'onDialogInitialize' event inside the variable: e.rtc._data

        for those following at home, the onDialogInitialize code, using Northwind is:


        dim customerId as c
        if eval_valid("e.rtc._data.customerID") then
        customerID = e.rtc._data.CustomerID
        dim CompanyName as c
        dim args as sql::arguments
        args.add("whatID",customerID)
        companyName = sql_Lookup("::name::northwind","customers","customerID = :whatID","CompanyName",args)
        e.control.companynameunbound = companyName
        end if
        MSQL since 2010
        A5V11 since Feb 2012

        Comment


          #49
          Re: How to populate Unbound controls in a dialog?

          thanks.

          this turned out to be a valuable exercise for me too, because i realized that it might be a common error for someone to define an ondialoginitialize server-side event that will interfere with the grid action that opens the dialog to enter a new record or edit an existing record.

          therefore, we now automatically strip out the server side action in the ondialoginitialize event if the dialog has been called from the Grid to edit an existing record or enter a new record.

          Comment


            #50
            Re: How to populate Unbound controls in a dialog?

            great - I took a wrong turn when I didn't pay close enough attention to you in Video 24, when you clearly say at 1:50:

            Keep the onDialogInitialize empty.
            MSQL since 2010
            A5V11 since Feb 2012

            Comment


              #51
              Re: How to populate Unbound controls in a dialog?

              as a follow-up....

              1. Adjust code for numeric id; is this right?
              original: args.add("whatID",CustomerID)

              adjusted: args.add("whatID",convert_type(CustomerID,"N") )


              2. Inconsistent behavior
              my unbound control gets populated.... sometimes

              yes, I unchecked the Cache switch

              yes, my data definitely exists - in fact, when the dialog is based on the same customer, the customer name sometimes shows up and sometimes does not show up


              3. As per our working example with Northwind, my grid is now a table (rather than a view). Which means that it is filled with ids and keys, rather than human readable terms.

              Should this work if the grid is a view?

              when I update or insert via the dialog, is the data going back to the server, and then the grid is running anew? In which case, a view should, theoretically, be fine.

              Or, are the changes staying on the client side, and going directly from the dialog to the grid?
              MSQL since 2010
              A5V11 since Feb 2012

              Comment


                #52
                Re: How to populate Unbound controls in a dialog?

                3. As per our working example with Northwind, my grid is now a table (rather than a view). Which means that it is filled with ids and keys, rather than human readable terms.

                Should this work if the grid is a view?

                It makes no difference if the grid is based on a table or a view. the only thing that is relevant is the primary key or the table of view. it is the primary key of the table/view (as defined in the Grid component) that determines which record the Dialog is populated with

                when I update or insert via the dialog, is the data going back to the server, and then the grid is running anew? In which case, a view should, theoretically, be fine.

                when you click the submit button on the dialog IF YOU HAVE DEFINED A SERVER SIDE EVENT TO SAVE DATA IN THE DIALOG IN THE DIALOG'S AFTERDIALOGVALIDATE EVENT, then the data is saved to the table(s) that were specified in the Dialog's Data Binding definition. then when the dialog is closed, the Grid is automatically refreshed to show the edited data. this should be shown in the videos that describe this feature.

                Or, are the changes staying on the client side, and going directly from the dialog to the grid?

                if you don't have a server side action in the dialog to commit the data, then the changes would be not be saved back to the database.


                [/QUOTE]

                i am beginning to wonder why you want to use the dialog to edit the data in your grid in the first place. most users simply would build a grid with an updateable detail view. using the dialog as an alternative to the built-in Detail View of the Grid is a more advanced concept and unless you have a good reason for using the Dialog might be easier for you to get started with.

                Comment


                  #53
                  Re: How to populate Unbound controls in a dialog?

                  My app has 3 primary modules, each of which has a key table which has a bunch of subsidiary tables.

                  I had an elaborate dialog set up with the parent table and a tab control, with tabs for entering data into repeating panels. It was fine - it was fabulous - until I tried to learn how to have data appear into the unbound control. Then it went haywire, so I stripped back to barebones, trying to figure out what I'd done wrong.

                  I can build it with a grid and detail views; but the dialog seemed like a more efficient interface because of using transactions and a single submit
                  MSQL since 2010
                  A5V11 since Feb 2012

                  Comment


                    #54
                    Re: How to populate Unbound controls in a dialog?

                    if you are doing data entry into multiple tables and you want to treat the entry as a single transaction, then that can only be done in the dialog. that's a compelling reason to use the dialog in your case.

                    Comment


                      #55
                      Re: How to populate Unbound controls in a dialog?

                      You can do complex multi-table transactions in a grid using code in oninsertrecord event, but it requires stretching the grid model and is cumbersome. We all did this in v10 but the new dialog is the way to go.
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #56
                        Re: How to populate Unbound controls in a dialog?

                        I gave this a lot of thought last night and this morning.....

                        If I'm not mistaken, there are several ways of inserting data in to multiple tables at the same time.... these are the ones I've learned about:

                        1 - Video 78 about Customizing SQL INsert, Update and Delete Statements using Stored Procedures to Update your Database (requires creating a dummy 'cache' table in SQL, a Stored Procedure)
                        I included the details in post #11 of this thread:
                        http://msgboard.alphasoftware.com/al...-a-Single-GRID

                        2- using views and Triggers as described by Maroine81 in post #12 of the same thread

                        3 - as Steve Wood says in post #55 above

                        4 - using a Dialog from V11

                        I assume they each have their place, and so I'm learning them all, putting them in my pocket, and will evaluate for each instance which to use.

                        I feel most 'in control' when using the Dialogs; it feels like the most direct route
                        MSQL since 2010
                        A5V11 since Feb 2012

                        Comment


                          #57
                          Re: How to populate Unbound controls in a dialog?

                          Here is how to properly use lookup:
                          dim args as SQL::Arguments
                          args.set("EntityID",7)
                          dim retval as C = convert_Type(sql_lookup("::name::ovation","entity","EntityID = :EntityID","EntityDescr",args),"C")
                          if retval<>"" then
                          e.control.EntityInvestor=retval
                          else
                          'CONTROL VALUE WAS BLANK OR THE RECORD SPECIFIED BY ENTITYID=:ENTITYID WAS NOT FOUND (OR POSSIBLY AN ERROR OCCURRED I THINK)
                          end if

                          Now, if sql lookup doesnt find a record, it returns type of Z or V - cant remember (which is a void). It doesnt seem you can store void into any variable type.
                          So i usually use the convert_type(var,"C") and compare against "". This will tell you if the record failed to load.
                          If the return value you want is ACTUALLY a blank in the database, you cannot differentiate whether or not an error occurred.
                          I try to use lookups only for quick lookups.
                          Scott Moniz - Computer Programmer/Analyst
                          REA Inc.
                          http://reainc.net
                          (416)-533-3777
                          [email protected]

                          REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                          If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                          contact us to discuss options.

                          Comment

                          Working...
                          X