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

Copy Last Years Sales

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

  • #16
    Re: Copy Last Years Sales

    Yes, you are correct in your assessment. I'm missing something here. I understand what's happening in the first part but how will it know which fields to copy? Or are all fields copied? What is the purpose of the 'Schedule' and 'Type'?

    Very much appreciated
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    Comment


    • #17
      Re: Copy Last Years Sales

      My customer wants to copy certain fields of all of last years sales records for each customer Currently, I have it set up so the user can click an icon to create a new record and then copy certain fields.
      that is exactly what is being done your customer tells you what to replicate and in the code you will use that information. I have given you name of the field to show that I am using the same table name for 'from' and 'to', and the same field names for 'from' and 'to'. they are just example names, no reference to any fields you may have.

      if your customer want to choose the fields on the fly, then you should be able to do with a dialog - ux, I am sure.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      ggandhi344@gmail.com
      Skype:ggandhi344@gmail.com
      1 914 924 5171

      Comment


      • #18
        Re: Copy Last Years Sales

        Hi,

        I changed the table names to my table name. I changed the 'startdate' to my date field. When I press the button to run it, nothing happens, it's like the button is dead. Do I need to replace 'schedule' and 'type' with something?
        TYVM :) kenn

        Knowing what you can achieve will not become reality until you imagine and explore.

        Comment


        • #19
          Re: Copy Last Years Sales

          Do I need to replace 'schedule' and 'type' with something?
          yes with your field names.
          please see what I said, I am using them to show you that I am referring to the same field in both instances.

          I have given you name of the field to show that I am using the same table name for 'from' and 'to', and the same field names for 'from' and 'to'. they are just example names, no reference to any fields you may have.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          ggandhi344@gmail.com
          Skype:ggandhi344@gmail.com
          1 914 924 5171

          Comment


          • #20
            Re: Copy Last Years Sales

            OK, what you did, is use 'schedule' and 'type' as field names in your example to be replaced with my field names. I thought 'schedule' and 'type' was supposed to produce a schedule of some sort, etc. This is what I did but again, nothing happens.

            FUNCTION copyLastYearData AS V ( )

            dim curYr as n
            curYr = year(date())
            dim tbl_a as p
            dim tbl_b as p
            tbl_a = table.open("tlc_3apps")
            tbl_b = table.open("tlc_3apps")
            tbl_a.fetch_first()

            while .not. tbl_a.fetch_eof()
            if year(tbl_a.estabdate) = curYr-1
            tbl_b.enter_begin(.t.)
            tbl_b.name = tbl_a.name
            tbl_b.svcsiteid = tbl_a.svcsiteid
            tbl_b.sale= tbl_a.sale
            tbl_b.exempt = tbl_a.exempt
            tbl_b.svc_descrip = tbl_a.svc_descrip
            tbl_b.enter_end(.t.)
            end if
            tbl_a.fetch_next()

            end while
            tbl_b.close()
            tbl_a.close()
            msgbox("Result", "all the relevant last year data copied to new records")

            END FUNCTION
            TYVM :) kenn

            Knowing what you can achieve will not become reality until you imagine and explore.

            Comment


            • #21
              Re: Copy Last Years Sales

              name
              svcsiteid
              sale
              exempt
              svc_descrip
              are these in the table as fields?
              and you called this function via a button?
              and you checked the table to see nothing has changed?
              if yes to all the questions, I can post a screencast later this evening for you.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              ggandhi344@gmail.com
              Skype:ggandhi344@gmail.com
              1 914 924 5171

              Comment


              • #22
                Re: Copy Last Years Sales

                or just put a debug in the function and check it out.

                or you might need path alias as peter said.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                ggandhi344@gmail.com
                Skype:ggandhi344@gmail.com
                1 914 924 5171

                Comment


                • #23
                  Re: Copy Last Years Sales

                  Yes to all questions but before you do the video, I'll try debug and the path alias.

                  Finally got back to it. My granddaughter stopped by and wanted some help with a school project. I tried Peter's suggestion. That did not do it. Then I added debug and this is what it doesn't like.

                  FUNCTION copyLastYearData AS V ( )

                  Apparently it needs to be named a bit different, either by adding or removing something. I did try using a 'D, 'C', AND 'N' instead of V but it didn't like that either.
                  Last edited by forskare; 03-17-2015, 03:19 PM.
                  TYVM :) kenn

                  Knowing what you can achieve will not become reality until you imagine and explore.

                  Comment


                  • #24
                    Re: Copy Last Years Sales

                    FWIW, debug always goes to the first row of code, no matter what it is.
                    TYVM :) kenn

                    Knowing what you can achieve will not become reality until you imagine and explore.

                    Comment


                    • #25
                      Re: Copy Last Years Sales

                      i think you are testing this in a grid. if yes

                      just go to interactive window and test the function like
                      copyLastyearData.
                      and see if that works.
                      if you want to do in a grid do the following.
                      create an action button and name it anything you want, then in the action click on the javascript and define an xbasic function name it anything you want. then on the left hand bottom there are two links click the top copy to clipboard, then click the next and paste it.
                      then save and close.
                      then go to the xbasic declaration in that grid and paste the code without the function and end function from the code above. only the business part.
                      then save everything.
                      preview and click on the action button.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      ggandhi344@gmail.com
                      Skype:ggandhi344@gmail.com
                      1 914 924 5171

                      Comment


                      • #26
                        Re: Copy Last Years Sales

                        Ken,

                        debug(1) begins at what ever row you place it at. Then click on "step" to step through the code. You can add the fields and variables to the watch window to see the values as they change. Do a video search on debug or debugger. Selwyn has several videos on using the debugger.

                        Edit: I see Gandhi posted before me.
                        Peter
                        AlphaBase Solutions, LLC

                        Peter@AlphaBaseSolutions.com
                        https://www.alphabasesolutions.com


                        Comment


                        • #27
                          Re: Copy Last Years Sales

                          [ Deleted by Tom ]
                          Last edited by Tom Cone Jr; 03-18-2015, 04:31 PM.

                          Comment


                          • #28
                            Re: Copy Last Years Sales

                            Gandhi and Peter,

                            The Code is on a button on the main form for now, as long as this is not a full blown web app. However, at some point this app may be a ful blown web app so following Gandhi's advice would be a good step to take. I'll work with it this evening and see what happens.

                            Thanks for your advice.

                            EDIT:

                            I pressed the button to run the code. I stops at the first line of code. Press F-12 and it goes to line 1, which is the date the code was created. Press F-12 again and a blank screen appears showing 1 line: '--No Source Code--. That's where it ends. Another thing which is happening; Alpha got an upset stomach twice today while I'm working with this as the little churning circle appears and the only way to stop it is to close Alpha, either with the Red X or the end task. Either way, it says Alpha is not responding. Hmmm. The sasme thing happens when I press the 'Step' button. More to follow as I move along with this.
                            Last edited by forskare; 03-18-2015, 07:59 PM.
                            TYVM :) kenn

                            Knowing what you can achieve will not become reality until you imagine and explore.

                            Comment


                            • #29
                              Re: Copy Last Years Sales

                              Sorry, but I have to ask this. How exactly are you trying to run this code. Have you saved it as a function under the control panel code tab or, as you intimate, have you pasted the function code on the button itself?
                              Tim Kiebert
                              Eagle Creek Citrus
                              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                              Comment


                              • #30
                                Re: Copy Last Years Sales

                                http://screencast.com/t/mAjrCTrk

                                take a look. can be done in a function, in a desktop form, in web grid.
                                thanks for reading

                                gandhi

                                version 11 3381 - 4096
                                mysql backend
                                http://www.alphawebprogramming.blogspot.com
                                ggandhi344@gmail.com
                                Skype:ggandhi344@gmail.com
                                1 914 924 5171

                                Comment

                                Working...
                                X