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

Having problem with query_create()

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

    Having problem with query_create()

    Hello,

    I keep getting this error when running a search query in V7 (runs fine in V4):
    "tbl.query_create()
    No such field"

    This is the code:
    "dim vfileno as c
    dim tbl as p
    dim indxname as p
    dim qfind as n
    vfileno=ui_get_text("File Number","Enter the file number","","00000000")
    if vfileno=""
    end
    end if
    tbl=table.current()
    indxname=tbl.index_primary_get()
    query.description="File No. equals "+vfileno
    query.order="File_No"
    query.filter="File_No='"+vfileno+"'"
    tbl.query_create()
    qfind=tbl.fetch_first()
    if qfind<>0 then
    ui_beep()
    ui_msg_box("Message:","There is no matching file number.")
    tbl.index_primary_put(indxname)
    end if
    parentform.resynch()"

    It seems that query.filter is causing it but cannot figure it out. appreciate your feedbacks.

    #2
    Originally posted by lemow
    Hello,

    I keep getting this error when running a search query in V7 (runs fine in V4):
    "tbl.query_create()
    No such field"

    This is the code:
    "dim vfileno as c
    dim tbl as p
    dim indxname as p
    dim qfind as n
    vfileno=ui_get_text("File Number","Enter the file number","","00000000")
    if vfileno=""
    end
    end if
    tbl=table.current()
    indxname=tbl.index_primary_get()
    query.description="File No. equals "+vfileno
    query.order="File_No"
    query.filter="File_No='"+vfileno+"'"
    tbl.query_create()
    qfind=tbl.fetch_first()
    if qfind<>0 then
    ui_beep()
    ui_msg_box("Message:","There is no matching file number.")
    tbl.index_primary_put(indxname)
    end if
    parentform.resynch()"

    It seems that query.filter is causing it but cannot figure it out. appreciate your feedbacks.
    I think v6 and v7 are picky about some things.

    Try

    query.filter="File_No='"+var->vfileno+"'"
    There can be only one.

    Comment


      #3
      Ali,

      Double check the actual fieldname in the structure of the table. Is it "File_no" or is it "File No" ?

      Recommend always including query.options parameter. Alpha will reuse the previous query list if available.

      It's easier for us to read your code if you surround the block of code with code tags.

      -- tom

      Comment


        #4
        Thank you for your feedbacks.

        Stan,
        I tried it and gives same error.

        Tom,
        I changed File_No to File_no and... but it didn't make any difference. I added query.options but keep getting the same error.

        Comment


          #5
          Ok, time to post a sample of your database so we can see the context in which this occurring. Zip the entire thing and give us directions so we can find the script.

          -- tom

          Comment


            #6
            I'm not sure what is happening with the query command, but I think your logic to reset the index back to the original index tag is flawed.
            tbl.index_primary_put(indxname)
            your variable indxname is a pointer not a tag name
            try using this to get the original index tag name
            index_name = indxpointer.name_get to get the original tindex tag name.

            Comment


              #7
              John, that's a good point.

              But you'll also need the trailing parentheses.

              Code:
              index_name = indxpointer.name_get[COLOR="Red"][B]()[/B][/COLOR]

              Comment


                #8
                John,

                Thank you for your feedback. I tried the pointer but it gives me error saying:" tbl.index_primary_put(indxname)
                Not a valid index handle"

                Comment


                  #9
                  Ithink the following included in your program should work.not tested however

                  tbl=table.current()
                  index_pointer=tbl.index_primary_get()
                  index_tagname = index_pointer.name_get() ' thanks to Tom Cone
                  then eventually tb1.index_primary_put(index_tagname)

                  Comment


                    #10
                    John,

                    Either way: whether adding the last line of your code, it gives the initial error:"tbl.query_create()
                    No such field"

                    Tom,
                    Sorry, takes at least an hour to load the database...

                    Comment


                      #11
                      Ali, we don't need all your data, just a representative sampling. We don't need all your tables, either. Just the tables (and set) involved in the form where you're running this script, with their dictionaries.

                      -- tom

                      Comment


                        #12
                        Ok, please see attached. The form in question is:"MainFormFind" and Button 1 aka:"By File Number". Please let me know if there is anything missing. Thank you.
                        Last edited by lemow; 11-13-2006, 10:44 PM.

                        Comment


                          #13
                          Ok, back to the help file you go. You've included a table. You've omitted the table's dictionaries, which we will need. Open Help, Choose Index Tab, Choose File, Choose Alpha Five File Types.

                          We need the DBF, FPT (if one exists) and the CDX for the table, plus the Data Dictionaries that have the same name as the table.

                          -- tom

                          Comment


                            #14
                            Tom,

                            There is only .dbf file (no FPT or CDX). I've included the dictionary files associated with the table. Thanks.
                            Last edited by lemow; 11-13-2006, 10:44 PM.

                            Comment


                              #15
                              Originally posted by lemow
                              Tom,

                              There is only .dbf file (no FPT or CDX). I've included the dictionary files associated with the table. Thanks.
                              You didn't say which form/button is giving the problem.

                              Try this for the code for the By File Number button on the MainFormFind form.

                              Code:
                              dim vfileno as c
                              dim tbl as p
                              dim indxname as p
                              dim qfind as n
                              vfileno=ui_get_text("File Number","Enter the file number","","00000000")
                              if vfileno=""
                              	end 
                              end if
                              tbl=table.current()
                              index_pointer=tbl.index_primary_get()
                              index_tagname=index_pointer.name_get()
                              query.description="File No. equals "
                              query.order="vfileno"
                              query.filter="File_No= "+quote(var->vfileno)
                              query.options=""
                              ix = tbl.query_create()
                              'qfind=tbl.fetch_first()
                              qfind = ix.records_get()
                              if qfind = 0 then
                              	ui_beep()
                              ui_msg_box("Message:","There is no matching file number.")
                              tbl.index_primary_put(index_tagname)
                              end if
                              ix.drop()
                              parentform.resynch()
                              I had to remove the onkey event code for the same form as it was giving me trouble.
                              There can be only one.

                              Comment

                              Working...
                              X