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

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

    ok - thanks

    I keep thinking I should be able to use the action Script: Lookup and Fill In
    but I can't figure out where to put it
    MSQL since 2010
    A5V11 since Feb 2012

    Comment


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

      I'm at the point where I'm implementing the SQL_Lookup()

      and, what I don't understand is: what part of the process tells A5 to put the VALUE (the result, the answer) from the lookup in to the unbound control on my dialog?

      I'm working on :
      sql_lookup("::name::Ovation","Entity","EntityID=:whatEntityID","EntityDescr",session.CurEntityID)

      or

      sql_lookup("::name::Ovation","Entity","EntityID=:whatEntityID","EntityDescr",e.session.CurEntityID)



      but it feels like I need to have something like:

      e.control.EntityInvestor = sql_lookup("::name::Ovation","Entity","EntityID=:whatEntityID","EntityDescr",session.CurEntityID)
      MSQL since 2010
      A5V11 since Feb 2012

      Comment


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

        I think I'm getting closer....

        I had to remove the Argument setting in the grid (where I call the "Open a dialog component to Edit current record..." action , as my dialog wouldn't open at all with the code....

        Now I'm back to playing with SQL_LOokup, in the delineated style

        connection = "::Name::OvationReal"
        table = "Entity"
        filter = "EntityID = :whatEntityid"
        result_expression = "EntityDescr"
        dim args as sql::arguments
        args.set("whatentityid","EntityID")
        e.control.EntityInvestor = sql_lookup(connection,table,filter,result_expression,args)
        I'm getting this error message:
        Conversion failed when converting the nvarchar value 'EntityID' to data type int.


        so I have to figure out how to let SQL know that EntityID is an integer....
        MSQL since 2010
        A5V11 since Feb 2012

        Comment


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

          This works:

          connection = "::Name::OvationReal"
          table = "Entity"
          filter = "EntityID = :whatEntityid"
          result_expression = "EntityDescr"
          dim args as sql::arguments
          args.set("whatentityid",3498)

          e.control.EntityInvestor = sql_lookup(connection,table,filter,result_expression,args)
          What needs to happen is for the 3498 to be replaced with something like.....:
          "entityid"
          entityid
          {entityid}
          e.entityid
          e.control.entityid
          session.entityid
          MSQL since 2010
          A5V11 since Feb 2012

          Comment


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

            Using variations of Steve's suggestion.... here are several that I've tried.


            Trying this: e.control.EntityInvestor = sql_lookup("::name::OvationReal","Entity","EntityID=:whatEntityID","EntityDescr")

            Gives me this error: Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': Could not execute lookup query. Reported error: An argument value was referenced in the SQL query, but no argument list was provided


            I don't have a handle on what an argument is, and can't find anything satisfying about it in the wiki.


            Trying this: e.control.EntityInvestor = sql_lookup("::name::OvationReal","Entity","EntityID=:whatEntityID","EntityDescr","EntityID")

            Gives me the same error: Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': Could not execute lookup query. Reported error: An argument value was referenced in the SQL query, but no argument list was provided


            Trying this: e.control.EntityInvestor = sql_lookup("::name::OvationReal","Entity","EntityID=:whatEntityID","EntityDescr", "whatEntityID" = entityid)

            Gives me this error: Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': command: e.control.EntityInvestor = sql_lookup("::name::OvationReal","Entity","EntityID=: Variable "entityid" not found.

            I definitely have a bound control for EntityID s both Grid1 and the Dialog


            What should the syntax of the args portion of SQL_LOOKUP() look like?


            For what it's worth, if I Inspect Element in the browser, and click Console, I often see that there is an Uncaught TypeError: Object false has no method 'setAttribute'
            Last edited by MarionT; 03-05-2012, 10:21 AM. Reason: remove an open paren
            MSQL since 2010
            A5V11 since Feb 2012

            Comment


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

              you should practice with the sql_lookup() function in the interactive window first:

              for example:


              dim cn as sql::connection
              ?cn.open("::Name::mysql_alphasports_v11_2")
              = .T.

              dim args as sql::arguments
              args.add("whatcust",3)

              ?sql_lookup(cn,"customer","customer_id = :whatcust","lastname",args)
              = "Rebo"


              If you are not clear on what an 'argument' is you should read up on the sql::arguments object in the wiki.


              if you are looking up multiple values from the same sql connection and record, then sql_lookup() is pretty in-efficient, compared to coding something yourself in xbasic.

              for example, say you wanted both the firstname and lastname value. this would be more efficient


              dim cn as sql::connection
              cn.open("::Name::mysql_alphasports_v11_2")
              dim sql as c
              sql = "select firstname, lastname from customer where customer_id = :whatcust"
              cn.Execute(sql,args)
              rs = cn.ResultSet
              firstname = rs.data("firstname")
              lastname = rs.data("lastname")
              cn.close()


              there is an excellent tutorial on interacting with sql databases from xbasic as this address:

              http://wiki.alphasoftware.com/Learni...20SQL%20Tables

              Comment


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

                The wiki for SQL::Arguments specifies, at the bottom of the screen, that it is for Desktop Applications only. So I don't know what portion of the text is valid for V11 Web and what portion of the text is not valid.

                http://wiki.alphasoftware.com/SQL+Argument+Object

                ---

                In your example (SR), I presume the 3 and the Rebo are the actual answers

                I can get the lookup to work if I hardcode an ID into the expression/function, but I need it to be dyanamic, based on whatever row is selected.

                ----
                I'll try to use the interactive window; I don't understand how to use it yet at all, and the How To .... page of the Wiki doesn't reference it, so I have to figure out which video uses it and watch what you do to access it...

                EDIT: Ok - i found the help page - http://wiki.alphasoftware.com/Using+...ractive+Window

                ---

                I did read the tutorial at http://wiki.alphasoftware.com/Learni...20SQL%20Tables but I wasn't able to watch the videos; I will watch them now
                MSQL since 2010
                A5V11 since Feb 2012

                Comment


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

                  the wiki is wrong in suggesting that sql::arguments do not apply to web applications.

                  in my example 3 (the customer id) is hard coded. "rebo" is the answer for the lookup - so it is an output vaue.

                  if the input value (3) in my example was to be taken from some submitted value from the dialog you would do

                  args.add("whatCustomerid", convert_type( e.datasubmitted.customerId, "N") )

                  remember that all data submitted from a web app is character - there is no such thing as typed data when you submit.

                  so, i have to use convert_type() to convert the data so that the argument is of the correct data type.

                  Comment


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

                    ooooooh - I think the convert_type is definitely part of the problem but I was not going about the conversion in a proper manner.

                    convert_type( e.datasubmitted.EntityId, "N")
                    Now the error is:
                    Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': command: args.add( "whatEntityID", convert_type(e.datasubmitted.entityid,"N") ) Property not found e.datasubmitted.entityid subelement not found.

                    I definitely have a control on my dialog and my grid for: EntityID


                    If I change it to: convert_type( EntityId, "N")
                    then I get the error: Error executing event 'onDialogInitialize ': command: args.add( "whatEntityID", convert_type(entityid,"N") ) Variable "entityid" not found.
                    MSQL since 2010
                    A5V11 since Feb 2012

                    Comment


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

                      if you definitely have a control called EntityID, then e.datasubmitted will definitely have a property called entityid.

                      you should watch video D39.

                      Comment


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

                        ok Selwyn

                        I'm at Xbasic video 8

                        I'll go to D39 after I'm done with the Xbasic series
                        MSQL since 2010
                        A5V11 since Feb 2012

                        Comment


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

                          I don't know how to integrate the info from D39 into what I'm working on.

                          Let's backtrack -
                          I have a readonly grid, based on a view.
                          A button on each row opens a dialog, linked to the row via ContractID.

                          The Dialog has 2 controls:
                          EntityID which is bound to the Contract table
                          EntityInvestor which is unbound, Lookup.AutoSuggest

                          If I were to change the Entity associated with this contract, I would not type anything into the EntityID control; I type into the EntityInvestor AutoSuggest Control, which looks up and fills in the info into the EntityID field.

                          Presumably, that is the same as if I were, indeed, typing directly into the EntityID control.

                          OK - let's try something. I'm going to disable the EntityInvestor as a lookup, and I'll just type directly into the EntityID control, so I can mimic Video D39

                          E.DataSubmitted includes EntityID

                          My OnAfterDialog already has: ExecuteServerSideAction("Save Data::save")

                          I'm unclear if D39 is asking me to replace that command with the more detailed code, or what's expected.

                          I don't know where to go from here.
                          I've stripped away all the repeating panels to simplify what I'm look at at for learning purposes. I've stripped away the AutoSuggest aspect from EntityInvestor


                          When I run the Dialog by itself, there is clearly a property for ENTITYID

                          When I call the dialog from the grid, ENTITYID is not found (message about a subelement.... I don't know what a subelement is)


                          This is all very simple and direct and clearly explained.
                          Unfortunately, I am not getting the expected result.
                          I'm sure I'll look back on this in a month and laugh, but, for the moment.....
                          MSQL since 2010
                          A5V11 since Feb 2012

                          Comment


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

                            bumping this up as I'm still stuck.. I've stripped everything out to the bare-bones to learn the functionality of SQL_LOOKUP() and had no progress.

                            I tried to implement SQL_Lookup() within the grid - without the dialog. No success.

                            I converted the EntityID within the SQL select to a varchar (rather than converting the A5 variable to numeric); no success

                            If I use an actual hardcoded ID number, it works.

                            this is what I have in onDialogInitialize:

                            dim cn as sql::connection
                            dim sql as c

                            flag = cn.open("::Name::OvationReal")
                            sql = "Select EntityDescr from Entity where EntityID = :WhatEntityID"

                            dim args as SQL::Arguments
                            args.add("whatentityID",convert_type(e.datasubmitted.ENTITYID,"N"))

                            flag = cn.execute(sql,args)
                            dim rs as sql::ResultSet
                            rs = cn.ResultSet
                            e.control.EntityInvestor = rs.Data("EntityDescr")

                            cn.close()

                            To recap - I have a readonly grid; each row has a button that uses action scripting to Open Dialog and Edit....

                            The Dialog has unbound controls
                            I am trying to have a value filled in, based on the above code.
                            MSQL since 2010
                            A5V11 since Feb 2012

                            Comment


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

                              i suggest you build a test case that involves either alphasports.mdb, or northwind.mdb and post that. that way you will get a definitive answer on how to make your test case work, rather than all of this speculation about why you might be doing wrong.

                              Comment


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

                                ok
                                doing it now
                                MSQL since 2010
                                A5V11 since Feb 2012

                                Comment

                                Working...
                                X