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

Dictionary.Update does not perform as File Compact

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

    Dictionary.Update does not perform as File Compact

    As farr as I know Dictionary.update should perform the same operation as File Compact.

    I have a separate application that performs only update operation during office off hour as follows.

    This script is an autoexec

    'This will copy some tables from WINAVA to AVANTAGE
    'and change the names of the tables
    ---------------------------------------
    file_copy("D:|apps|winava|avantage|avava|client.dbf","D:|apps|avantage|vaclient.dbf")
    file_copy("D:|apps|winava|avantage|avava|fourni.dbf","D:|apps|avantage|vafourni.dbf")
    file_copy("D:|apps|winava|avantage|avatv|client.dbf","D:|apps|avantage|tvclient.dbf")
    file_copy("D:|apps|winava|avantage|avatv|fourni.dbf","D:|apps|avantage|tvfourni.dbf")
    file_copy("D:|pps|winava|avantage|avava|factma.dbf","D:|apps|avantage|vafactma.dbf")
    file_copy("D:|apps|winava|avantage|avava|pybbil.dbf","D:|apps|avantage|vapybbil.dbf")

    '-------------------------------
    'This will reconstitute the accented characters
    'in three tables
    '-----------------------------

    tbl = table.open("vaclient")
    update.fields = 3
    update.field1 = "cnom"
    update.expr1 = "oem_to_ansi(cnom)"
    update.field2 = "cadr"
    update.expr2 = "oem_to_ansi(cadr)"
    update.field3 = "cvil"
    update.expr3 = "oem_to_ansi(cvil)"
    tbl.update()

    tbl = table.open("vafourni")
    update.fields = 3
    update.field1 = "fnom"
    update.expr1 = "oem_to_ansi(fnom)"
    update.field2 = "fadr"
    update.expr2 = "oem_to_ansi(fadr)"
    update.field3 = "fvil"
    update.expr3 = "oem_to_ansi(fvil)"
    tbl.update()

    tbl = table.open("vafactma")
    update.fields = 3
    update.field1 = "ffcnom"
    update.expr1 = "oem_to_ansi(ffcnom)"
    update.field2 = "ffcadr"
    update.expr2 = "oem_to_ansi(ffcadr)"
    update.field3 = "ffcvil"
    update.expr3 = "oem_to_ansi(ffcvil)"
    tbl.update()

    'This should perform the same as File Compact on LVA
    '---------------------------------------------

    dictionary.update("D:appsavantage*.dbf")
    dictionary.update("D:appsavantage*.ddd")
    dictionary.update("D:appslva*.dbf")
    dictionary.update("D:appslva*.ddd")
    dictionary.update("D:appslva*.set")
    a5.close()

    Note: "|" = backslash

    The files in D:|apps|avantage| are the lookup tables for
    D:|apps|lva|

    From a remote station, after the update operation is completed, if I look directly at the tables all the new records have been transfered correctly, all the accented characters are correct, but when I use the lookup operation from a field in a form, the new records are not available.

    Then if I perform a File Compact the lookup operation works fine and all records are available.

    I guess I am missing something when I do the Dictionary.update

    Should I update other files than only the "DBF", "DDD", and "SET" ?

    Thanks


    #2
    RE: Dictionary.Update does not perform as File Com

    I forgot some of the "|"


    'This should perform the same as File Compact on LVA
    '---------------------------------------------

    dictionary.update("D:|apps|avantage*.dbf")
    dictionary.update("D:|apps|avantage*.ddd")
    dictionary.update("D:|apps|lva*.dbf")
    dictionary.update("D:|apps|lva*.ddd")
    dictionary.update("D:|apps|lva*.set")
    a5.close()

    Sorry

    JP

    Comment


      #3
      RE: Dictionary.Update does not perform as File Com

      Syntax:

      Dictionary.update(Data Dictionary Filename)

      not table name. Only the .ddd, .ddx, .ddm, .set, .sex, and .sem files are dictionary files. I think you need to obtain a pointer and .pack() as well as update the dictionaries.
      There can be only one.

      Comment


        #4
        RE: Dictionary.Update does not perform as File Com

        Many thanks Stan,

        I knew someone would rescue me. I will try your suggestion.

        Thanks again

        Regards

        JP

        Comment


          #5
          RE: Dictionary.Update does not perform as File Com

          Stan,

          With your permission,I have another question.

          Is there a way to write a script equivalent to the File Compact command without having to write a complex script with several lines of command.

          I guess it would be much easier and simpler.

          From the help file if you look at "Dictionary.update" we can read:

          ....."For instance, the following Xbasic statements are valid:
          dictionary.update("c:a5samples*.dbf") ' update all Dictionaries..."

          Why is it necessary to write a script to update all the
          ddd, .ddx, .ddm, .set, .sex, and .sem files separately?

          The manual is not very clear on that subject.

          Thanks

          JP

          Comment


            #6
            RE: Dictionary.Update does not perform as File Com

            This is such a wonderful place to learn and explore. Reading further, the documentation states:

            Performs maintenance on the specified Data Dictionary Filename, making the
            data dictionary more compact and efficient. You can use this function with table
            (*.DDD), or set (*.SET) dictionaries.

            Then:

            Alpha Five Xbasic Reference Manual 309

            For instance, the following Xbasic statements are valid:
            dictionary.update("c:a5samples*.dbf") ' update all
            Dictionaries...
            dictionary.update("c:a5samples*.set") ' update all Sets...
            dictionary.update("c:a5datainven???.set") ' update the
            Inventory set

            There must be a misprint here. I believe the line should read --

            dictionary.update("c:a5samples*.ddd") ' update all
            Dictionaries...

            I was quoting from an old Ver3 printed manual when I stated that the other .XXX files were dictionary files.

            I still believe the statement about obtaining the pointer and packing to be correct.
            There can be only one.

            Comment


              #7
              RE: Dictionary.Update does not perform as File Com

              Here is a function I created that will compact every table, set, and database dictionary file in the application directory. If a dictionary can't be updated, an error list will be generated.

              function Compact as N()

              '/// Result = 0 - Compacted all files
              '/// result = 1 - Error occured
              dim response as n
              dim files as p
              dim filename as c
              dim file_count as n

              file_count = 0

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.alb")
              while .not. files.eof()
              file_count = file_count + 1
              files.next()
              end while

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.dbf")
              while .not. files.eof()
              file_count = file_count + 1
              files.next()
              end while

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.set")
              while .not. files.eof()
              file_count = file_count + 1
              files.next()
              end while

              dim err_tbl(file_count) as c

              i = 0

              compact = 0
              msg = "This is a file maintenance process that will clean up file support data. It will remove references to unused actions, forms, reports, etc. This process may take a little time. Please wait for message confirming process is complete."
              response=ui_msg_box("Compact Support Files",msg+chr(13)+chr(13)+"Do you want to continue?",ui_question_symbol+ui_yes_no)
              if response=ui_yes_selected
              else
              end
              end if

              on error goto problemfound

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.alb")
              while .not. files.eof()
              filename=files.name()
              dictionary.update(filename)
              files.next()
              end while

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.dbf")
              while .not. files.eof()
              filename=files.name()
              dictionary.update(filename)
              files.next()
              end while

              files=filefind.first(:A5.Get_Path()+Chr(92)+"*.set")
              while .not. files.eof()
              filename=files.name()
              dictionary.update(filename)
              files.next()
              end while

              if i > 0
              ui_get_list_array("Files that could not be Compacted",1,"err_tbl")
              else
              ui_msg_box("Compact Files","All files Compacted successfully!",UI_INFORMATION_SYMBOL)
              end if
              end function

              problemfound:
              i = i + 1
              err_tbl(i) = filename(filename)
              compact = 1
              resume next

              end

              Jerry

              Comment


                #8
                RE: Dictionary.Update does not perform as File Com

                Thanks to both of you Jerry and Stan,

                I will try to digest all that information and make sure I will not crash my application.

                I will keep you posted about the results.

                Thanks again and best regards

                JP

                Comment


                  #9
                  RE: Dictionary.Update does not perform as File Com

                  Jerry,

                  Works better for me substituting

                  err_tbl(i) = filename

                  for

                  err_tbl(i) = filename(filename)
                  There can be only one.

                  Comment


                    #10
                    RE: Dictionary.Update does not perform as File Com

                    I'd like to "highlight" / "point out" the area in Jerry's script that compacts the ".alb" file. This compacts all those changes to global scripts. I don't know about the rest of you but I've seen my .al* files get pretty large after all the changes I make.

                    Also, here's another hint. (I'd put it on the tips site but it may be a bit too advanced.) If you set up a routine that allows you to only compact one table at a time, you can keep the file dates on unchanged tables equal to the last time that table was compacted. This allows me to send only those files that are really necessary for a customer update and, by only sending the latest updates, upload time is reduced (I often use pcAnywhere because most clients aren't capable of reliably updating the files) and the 'old' dictionary files on my computer will still have the same date as my clients'.

                    Comment


                      #11
                      RE: Dictionary.Update does not perform as File Com

                      Jerry and Stan,
                      I tried the script on the Sample Invoice application and I am getting an error message:

                      I named the script "Update"

                      Script: Update line:76
                      err_tbl(i)=filename
                      filename not found

                      I simply copy and paste the script, without changing anything except what Stan suggested.

                      I tried with the original "err_tbl(i)=filename (filemane)" without success.

                      I am not very knowledgable with X Basic and I do not see were the error is.

                      I do not want to bug you with all my questions but I would appreciate some clarification.

                      Thanks

                      JP

                      Comment


                        #12
                        RE: Dictionary.Update does not perform as File Com

                        Yep, you are right. I forgot that I used another udf in the code. I called the function filename(). It strips out any path information and leaves just the name of the file. Without this function, the compact function or script will fail. The code is below.

                        function Filename as C(FileName_with_path as C)

                        if alltrim(filename_with_path) = ""
                        filename = ""
                        exit function
                        end if
                        filename = filename_with_path

                        pos = at(chr(92),filename,-1)
                        if pos > 0
                        filename = substr(filename,pos+1)
                        end if
                        end function


                        Sorry I missed this. I wrote the code some time ago.

                        Jerry

                        Comment


                          #13
                          RE: Dictionary.Update does not perform as File Com

                          Wasn't complaining, nice code.
                          There can be only one.

                          Comment


                            #14
                            RE: Dictionary.Update does not perform as File Com

                            JP

                            Don't save it as a script, it's a function. Create a new function (same as you would a script) named "Compact", paste in the code.

                            Then when you want to use it, code an xbasic line:

                            result = Compact()Stan
                            There can be only one.

                            Comment


                              #15
                              RE: Dictionary.Update does not perform as File Com

                              Thanks Stan,

                              One of these days I am going to learn.

                              Thanks again for taking the time.

                              Regards

                              JP

                              Comment

                              Working...
                              X