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

Copy Last Years Sales

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

    #31
    Re: Copy Last Years Sales

    Hi Tim,

    I placed the code in the onClick event of a button. I commented out the Function and End function lines. Upon reading your post and thought, hmmm, I better check that and sure enough, when I placed it back in, and copied to the button, I didn't do what I thought I did. So, I commented it out and ran it. Now, it is stepping through but when it got to this line:

    curYr = year(estabdate())

    It says: Function; 'estabdate' was not recognized. (I had changed it from date to estabdate because that is my date field.)

    In a separate window, it says:
    Script:OnPush line: 12
    curYr=Year(estabdate())
    Function: 'estabdate' was not recognized

    I changed date to estabdate because that is my date field and there was no reference in the script to a date field in my table. So, I changed it back to date. Now it steps past this line but cycles from

    if year(tbl_a.estabdate) = curYr-1

    to

    tbl.a.fetch_next ()

    OK, there has to be a reference to my date field but this reference must not be it.
    TYVM :) kenn

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

    Comment


      #32
      Re: Copy Last Years Sales

      Originally posted by GGandhi View Post
      http://screencast.com/t/mAjrCTrk

      take a look. can be done in a function, in a desktop form, in web grid.
      I was working on my last post when you replied. Thank you for the study lesson. However, it is the same as your first one which I have working great. Takes just over 3 minutes to copy over 5,000 records. The one with the problem is the last one, the one where the date is added in. While there must be a reference to my date field (estabdate), the issue is the connection between that and the year variable.
      Last edited by forskare; 03-18-2015, 10:14 PM.
      TYVM :) kenn

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

      Comment


        #33
        Function - How many reasons....

        The code is on a button. The button does not run a named function. It only runs the code. Yet, when I use Debug(1), it shows this error message: 'Function not Recognized'. I thought when the dim statement is used, it becomes a variable. Why is this a function and What are the reasons why the function is not recognized?

        This is the code:

        dim curYr as n
        curYr = year(estabdate())

        This is the error message:

        Function 'estabdate' was not recognized.

        Thanks much.
        TYVM :) kenn

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

        Comment


          #34
          Re: Function - How many reasons....

          Originally posted by forskare View Post
          The code is on a button. The button does not run a named function. It only runs the code. Yet, when I use Debug(1), it shows this error message: 'Function not Recognized'. I thought when the dim statement is used, it becomes a variable. Why is this a function and What are the reasons why the function is not recognized?

          This is the code:

          dim curYr as n
          curYr = year(estabdate())

          This is the error message:

          Function 'estabdate' was not recognized.

          Thanks much.
          dim curYr as n
          try with this one curYr = year(estabdate)
          To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

          - William Faulkner

          Comment


            #35
            Re: Function - How many reasons....

            Kenn,

            Is "estabdate()" a user defined function that you can see in the list on your control panel's code page?

            If so, does it return a "date" value?

            Sometimes the control panel needs to be "refreshed" after a custom script or function is saved to the code page. You might try doing that, or simply shut alpha down and restart it.

            Still having trouble? show us the code that's running in the called function.

            Comment


              #36
              Re: Function - How many reasons....

              Hi Tom,

              No, it is not. I would assume that when AA is closed completely and the app is opened again, the CP would be refreshed.
              TYVM :) kenn

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

              Comment


                #37
                Re: Function - How many reasons....

                Originally posted by aal_fareed View Post
                dim curYr as n
                try with this one curYr = year(estabdate)
                I tried that and no longer the Function issue. However, now it says the variable 'estabdate' is not found.
                TYVM :) kenn

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

                Comment


                  #38
                  Re: Function - How many reasons....

                  this looks like follow up on the other post where you were working on a script.
                  do you have a field estabdate in your table?
                  looks like your are assigning curYr to the year portion of some field.
                  the terminology first time was not correct, it was looking for a function. now that is cleared up, it is looking for a variable, not a field with that name, estabdate. see if you have any spelling errors etc., if you like you can post the list of fields and people can see and post right code back to you.
                  Last edited by GGandhi; 03-21-2015, 08:24 AM.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #39
                    Re: Function - How many reasons....

                    more than likely the correct format will be, if this is a continuation of the other post.

                    curYr = year(tbl_A.estabdate) or curYr = year(tbl_B.estabdate)


                    edit: after looking at your other post the correct terminology will be
                    curYr = year(tbl_A.estabdate)
                    Last edited by GGandhi; 03-21-2015, 08:56 AM.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #40
                      Re: Function - How many reasons....

                      Yes, this is a followup. Now it's saying 'tbl_a' not found. Time for some humor
                      TYVM :) kenn

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

                      Comment


                        #41
                        Re: Function - How many reasons....

                        please post your table structure and the code. that will help definitely.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment


                          #42
                          Re: Function - How many reasons....

                          Attached is the zip file. I entered three records. The code is on the button which is on the form.

                          Thank you.
                          Attached Files
                          TYVM :) kenn

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

                          Comment


                            #43
                            Re: Function - How many reasons....

                            It would seem your script is trying to find a table value before you open the table...

                            dim curYr as n
                            curYr = year(tbl_a.estabdate)
                            dim tbl_a as p
                            dim tbl_b as p

                            tbl_a = table.open("tlc_3apps")
                            Robin

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

                            Comment


                              #44
                              Re: Function - How many reasons....

                              Originally posted by forskare View Post
                              Attached is the zip file. I entered three records. The code is on the button which is on the form.

                              Thank you.
                              please try this i am sure it will work for you
                              just make sure that estabdate contains date value

                              dim curYr as C
                              curYr = year(convert_type(estabdate,"D"))
                              To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

                              - William Faulkner

                              Comment


                                #45
                                Re: Function - How many reasons....

                                I played a bit with your button script that was trying to copy records to the same table and resulted in an endless loop.

                                Code:
                                dim curYr as n = year(date())	
                                dim tbl_a as p
                                dim tbl_b as p
                                dim cnt as n = 0
                                dim flag as L = .f.
                                
                                tbl_a = table.open("tlc_3apps")
                                'duplicated your table with no records and a new name
                                tbl_b = table.open("[COLOR="#FF0000"]tlc_3copy[/COLOR]")
                                
                                tbl_a.fetch_first()
                                flag = .t.
                                while .not. tbl_a.fetch_eof()
                                	if year(tbl_a.estabdate) = curYr-1
                                		on error goto ERRTRAP
                                		tbl_b.enter_begin(.t.)
                                			tbl_b.Customerid = tbl_a.Customerid
                                			tbl_b.Svcsiteid  = tbl_a.Svcsiteid
                                			tbl_b.Service  = tbl_a.Service
                                			tbl_b.Svc_Descrip = tbl_a.Svc_Descrip
                                			tbl_b.Svc_Zip  = tbl_a.Svc_Zip
                                			tbl_b.Sale  = tbl_a.Sale
                                			tbl_b.Exempt = tbl_a.Exempt
                                			tbl_b.Comborate  = tbl_a.Comborate
                                			tbl_b.Discount  = tbl_a.Discount
                                			tbl_b.Disc_Note = tbl_a.Disc_Note
                                		tbl_b.enter_end(flag)
                                		cnt = cnt+1
                                	end if
                                	tbl_a.fetch_next()	
                                end while
                                
                                tbl_b.close()
                                tbl_a.close()
                                msgbox("Copy Result","Records Copied for "+ltrim(str(curYr-1))+": "+ltrim(str(cnt)),0)
                                END
                                ERRTRAP: 
                                flag = .f.
                                on error goto 0
                                RESUME NEXT
                                Robin

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

                                Comment

                                Working...
                                X