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

Query options??

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

    #16
    Re: Query options??

    Peter

    Just starting looking over your code. Seems to be missing an operation "DeleteZerioPreCharge". Is this needed to get a good code run?

    One of the things that I did initially was to break your filters apart and add the s_quote() function to wrap the variable vg_current_property_name in quotes. When running the option T, with the unquoted filter, no records were found, when runing it with the quoted vg_current_property_name, it returns the proper 1 record found.

    Wait for your answer.

    Tom Baker

    Comment


      #17
      Re: Query options??

      Tom .... no, you dont need operation to test. Without the changes you mention, if i run with debug, and check the query count, it does find records for the query. Run debug .... put a break at "if between(postdate,poststartdate,postenddate)" ... then step through the loop. Watch 'tblb.unitweek' and watch the query pointer 'qryb' as soon as the unitweek hits '01507' (seven records into the loop), you see the query pointer get dropped.

      I am going to play around with the filter per your test to see if this changes, but still the question - why would the 'qryb' pointer get dropped? and if you notice as you step through, it gets dropped on the execution of the lookup() ... wierd.

      Glenn

      Comment


        #18
        Re: Query options??

        Tom,
        I changes all my filters in the gencharge script to use quote() around global var 'vg_current_property_name' ... I get the same exact thing. If you get a chance, step through debug per my previous post and I think you will see whats happening.

        Thanks again for checking it out ....

        Glenn

        Comment


          #19
          Re: Query options??

          Peter

          I have been working on and off for several hours on your test app.

          I have gone over every line of code and cannot find anything wrong other than the fact that in this scenario Alpha will not allow the "T" option. When using the "T" query.option, the query drops around the 8th record in the TSM_unitalloc table. With any other option (including "" - no option) the code goes to finish and the qryb query is not dropped until qryb.drop() is used.

          The only thing that I can say, it that the T option produces a query that is temporary and can be overwritten if another slot is needed and I suppose Alpha needs to use the slot after 8 iterations and therefore drops the query.

          I would say that this is a bug but I tried this in version 9 and it produced the same dropped query if the T option was used.

          Since you already have a test app, you might consider sending this in as a bug and see what happens that is unless someone else can see something that both you and I can not.

          Wish I had better news but the workaround is just using query.option="" if you do not want to use an index.

          I tried you app in Version 8 but there must some new things using V10 on the form and such so it would not load. So I can't say whether it was the same in Version 8.

          Tom Baker

          Comment


            #20
            Re: Query options??

            Tom .... thanks so much for checking this out .... and thanks to the others who have commented on best practices for using query dot variables. I'm not going to turn in a bug, because I cant really say the 'T' option is not doing what it is supposed to ... just wish I new why it would drop the query after 8 cycles through loop and why its the lookup() that actually causes the drop .... there are supposed to be 16 slots available .... but being confused about the number of slots is not enough for a bug report. Originally, I didn't even specify a query.options in my first version of the script ... probably picked up the 'T' option from another script ... as other have said, I need to make sure my options are cleared or explicitly setup ... will try and practice this in the future.

            Thanks again ...

            Glenn

            Comment


              #21
              Re: Query options??

              Glenn

              I was looking at your code again. The way your script is written the TSM_unilalloc table is open when you are doing the lookups so if you change the script at line 229 from this

              Code:
              if vl_uflag = .t.
              				
              	uactive = lookup("tsm_unitalloc","Ua_property_name = "+quote(var->vg_current_property_name)+" .and. "+"Unitweek = "+quote(tblb.Unitweek),"Ua_active_flag")
              	if uactive=.f. then
              	    goto next_unitweek
              	end if
              end if
              to this

              Code:
              if vl_uflag = .t.
              'since the tsm_unitalloc table is already open you do not need to look up
              'the ua_active_flag use the table directly
              				
              	    if tblb.Ua_active_flag = .f. then
              	           goto next_unitweek
              	    end if
              end if

              It will cut out the lookups and the code will run much faster in posting the transactions. It even runs with this coding with the "T" option - so that tells me that running that lookup is the culprit in having the query dropped after 8 iterations but still don't know why.

              At least some of the mystery is gone.

              Tom Baker

              Comment


                #22
                Re: Query options??

                Glenn

                You can disregard my prior post. I had looked at the lookup() on the TSM_unitalloc table and misread the second part of the filter "unitweek =" quote(tblb.unitweek)

                Without that filter, the app updates the wrong number of records.

                But we know now that the culprit was the lookup() just don't know why.

                Tom Baker

                Comment


                  #23
                  Re: Query options??

                  I recently ran into the same issue when converting an app from V8 to V10 with lookup()

                  It may be worth reporting as a bug if you can produce a simple example for Alpha.
                  Cole Custom Programming - Terrell, Texas
                  972 524 8714
                  [email protected]

                  ____________________
                  "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                  Comment


                    #24
                    Re: Query options??

                    The lookup() function opens a new instance of the table, and runs its own query each time it's called. This can be pretty slow. Often a better solution is to open the table once, set the desired index, and then do a series of fetch_find()'s (so to speak) to retrieve the desired records. This will perform much faster and does not involve running repeated queries.

                    Comment


                      #25
                      Re: Query options??

                      So Tom(Cone) ..... your saying that the lookup() uses a query slot?

                      Comment


                        #26
                        Re: Query options??

                        TomB .... thanks for the heads up on the lookup() and whether to take out or not.

                        Glenn

                        Comment


                          #27
                          Re: Query options??

                          Martin .... can you describe the issue you had. The problem I'm having with reporting as a bug is .... if the lookup() is supposed to use a query slot, then I would understand why slots would get used up and I would understand why my query would get dropped after the slots got used up if I used the option 'T'.

                          The question still out there ..... why does query.options = "" work?? Wouldnt the query eventually get dropped anyway ... I would think all slots would eventually be used up by the recursive lookup() within the loop .... it definitely loops through more than 16 times.

                          ???????

                          Glenn

                          Comment


                            #28
                            Re: Query options??

                            So Tom(Cone) ..... your saying that the lookup() uses a query slot?
                            I don't know. It seems likely. I've never bumped into this because when I discover I need to loop through a sequence that uses the slower LOOKUP() function I always implement the much faster fetch_find() sequence.

                            Comment


                              #29
                              Re: Query options??

                              Tome(Cone) .... I hear ya ... but a good understanding of the query process, when it gets used(user or alpha), number of slots, and the different options only helps when deciding which program path to take. Lookup() may be slow in certain cases, but in cases where it might not matter, its very convenient. I guess I just like to know how things tick. I guess this is just another one of those .... "if it hurts doing that ... dont do that" ... kinda things ...:)

                              Comment


                                #30
                                Re: Query options??

                                To each his own.

                                Lookup() will always be slower. So I rarely use it, and never inside a loop where it will be called over and over.

                                Comment

                                Working...
                                X