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

    How to populate Unbound controls in a dialog?

    I've made great progress learning about dialogs the past few days, but I'm hitting a wall on this...


    I have several unbound controls in my dialogs.

    For new records, the unbound controls are set as Lookup.Autosuggest and work perfectly. I can type in a name, and the corresponding id is Filled In to a control that is bound to a table.

    For editing existing records, when I open the dialog (via a link from a read only grid), all of the BOUND controls are correctly filled in. But naturally, the UNBOUND controls are not populated (understandably, as they are not bound to anything)


    Seems that I need to have something in an event, but I"m not sure if it's Server or Client or what....

    How do unbound controls get populated when I open a dialog for editing?
    MSQL since 2010
    A5V11 since Feb 2012

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

    Easy, this the way ALL controls were populated in the legacy dialog (with slightly different syntax). In OnDialogInitialize:


    e.control.myfield = somevar
    e.control.myfield = "my value"
    e.control.myfield = sql_lookup() ' sql
    e.control.myfield = lookup() ' dbf
    Steve Wood
    See my profile on IADN

    Comment


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

      In your server side events, in OnDialogInitialize, you can set those values using e.control ( i.e e.control.firstname = "Jaime" )

      Comment


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

        Hi Steve -
        You're up early - thanks so much for the pointer in the right direction


        I'm using a SQL database; I understand the concept but it's going to take me some fine-tuning to understand the syntax needed based on the wiki
        http://wiki.alphasoftware.com/SQL_Lookup%20Function

        The Wiki shows lots of punctuation, and I can't (yet) tell what I need to include and exclude

        E.control.myUnboundControlNam = SQL_Lookup(Connection,table,filter, result_Expression,arguments)

        Trying to get the unbound-field titled EntityInvestor to have value from field EntityDescr from the table Entity via connection Ovation, where Entity.EntityID = EntityID

        This does not work: e.control.EntityInvestor = SQL_Lookup(Ovation,Entity, EntityID = :EntityID,EntityDescr,null)

        This does not work: E.control.EntityInvestor = SQL_Lookup(::Ovation,Entity,, EntityID = :EntityID,EntityDescr,null)

        I'll keep playing, but if someone wants to chime in with he correct syntax, that'd be great!
        MSQL since 2010
        A5V11 since Feb 2012

        Comment


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

          E.control.EntityInvestor = SQL_Lookup(::Ovation,Entity, EntityID = :EntityID,EntityDescr)

          give me the following error:

          Error executing onDialogExecute event: Error executing event 'onDialogInitialize ':
          command: e.control.EntityInvestor = sql_lookup(::ovation,entity,EntityID = :EntityID,Enti Variable "EntityDescr" not found.

          EntityDescr is DEFINITELY a column in my entity table....

          suggestions?

          this is the error with the script detail as well

          2012-03-04_econtrol.png
          Last edited by MarionT; 03-04-2012, 11:48 AM. Reason: attach image
          MSQL since 2010
          A5V11 since Feb 2012

          Comment


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

            I prefer to have more control over the sql, so please try something similar to:
            ( assuming the value of EntityID is in a control named EntityID )
            Code:
            dim cn as sql::Connection
            dim sqlcmd as c
            
            flag = cn.Open("::Name::Ovation")
            sqlcmd = "select EntityDescr from Entity where EntityID = :whatEntityID"
            
            dim args as sql::Arguments
            args.Add( "whatEntityID", e.control.EntityID )
            
            flag = cn.Execute( sqlcmd, args )
            
            dim rs as sql::ResultSet
            rs = cn.ResultSet
            e.control.EntityInvestor = rs.Data("EntityDescr")
            Jaime

            Originally posted by MarionT View Post
            Hi Steve -
            You're up early - thanks so much for the pointer in the right direction


            I'm using a SQL database; I understand the concept but it's going to take me some fine-tuning to understand the syntax needed based on the wiki
            http://wiki.alphasoftware.com/SQL_Lookup%20Function

            The Wiki shows lots of punctuation, and I can't (yet) tell what I need to include and exclude

            E.control.myUnboundControlNam = SQL_Lookup(Connection,table,filter, result_Expression,arguments)

            Trying to get the unbound-field titled EntityInvestor to have value from field EntityDescr from the table Entity via connection Ovation, where Entity.EntityID = EntityID

            This does not work: e.control.EntityInvestor = SQL_Lookup(Ovation,Entity, EntityID = :EntityID,EntityDescr,null)

            This does not work: E.control.EntityInvestor = SQL_Lookup(::Ovation,Entity,, EntityID = :EntityID,EntityDescr,null)

            I'll keep playing, but if someone wants to chime in with he correct syntax, that'd be great!

            Comment


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

              @Jaime

              Thank you for spelling it out for me
              I'm sure I'll be able to implement this based on what you've written out - I'll be back once I've done so.
              MSQL since 2010
              A5V11 since Feb 2012

              Comment


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

                Using Jaime's code, I'm getting the following error message, and, I'm not familiar (yet) with using args or arguments or sub-elements to know what the error means... any ideas?


                Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': command: args.Add( "whatEntityID", e.control.EntityID ) Property not found e.control.EntityID subelement not found.
                MSQL since 2010
                A5V11 since Feb 2012

                Comment


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

                  As i said, i am assuming you have an e.control.EntityID field that holds the entityid.

                  Comment


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

                    Yes indeed, I have a control that is: EntityID
                    MSQL since 2010
                    A5V11 since Feb 2012

                    Comment


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

                      Just checked, e.control does not contain the data in the controls while in onDialogInitialize. How do you get this EntityID? Do you have arguments in the dialog?

                      Comment


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

                        hello

                        you are awake very early....

                        I don't really know / understand yet what 'arguments' are.

                        I made a control using 5 tables (1 parent, 4 children; each is 1 to many).

                        The parent table is for contracts, and has a field/column: EntityID
                        That is a link to a 6th table that is not directly used in the dialog.

                        I placed an unbound control on the dialog for EntityDescr; It is a Lookup-AutoSuggest
                        When I open the dialog )from a read-only grid) to create a new Contract, I can type into EntityDescr and the EntityID gets "filled in"

                        When I open the dialog (from a specific row on the same read-only grid), I can see that the EntityID is automatically populated correctly - but, the EntityDescr field is blank - which makes sense, as it is not bound to anything.

                        I somehow need to use the info from the EntityID field to Lookup and Fillin the EntityDescr control

                        or
                        use the SQL_Lookup()

                        or
                        I've been playing (unsuccessfully) with your code for several hours (reading about it).


                        so - to recap -
                        I have a read-only grid with a primarykey of contractid

                        A button on each row opens a dialog -via contractid
                        the dialog has a control for EntiityID - which is bound to my Contract Table
                        The dialog has an unbound control for EntityDescr

                        I would like to fill in EntityDescr with:
                        Select E.EntityDescr
                        from Entity as e
                        inner join Contract as C on C.entityID = E.EntityID
                        where E.EntityID = :EntityID
                        MSQL since 2010
                        A5V11 since Feb 2012

                        Comment


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

                          I understand. The only missing piece is to get the value of :EntityID while in onDialogInitialize.
                          If someone less novice than us mere mortals jumps in and tells us how to retrieve that value in the onDialogInitialize of the called dialog that would be great.
                          In the meantime, this is what i would do. Assuming you are using the "Open a dialog component to Edit current record..." action in your grid, and also assuming you have an EntityID field in the grid:
                          - Edit the "Open a dialog component to Edit...." action
                          - Click on "Argument Bindings"
                          - Click on "Set Session Variables"
                          - in the box, enter the following: CurEntityID = {javascript}function(rowNum) { return {grid.object}.getValue('G','ENTITYID',rowNum); }(rowNum)
                          Now save your grid, and in your dialog, you will have a CurEntityID session variable available, which you can use as the argument for your sql as per the code before ( i guess sql_lookup will work as well ).
                          To access that session variable in onDialogInitialize of your dialog, you should use session.CurEntityID or e.session.CurEntityID ( i am not sure which one should work )

                          Jaime

                          PS: you're awake late :-)

                          Comment


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

                            Thanks Jaime -
                            I will try your suggestion

                            I didn't have EntityID in my grid, but I put it there a few hours ago, thinking it might come in handy.

                            I've been trying to get the SQL_LOOKUP() to work (unsuccessfully)

                            I'll be back in touch
                            (I don't sleep)
                            MSQL since 2010
                            A5V11 since Feb 2012

                            Comment


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

                              In case of problem, you can enter a debug(1) command in the onDialogInitialize so it will stop and you can analyze whether the session variable has been set ok etc...

                              Comment

                              Working...
                              X