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

Variable does not contain a valid result set

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

    Variable does not contain a valid result set

    I've seen this error many different places, but I've never been able to figure out what the problem is. It's a pretty cryptic error message:

    Code:
    XHTTPRequest Error:
    
    500 Internal Server Error
    Script ErrorError:Script:" /jklive/__a5RunGrid.a5w" line:62
    x_out = a5_ajax_grid(tmpl)
    Variable does not contain a valid result set while getting result set data column 'Notes'.
    
    
    Alpha Five/11.0 Build/3381-4096 at DMC214 Port 80
    I've usually gotten around it by rebuilding the a5wcmp, but in this case, it's not an option.
    When I take out the notes field, it just errors on the previous field. In this case, Notes is a label and it errors if it's null or filled in.
    Is there anyway to get a 'better' error message!

    EDIT: sorry, it shows on row save.
    EDIT2: More info, mysql, no update security, so anyone can edit the row.

    #2
    Re: Variable does not contain a valid result set

    Your save may be failing.

    Variable does not contain a valid result set happens when you do a SELECT and the select fails, but then you try to access the resultset. Since the select failed, the resultset variable is not valid.

    Hence, variable does not contain a valid resultset.

    Maybe this will help you.
    If you dont have any custom sql in this grid, its probably that the SELECT statement for the grid is failing.
    Does your grid INNER JOIN by any chance? In that case after saving, the parent table would not have any child records and the inner join would fail.
    But usually this is a different error.

    Try looking for custom sql selects, try relooking at your grid SQL, and then if you have a inner join change it to a left join, in that order.
    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


      #3
      Re: Variable does not contain a valid result set

      The save actually goes through, as does my xbasic code in AfterUpdateRecord. I've reverted back to an older version of the component and the error went away, then tried making the updates I had made, one at a time, until the error came back.
      It came back with this code
      Code:
      sql_lookup(args.rtc.cn,"gen_territories","TerritoryID="+Data.Territory_fk,"TerritoryName")
      . I am going to try a few things (different cn object, arguments) and report back.

      Comment


        #4
        Re: Variable does not contain a valid result set

        It is not finding your territory. (Hence resultset invalid) and you are not doing anything to capture the error.
        You may want to do the following

        Code:
        dim territoryName as C=convert_type(sql_lookup(args.rtc.cn,"gen_territories","TerritoryID="+Data.Territory_fk,"TerritoryName"),"C")
        This will return a blank if no territory with the id Data.Territory_fk is found.

        if thats not acceptable you need to do something like:
        Code:
        dim territory as C=convert_type(sql_lookup(args.rtc.cn,"gen_territories","TerritoryID="+Data.Territory_fk,"TerritoryName"),"C")
        if territory<>"" then
            'continue processing
        else 
             'some error handling here to output an error message 
             'output your error with e.abort and e.errorText, or whatever error mechanism you can use
              e.flagError=.t.
             e.errorText="could not load territory: "+Data.Territory_fk
        end if
        Last edited by aburningflame; 04-12-2013, 12:10 PM.
        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


          #5
          Re: Variable does not contain a valid result set

          Your cn object should be fine, sql_lookup also takes a string for cn. So you can do sql_lookup("::name::myconnname", etc etc
          Also I would suggest using args if Data.Territory_fk is user-provided.

          dim args as SQL::Arguments
          args.set("tid",Data.Territory_fk)
          sql_lookup("::name::conn","gen_territories","TerritoryID=:tid","TerritoryName",args)
          Last edited by aburningflame; 04-12-2013, 12:09 PM.
          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


            #6
            Re: Variable does not contain a valid result set

            So it appears to be the args.rtc.cn object. I changed it to be my own sql object and it worked. (I also added in the arguments, but that's just because it's good practice)
            It's just annoying that I had one line of code, now i have like 8 because I have to setup and tear down the connection.
            Code:
            dim args as sql::Arguments
            args.add("territory",Data.Territory_fk)
            dim cn as sql::connection
            flag = a5SQLConnectionOpen(cn,"::name::DynamicConnection_jkapp", session)
            if .not. flag then
            	write2log("Connect to DB",cn.CallResult.text)
            end if
            Territory_fk_render = sql_lookup(cn,"gen_territories","TerritoryID=:territory","TerritoryName",args)
            cn.FreeResult()
            cn.Close()
            delete cn

            Comment


              #7
              Re: Variable does not contain a valid result set

              you dont need your own object, just use the sql_lookup("::name::DynamicConnection_jkapp" .....) unless it doesnt resolve properly, in which case you can use
              sql_lookup(session.__protected__jkapp,"tablename"....)

              Also, there is no need for a flag variable when opening your connection, why the extra code?
              Use this:
              Code:
              if a5SQLConnectionOpen(cn,"::name::DynamicConnection_jkapp",session) then
                     'do stuff
              else
                    write2log("connect to db",cn.CallResult.text)
              end if
              Anyways the neatest and most stable solution would be this I believe:
              Code:
              dim args as sql::Arguments
              args.add("territory",Data.Territory_fk)
              dim territory as C=convert_type(sql_lookup("::name::DynamicConnection_jkapp","gen_territories","TerritoryID=:territory","TerritoryName",args),"C")
              if territory<>"" then
                   Territory_fk_render = territory
              else
                   Territory_fk_render="Error occurred loading territory: "+Data.Territory_fk
              end if
              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


                #8
                Re: Variable does not contain a valid result set

                I was under the impression that if I used Dynamic Connections, that I couldn't call it directly (sql_lookup("::name::DynamicConnection_jkapp" .....)), and that I had to use an object, otherwise it would just open ::name::DynamicConnection_jkapp instead of looking at the session variable.

                I do like the second thing you said about getting rid of flag and just throwing the open into an if/else (does xbasic have try/catch?). I think, however, I will move to get rid of the flag. It would be a major search/replace on my part though.

                Comment


                  #9
                  Re: Variable does not contain a valid result set

                  I was under the impression that if I used Dynamic Connections, that I couldn't call it directly (sql_lookup("::name::DynamicConnection_jkapp" .....)), and that I had to use an object, otherwise it would just open ::name::DynamicConnection_jkapp instead of looking at the session variable. - This may be the case, use session.__protected__jkapp instead. (You can use an a5w_info.a5w page with the code <%a5 ?a5w_info() %> and run the page to see what session variable is actually storing your dynamic connection. In that case it would be safer to use sql_lookup(session.__protected__jkapp,"tablename"... instead.

                  I do like the second thing you said about getting rid of flag and just throwing the open into an if/else (does xbasic have try/catch?). I think, however, I will move to get rid of the flag. It would be a major search/replace on my part though. - It was just an FYI for cleaner code and better reliability. Your method works, as long as your testing the flag variable in every instance. However, you really dont need to store hte result of conn.open and conn.execute. You can just use it as the condition in an if.

                  Code:
                  if cn.Open("::name::conn") then
                        'continue
                        cn.close()
                  else
                        'failure
                  end if
                  does xbasic have try/catch?
                  As far as I know, I dont think so.
                  For the most part you do not need a try catch, you should use ifs to validate conditions and ensure that exceptions arent thrown.
                  However, there are some cases when you need wrap something in a try/catch.

                  The closest equivalent AS FAR AS I KNOW, I believe is something like this:
                  There may be try/catch, but Im not going to dig through documentation for it.
                  Code:
                  on error goto errhandler
                  some code
                  some more code
                  end
                  
                  errhandler:
                  errormsg=error_text_get(error_code_get())
                  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