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

LOAD.ADB.DEF()

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

    LOAD.ADB.DEF()

    Found this function, dont get any thing to return.

    Syntax: load_adb_def(database_name,mode)
    Returns a string (if mode is 0) containing all .dbf names
    in the requested database.

    Tried it as follows
    Attached a button to my primary meny, which is attached to "control.dbf"

    OnPush:
    dim text as c
    text = load_adb_def("AP.adb",0)
    trace.writeln(text)

    "text" appears to be empty, does not write to trace window.
    Also tried ui_msg_box, box was empty.

    Has anyone else tried this ? Did you make it work ?
    I am trying to use this to get all .dbf names in an .adb,
    parse this and possibly use the list/array to re-index all files in the .adb.

    Thanks
    Lowell

    #2
    RE: LOAD.ADB.DEF()

    Haven't used "load_abd_def()" but the manual specifies that Database name must include full drive/path information. Try it again with the full path.

    -Barry

    Comment


      #3
      RE: LOAD.ADB.DEF()

      It didn't work for me either.

      Comment


        #4
        RE: LOAD.ADB.DEF()

        Lowell,

        IF you put the complete path in it will work...

        ''XBasic
        path=A_DB_CURRENT_PATH
        string = load_adb_def(path+"your.adb", 0)
        :trace.writeln(string)

        Comment


          #5
          RE: LOAD.ADB.DEF()

          string = load_adb_def("c:indsteedtestit.adb",0)
          trace.writeln(string)
          end

          The above worked for me on that particular application. However I tried it on another much larger application and the trace command bombed with an incorrect error type.Mine did not work unless path and file were in quotes.The string that was returned included both sets and files.

          "parse this and possibly use the list/array to re-index all files in the .adb."

          I may be wrong but I believe that compacting the database in addition to getting rid of deleted records will rebuild all indexes.

          Comment


            #6
            RE: LOAD.ADB.DEF()

            Mine runs without error if I use a valid .adb name, whether or not the full path is included. It just doesn't return any data.

            However, if I put an invalid name in, I, like you, get a completely bogus error that the data type is incorrect in the trace line.

            This is a large application.

            By the way, I don't think that compacting re-indexes. It is similar to a pack on a normal data base - see "dictionary.update().

            Thanks
            Lowell

            Comment


              #7
              RE: LOAD.ADB.DEF()

              To the best of my knowledge:

              Pack packs a table(surprise);

              Reindex rebuilds its indexes;

              Compact does both of the above (to all tables in the database) and also packs the database's dictionary files. These, too, are tables so a pack on them removes deleted layouts etc.

              Bill
              Bill Hanigsberg

              Comment


                #8
                RE: LOAD.ADB.DEF()

                Lowell,

                I use the following to list to a text file all of the table names in a database. You can substitute several other nouns for the "table" in the A5.table_enum(), like browse, report, etc. You would need to modify the absolute reference for the file to "save to" (in red). You could attach this to a button. I think the script is loosely based on an example in the online documentation.

                Stan

                Dim fnames[1000] as c

                Fil_name = :A5.table_enum("")
                If fil_name "" then
                I = 1
                WHILE fil_name ""
                Fnames[I] = fil_name
                filename="c:cwdbfiles.txt"
                result=file.exists(filename)
                IF result=.F. THEN
                answer=ui_msg_box(" ","File does not exist. Create a new one?",4)
                IF answer=7 THEN
                END
                END IF
                file_pointer=file.create(filename,FILE_RW_EXCLUSIVE)
                file_pointer.flush()
                file_pointer.close()
                END IF
                file1_pointer=file.open(filename,FILE_RW_EXCLUSIVE)
                last=file1_pointer.bytes_get()
                file1_pointer.seek(last)
                file1_pointer.write_line(fnames[I])
                file1_pointer.flush()
                file1_pointer.close()
                Fil_name = :A5.table_enum(fil_name)
                I=I+1
                END WHILE
                end if


                end
                There can be only one.

                Comment


                  #9
                  RE: LOAD.ADB.DEF()

                  Stan, this looks as if it should what I want. I'll give it a try.

                  Thanks
                  Lowell

                  Comment


                    #10
                    RE: LOAD.ADB.DEF()

                    Stan -
                    I was able to do what I wanted by using :A5.table.enum()
                    Thanks for the tip.

                    I have created a global script which will run from any
                    form (in the current .adb) , select each table, and re-
                    index it.

                    ie.;
                    Fil_name = :A5.table.enum("")

                    while fil_name ""
                    name = alltrim(fil_name)+".dbf"
                    tbl = table.open(name)
                    idx = tbl.update_production_index()
                    tbl.close()

                    fil_name = :A5.table_enum(fil_name)
                    end while

                    BUTTON1.text = "FINISHED"

                    end
                    '-----------
                    I know it needs some error checking, but it works as is.
                    I have been programming (mostly bad, I'm afraid) for over 25 years, and I am amazed at the power and elegance of this
                    program ( A5, not mine ).

                    Lowell

                    Comment


                      #11
                      RE: LOAD.ADB.DEF()

                      Think what we could acomplish if we had a good manual.
                      There can be only one.

                      Comment


                        #12
                        RE: LOAD.ADB.DEF()

                        Apparently both Compact and Pack will also re-index. I too was surprised by this but I had a customer who insisted that they solved their periodic index problems by running a "Pack" so I decided to check it out.

                        Try this:

                        Use your favorite directory lister (Explorer/DOS, whatever...) and view the dates on the CDX files. Now run a Database Compact or a Pack operation and check the dates again. Any CDX files with a previous date will now show the current date. (At least they do on my system.)

                        Why some of us old farts still like DOS:
                        If you list the cdx files in a DOS window using the DIR command and there are only a few (4-5?) files, you can then go back to the A5 window, run Compact, return to the DOS window and re-run the DIR command (push F3) and now see both the before and after results - saves you from having to write them down. And, although it may not sound like it, I find it faster than using Explorer. (No, older isn't necessarily better but it can still be useful.)

                        Comment

                        Working...
                        X