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

script recorder

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

    script recorder

    Hi Guys,

    Tell me what I am doing wrong. From a new button on a form
    I opened the script recorder and then switched to operation
    and ran a pretested operation (which copies selected files to a new table named test). Next I switched to "tables & sets" and renamed the test.dbf to 1999.dbf. Next I ended
    the script recorder. Now when I go to the button on the
    form in the design mode, I right click on the button,
    select "action" and it is blank.

    Thank you all in advance,
    Ed

    #2
    RE: script recorder

    So alright already, I am learning. I found the script in
    the script recorder window. After copying it into actions
    of the magic button. It still doesn't perform the task.
    Now what?
    Ed

    Comment


      #3
      RE: script recorder

      Ed,

      I just posted an answer (I hope) to a similar question about an append operation.

      A operation recorded as a low level script has certain "presumptions". For one thing, you are attaching an operation to a table or set. Alpha thus knows which table to use and the recorded script usually begins with:

      a_tbl= table.current().

      This must be altered to run correctly as a "standalone". You will have to tell Alpha which table to use.

      A_tbl = table.open("yourtablenameinquotes")

      substituted for the original line should do the trick.
      There can be only one.

      Comment


        #4
        RE: script recorder

        Thanks Stan, I'll try it right after dinner.

        Ed

        Comment


          #5
          RE: script recorder

          I get an error when it runs, so i converted it to xbasic and it looks like this:

          DIM ax_choice as C
          DIM ax_response as N
          DIM ax_dialog as P


          ON ERROR GOTO ax_error_trap
          DIM ax_error_trap_desc as C
          DIM ax_error_trap_offset as C
          DIM ax_error_trap_msg as C
          DIM ax_error_trap_response as N

          ax_error_trap_desc = "Action Script"
          ax_error_trap_offset = "0"
          ax_error_trap_desc = "Run Script old_year"
          ax_error_trap_offset = "1"
          script_play("old_year")

          END
          ax_error_trap:
          ax_error_trap_msg = "Trapped error in action command: [" + ax_error_trap_offset + "] " + chr(13) + chr(13) + "Command: " + ax_error_trap_desc + chr(13) + "Error: " + error_text_get()
          ax_error_trap_response = ui_msg_box("Action Program Error", ax_error_trap_msg, 2)
          IF ax_error_trap_response = 4 THEN ''Retry
          RESUME 0
          ELSEIF ax_error_trap_response = 5 THEN ''Ignore
          RESUME NEXT
          ELSE ''Abort
          END
          END IF
          ''****
          ''**** End

          Comment


            #6
            RE: script recorder

            That's the high-level xbasic. Just a lot of error trapping and the one operative line is:

            script_play("old_year").

            You'll have to show us the code from the script "old_year" which you should find under the code tab.
            There can be only one.

            Comment


              #7
              RE: script recorder

              Hopefully the attached is the script to copy records from
              one data base to a new one and then rename the new one to
              the appropriate year.

              a_tbl = table.current()
              query.order = "LASTNAME+FIRS_NAM+MIDINIT"
              query.filter = "CYEAR(VAR->ASKD_SAVE_WHICH_YEAR_)=SUBSTR(DATEPAID,7,4)"
              query.options = "I"
              a_tbl.query_create()
              copy.set = ""
              copy.db = "c:program filesa5v4uniontest.dbf"
              copy.dd = .F.
              copy.delete_o_dd = .F.
              copy.records = .T.
              copy.fields = 10
              copy.field1 = "Lastname"
              copy.field2 = "Datepaid"
              copy.field3 = "Duespaid"
              copy.field4 = "Assesspaid"
              copy.field5 = "Percent"
              copy.field6 = "Trade"
              copy.field7 = "Dues"
              copy.field8 = "Firs_Nam"
              copy.field9 = "Midinit"
              copy.field10 = "Dept_Num"
              a_tbl.copy()
              a_tbl = table.open( "c:program filesa5v4uniontest.dbf" , FILE_RW_EXCLUSIVE )
              a_tbl.rename( "1999" )
              a_tbl.close()

              when the script is run from a button, it gives an
              "arguement is incorrect data" message.

              BTW, datepaid is a character field.

              Comment


                #8
                RE: script recorder

                Please refer to my first reply. As a saved operation, designed and attached to a specific table, this would perform as desired. As a script the:

                a_tbl = table.current()

                can cause problems. If the script is attached to the onpush of a button on a form for a table which is not the table you intend the operation to affect, then the script could fail at several points.

                Change this line to:

                a_tbl = table.open("putyourtablenamehere") and all should be well.

                Stan
                There can be only one.

                Comment


                  #9
                  RE: script recorder

                  Stan I had posted the old version of, I already have changed that first line to the proper path and dues.dbf. I also changed the next to the last line to read ....
                  a_tbl.rename(cyear(date())-1)
                  Thanks for your interest,
                  ED

                  Comment


                    #10
                    RE: script recorder

                    Now it says .... a_tbl.query_create() ..not found.
                    Should I change line 4 to read query.options=""

                    Ed

                    Comment


                      #11
                      RE: script recorder

                      Stan with the first line changed to C:program filesa5v4uniondues.dbf the message box for the ask variable does not come up, that's probably why a_tbl.query_create() cannot be found. I changed it back to a-tbl=table.current(), now the message box comes up for the date, but I get .... Error: incorrect data type. hrmphhhh

                      Ed

                      Comment


                        #12
                        RE: script recorder

                        The only thing I see is that the order of evaluation of the askd_ might cause problems.

                        I think I would have said:

                        "SUBSTR(DATEPAID,7,4)=CYEAR(VAR->ASKD_SAVE_WHICH_YEAR_)"
                        or
                        "right(DATEPAID,4)=CYEAR(VAR->ASKD_SAVE_WHICH_YEAR_)"

                        You might also try taking care of the askd_ "before" using it in the filter ala:

                        a_tbl = table.open("tablename")
                        myyear = CYEAR(VAR->ASKD_SAVE_WHICH_YEAR_)
                        query.order = "LASTNAME+FIRS_NAM+MIDINIT"
                        query.filter = "SUBSTR(DATEPAID,7,4)=myyear"
                        query.options = "I"


                        Hope this helps.
                        There can be only one.

                        Comment


                          #13
                          RE: script recorder

                          Ok Guys, I got this working with one minor problem:

                          a_tbl = table.open("1999_1.dbf") 'opens table to work on
                          myyear = (var->askc_save which_year_) 'sets variable to users entry (char)
                          query.order = "lastname+firs_nam+midinit" 'sets ordering
                          query.filter = "substr(datepaid,7,4) = myyear" 'accepts only a match between field and users entry
                          query.options = "I" 'no idea
                          a_tbl.query_create() 'creates the query to match the filter
                          copy.set = "" 'no idea
                          copy.db = "c:program filesa5v4uniontest.dbf" 'sets name for result dbf
                          copy.dd = .F. 'do not copy dictionary
                          copy.delete_o_dd = .F. 'no idea
                          copy.records = .T. 'copy according to the following info
                          copy.fields = 10 'number of fields to copy
                          copy.field1 = "Lastname" 'copy designated field to new dbf
                          copy.field2 = "Datepaid" ' "
                          copy.field3 = "Duespaid" ' "
                          copy.field4 = "Assesspaid" '"
                          copy.field5 = "Percent" ' "
                          copy.field6 = "Trade" ' "
                          copy.field7 = "Dues" ' "
                          copy.field8 = "Firs_Nam" ' "
                          copy.field9 = "Midinit" ' "
                          copy.field10 = "Dept_Num" ' "
                          a_tbl.copy() ' complete the copy
                          a_tbl.close() ' close the table
                          a_tbl = table.open( "c:program filesa5v4uniontest.dbf" , FILE_RW_EXCLUSIVE ) ' reopen the table
                          a_tbl.rename(myyear) ' rename the table to users entry in the message box
                          a_tbl.close() 'close the table

                          After I run the script it is necessary to go into the
                          control panel, select "tables/sets" , right click in the white area, select "1999" (which was entered in the ask variable, and click OK.

                          Is there something that could be added to the script that would do this automatically?

                          Thanks again,
                          Ed

                          BTW, in trying to learn what is going on in basic, I have
                          tried to annotate the script, would like you to comment on it.

                          Comment


                            #14
                            RE: script recorder

                            The command you want is

                            file_add_to_db("c:\The path\to your\1999.dbf")

                            I don't find this in the online documentation so it must be in the update readme.

                            You commenting is fine, if extreme. But then extreme, like beauty, is in the eye of the beholder. If it works for you, and helps you remember later what you have done, go with it.
                            There can be only one.

                            Comment


                              #15
                              RE: script recorder

                              That makes me feel real good, Stan. If it is not documented, how did you find it?

                              Thanks again,
                              ED

                              Comment

                              Working...
                              X