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

Running a Summary op on Runtime shadow...

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

    Running a Summary op on Runtime shadow...

    I haven't tested this on a server-client scenario yet (using runtime shadowed), but a couple of questions occurred to me that if a summary operation creates a new table:

    1. Where does it put it - or where SHOULD I put it?
    2. Do I have to add the table to the local machine's adb to use it?
    3. If 2, then that table won't be shadowed so will not exist when optimized

    Color me confused as to how I should write my script for an op that creates a temp table.

    A somewhat related question - does anyone know if tablesum() can be used on a table with only one record? I tried this in a calculation and it worked when there were more records but not with only one.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    #2
    Re: Running a Summary op on Runtime shadow...

    ? tablesum("dest",".T.","ttl") '1 record
    = 4

    ? tablesum("dest",".T.","ttl") 'no records
    = 0
    There can be only one.

    Comment


      #3
      Re: Running a Summary op on Runtime shadow...

      1. Where does it put it - or where SHOULD I put it? 'available to all users or just the current user? For all it would go in the networked directory, single user, on their machine.
      2. Do I have to add the table to the local machine's adb to use it? 'no, you can reference it with the full path
      3. If 2, then that table won't be shadowed so will not exist when optimized
      There can be only one.

      Comment


        #4
        Re: Running a Summary op on Runtime shadow...

        I know Ray from Capetown has mentioned creating shadow tables on the local desktop. But I am not sure that is what I need to do. My thought is once I have the temp tables created and place them on the server, the shadow optimize should pick them up. Then my scripts ought to be able to point to the local shadowed table to run the summary - IF the summary works that way. Do you think it will? Otherwise I can hard code paths to the server...
        Robin

        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

        Comment


          #5
          Re: Running a Summary op on Runtime shadow...

          Originally posted by Stan Mathews View Post
          ? tablesum("dest",".T.","ttl") '1 record
          = 4

          ? tablesum("dest",".T.","ttl") 'no records
          = 0

          Your 1st example is similar to what I get when there is only 1 record and the amount being totalled is 1 (works only if the table is re-indexed - but then I have timing issues). I decided to summarize the summary table to get the total and that has been more consistent when run from a form. But now I have 4 summary ops to code... instead of my original 2.
          Last edited by MoGrace; 10-16-2017, 07:36 PM.
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #6
            Re: Running a Summary op on Runtime shadow...

            If you have or can get a table pointer you could try <TBL>.RECORD_CONTENT_GET(), if not then TABLE.EXTERNAL_RECORD_CONTENT_GET() to get a list of field values into a variable. Then use *TOTAL() on the result. Not sure why tablesum() is giving you problems so just suggesting an alternative.
            There can be only one.

            Comment


              #7
              Re: Running a Summary op on Runtime shadow...

              Thanks, I was looking for an alternative when I came up with the re-summarizing idea. It would probably be easier than what I am doing... Its a process you know, you think you can do something until you find out you can't! I've been in here over 15 years and I still rarely know what I am trying to do.

              I am using a record-list listbox to populate my variable with the summary table. And that won't give me a value to total, only to return on user selection.

              Just to give you an idea of what I am trying to do - which is reproduce a 'spreadsheet':

              signinmon.jpg monsum.jpg
              Last edited by MoGrace; 10-16-2017, 09:39 PM.
              Robin

              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

              Comment


                #8
                Re: Running a Summary op on Runtime shadow...

                From docs.

                Code:
                dim this_path as C
                dim bare_path as C
                dim app_path as C
                dim shadowed as L
                dim shadowed_path as C
                
                this_path=:a5.Get_Path()
                
                bare_path=:a5.Get_Master_Path()
                
                if len(alltrim(bare_path)) = 0 then 'if zero, not shadowed
                    shadowed =.F.
                    app_path = this_path + chr(92)
                else
                    shadowed =.T.
                    app_path = bare_path + chr(92)
                    shadowed_path = this_path + chr(92)
                end if
                You'll want to use this_path to get the shadowed location.

                You can use shadowed_path in your summary code to locate the output file.
                Last edited by Al Buchholz; 10-16-2017, 11:15 PM.
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                http://www.iadn.com/images/media/iadn_member.png

                Comment


                  #9
                  Re: Running a Summary op on Runtime shadow...

                  Thanks Al,
                  What has me curious is whether or not, when running this summary code in a shadowed runtime, I should use the master path to the file or can I use the path to the local shadowed table? Your code will test which AA copy I am using, but which do I need for my script? IOW - Will the local path write a summary operation correctly to a shadowed table? Hopefully, if it will; then getting the current path is all I need.
                  Last edited by MoGrace; 10-17-2017, 01:42 PM.
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #10
                    Re: Running a Summary op on Runtime shadow...

                    1. Is this a multi-user system?

                    2. Where do you want the summarized table to be?

                    3. What other issues are you considering? What are you going to do with the summarized table after you have generated it?
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: Running a Summary op on Runtime shadow...

                      1. Yes, maybe 6 or 7 users.
                      2. Server - accessible locally - after initial creation should become shadowed tables on local machines.
                      3.a. Why I decided to do this?
                      3.b. The table the form is based on is used to create 2 summarized tables. Then these 2 are summarized again into 2 temp tables to get the totals of the count field in the first 2. When the user changes the Month the table is queried, then a button will run the summary script to update the lists in the 2nd Tab. I suppose I could make this a one-step process instead of two; but right now just getting it to work is my goal! And so far on my developer copy - it is.

                      I have a runtime shadow on my developer machine, but am not sure that works quite the same way as in a live networked environment - hence the question.
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                        #12
                        Re: Running a Summary op on Runtime shadow...

                        I decided to try a 3rd summary op using a set. If my script opens the set and gets pointers to the tables - how does that work in scripting a summary op?

                        s - set.open_session("sum_race")
                        hdr = s.appt
                        chld = s.race

                        here is what the builder produced:
                        Code:
                        'This Operation is defined for a set. A set can only be opened in its own session.
                        'Therefore, the evaluate_template_private() function is used. It executes code in a new session.
                        evaluate_template_private(<<%code%
                        'In case the destination table name is stored as a relative file name, or uses an alias
                        'in the drive/path specification, use the filename_decode() function to convert the
                        'filename to an absolute filename.
                        summarize_db_name = filename_decode("[PathAlias.ADB_Path]\test_racesum.DBF")
                        
                        'Prompt for any ASK variables in filter/order expressions......
                        ask_vars = <<%list%
                        Askd_Begin_Date
                        Askd_Ending_Date
                        
                        %list%
                        prompt_result = a5_prompt_for_ask_vars(ask_vars,session_variables(session_get()))
                        if prompt_result <> "OK" then
                            end
                        end if
                        table.reset("sum_race.set")
                        tbl = table.current()
                        
                        ON ERROR GOTO ERROR1512201709220761
                        
                        
                        sum.db = summarize_db_name
                        sum.db_dd_delete = .F.
                        sum.result_overwrite = .F.
                        sum.order = "RACECODE+X"
                        sum.filter = "BETWEEN(APPTDATE,VAR->ASKD_BEGIN_DATE,VAR->ASKD_ENDING_DATE)"
                        sum.options = "I"
                        sum.fields = 5
                        sum.field1 = "RACECODE"
                        sum.code1 = 0
                        sum.field2 = "race->RACE"
                        sum.code2 = 6
                        sum.field3 = "Racecode"
                        sum.code3 = 2
                        sum.field4 = "X"
                        sum.code4 = 0
                        sum.field5 = "\"filter\""
                        sum.code5 = 16
                        
                        tbl.summarize()
                        
                        
                        GOTO CONTINUE1512201709220761
                        ERROR1512201709220761:
                        ON ERROR GOTO 0
                        ui_msg_box("Error","Error running Summarize Operation"+crlf()+error_text_get())
                        END
                        CONTINUE1512201709220761:
                        
                        'Add the table just created by the Summarize operation to the Database..
                        file_add_to_db(summarize_db_name)
                        
                        %code%)
                        Notice it wants to use evaluate_template_private(), also table.reset() to make it the current table in the session - is this necessary? Shouldn't set.open_session() accomplish this?
                        Robin

                        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                        Comment


                          #13
                          Re: Running a Summary op on Runtime shadow...

                          The genies create operations/code without making any assumptions about anything else which might be occurring. The evaluate_template_private() encapsulation - "protects you in case the code you want to run uses a variable with the same name as your calling code and you don't want it to be overwritten." The table.reset() accomplishes similar protection.

                          Since you know the particulars of your procedure you can often eliminate the extra precautions which the genie generates.
                          There can be only one.

                          Comment


                            #14
                            Re: Running a Summary op on Runtime shadow...

                            Good - thanks Stan.
                            Robin

                            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                            Comment


                              #15
                              Re: Running a Summary op on Runtime shadow...

                              My favorite is sometimes you will see a line like

                              varname = eval(""This is text."",local_variables())

                              shortens to

                              varname = "This is text."
                              There can be only one.

                              Comment

                              Working...
                              X