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

ADB file correction utility

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

    ADB file correction utility

    This script to correct the Alpha5 *.ADB file. This file is has the association to Alpha5. It is displayed with the Alpha5 icon and is the one that can be launched. This script corrects the ADB file for the currently open database.

    This file contains the list of tables in the database. Sometimes the file list tables that actually no longer exits. This will cause errors in database compact operations and can affect shadow operations.

    In my own situation my application had grown to over 130 tables. When compacting the database I found that any table deleted programmatically via a script versus the control panel was still visible in this file. Rather than manually compare all these file names I borrowed extensively from the application I am developing and produced this menu driven script.

    Altough this script uses two documented ALPHA5 commands for reading and writing the ADB file this is as they say undocumented territory proceed at your own risk.

    I would appreciate any feedback, was this useful helpful etc.

    The following links give more details on ADB file and go me started on this mornings worth of work.

    http://www.alphasoftware.com/alphafo...read.php?61580

    http://alphafivewiki.com/LOAD_ADB_DEF+Function

    http://alphafivewiki.com/SAVE_ADB_DEF+Function

    Code:
    'Date Created: 01-May-2015 11:09:10 AM
    'Last Updated: 01-May-2015 12:56:26 PM
    'Created By  : verboopa2
    'Updated By  : verboopa2
    '-----------
    'Tool-ADBfix
    '-----------
    'A program to correct the Alpha5 ADB file.
    'This file contains the list of tables and in the database
    'Sometimes the file list tables that actually no longer exits
    'This will cause errors in database compact operations and can affect shodow operation.
    'This program will list all databases files in the ADB and the ones that actually exist will be checked.
    'You can manully check and uncheck files as well.
    
    '---------------------
    '// Set Debug Flags --
    '---------------------
    DIM Debug as C = ""                                             'check debug flag with condition:  if ("m" $ Debug)
    'f - send DBF file list to trace window
    'o - send othe rstuff to trace window
    'n - DBF & DDM files not found 
    'w - write new ADB file to trace windoe instead of for real
    
    '---------------
    '// Intialize --
    '---------------
    DIM DialogTtl as C = "Tool-ADBfix"
    DIM ADBfile as C                                                'The ADB file we are editing
    DIM ADBbackup as C                                                'The backup copy of the ADBfile created when we rewrite it    
    DIM ADB as C                                                    'The ADB file contents returned by the LOAD_ADB_DEF function
    DIM ADBout as C                                                    'The modified version of ABD file written back out
    DIM LineIn    as N                                                'Number of lines in orginal version
    DIm LineOut as N                                                'Number of lines in modified version
    DIM cLine as C                                                    'character version of line read from list
    DIM DBFlist as C = ""                                            'List of DBF and DDM (data dictionary) files in database
    DIM OTHERlist as C = ""                                            'other stuff that we can edit manually and is just put back in file
    DIM DBFsel as C = ""                                            'DBF files that where verified to exist
    DIM DBFnoexist as C = ""                                        'DBF files that where not found            
    DIM Mode as N = 0                                                'Mode we are in while parsing files
                                                                    '0 = do nothing still looking for something to trigger actions
                                                                    '1 = found file name marker trigger for actual reading file names
                                                                    '2 = now reading file names
                                                                    '3 = reading other stuff include markers
    
    '--------------------------------
    '// Verify editing master copy --
    '--------------------------------
    IF A5.Get_Master_Name()                                            'Verify we are on the master installation
        ui_msg_box(DialogTtl,"Script should not be used on Shadowed installations",UI_ATTENTION_SYMBOL+UI_OK)
        end 
    end if
    
    '-------------------------------
    '// Retrieve & Parse ADB file --
    '-------------------------------
    ADBfile = A5.Get_Name()
    ADB = load_adb_def(ADBfile,1)
    LineIn = line_count(ADB)
    For each Line in ADB
        cLine = Line - ""                                            'Forced Line value into a character value from pointer value
        select                                                        'select what we do based on contents of this line
            case cLine = ":files"                                    'marker for DBF DDD files set flag next line we start adding to list
                Mode = 1
            case *leading(cLine,":")                                'some otehr marker no longer looking at DBF & DDD files
                Mode = 3
            case else
                IF Mode = 1                                            'files triggered so next line we start adding to file list
                    Mode = 2
                end if
        end select
        select
            case Mode = 2                                            'mode for adding to file list
                DBFlist = *concat_lines(DBFlist,cLine)
            case Mode = 3
                OTHERlist = *concat_lines(OTHERlist,cLine)            'other stuff we don't process just allow user to edit                        
        end select
    next
    
    '----------------------------------------
    '// determine file that actually exist --
    '----------------------------------------
    DBFlist = sortsubstr(DBFlist,crlf())                            'sort the list of files
    for each Line in DBFlist
        cLine = Line - ""                                            'Forced Line value into a character value from pointer value
        IF file.exists(cLine)                                        'does the file listed actually exist
            DBFsel = *concat_lines(DBFsel,cLine)                    'yes add to selected list
        else
            DBFnoExist = *concat_lines(DBFnoExist,cLine)            'no add it to a list for debugging and counting
        end if
    next
    CntNoExist = line_count(DBFnoExist)                                'number of DBF & DDD files that will be removed
            
    
    IF ("f" $ Debug)                                                'debugging stuff to verify we parsed correctly
        Trace.WriteLn(*concat_lines("-- DBF Files START --",DBFlist,"-- DBF Files END --"))
    end if
    IF ("o" $ Debug)
        Trace.WriteLn(*concat_lines("-- Other Stuff START --",OTHERlist,"-- Other Stuff END --"))
    end if
    IF ("n" $ Debug)
        Trace.WriteLn(*concat_lines("-- DBF Not existing START --",DBFnoExist,"-- DBF Not existing END --"))
    end if
    
    
    '-------------------------
    '// DBF List for Dialog --
    '-------------------------
    DIM Format as p                                                 'format for dbf names
    Format.tab_stops=""
    Format.odd_row_color="White"
    Format.even_row_color="Blue White"
    Format.odd_selected_color="Dark Blue"
    Format.even_selected_color="Dark Blue"
    Format.font="Arial,8"
    Format.font_color_unselected="Black"
    Format.font_color_selected="White"
    Format.lastbutton="OK"
    Format.group_size=1
    Format.number_rows=.f.
    Format.alternating_bands=.t.
    
    TempList = a5_owner_draw_list_fmt(DBFlist,Format)                'Format into something for selection dialog
    DIM aDBFlist[line_count(TempList)] as C
    aDBFlist.initialize(TempList)
    
    
    '----------------------------
    '// Put up the edit dialog --
    '----------------------------
    DIM Result as C
    DIM Dialog as C
    Dialog =<<%dlg%
    {region}
    {wrap=75}
    A script to correct the Alpha5 ADB file.;
    This file contains the list of tables in the database.;
    Sometimes the file list tables that actually no longer exits.;
    This will cause errors in database compact operations and can affect shadow operations.;
    {endregion};
    {line=1,0};
    {region}
    {wrap=75}
    Select Tables to place in ADB. Tables that exist are already checked. Tables that do not exist are NOT checked. You can manually alter the selected tables.;
    Number of Tables NOT found: [%r%.5CntNoExist];
    [%d;O={@@}%.75,20DBFSel^$$aDBFlist];
    {endregion};
    {region}
    Other Information, can be edited. Do not alter markers, they are not reproduced.;
    [%mw%.75,10OtherList]
    {endregion};
    {line=1,0};
    {region}
    <&Save Changes back to ADB file!save> <*&Exit!exit>
    {endregion};
    %dlg%
    
    '-- Simple call of dialog --
    Result = ui_dlg_box(DialogTtl,Dialog)                            'present Dialog
    if Result <>"save" then                                            'do we proceed
        end
    end if
    
    '------------------------
    '// Make backup of ADB --
    '------------------------
    ADBbackup = get_unique_filename(ADBfile)                        'get unique backup file name    
    File.Copy(ADBfile,ADBbackup)                                    'copy existing ADB file to backup file    
    IF .NOT. file.exists(ADBbackup)                                    'verify backup copy worked
        ui_msg_box(DialogTtl,"Creation of ADB backup file failed",UI_ATTENTION_SYMBOL+UI_OK)
        end 
    end if
    
    ADBout = *concat_lines(":Files",DBFsel,Otherlist)                'reformat information for new ADB
    LineOut = line_count(ADBout)                                    'how many lines in new ADB gives indication of size change
    
    IF ("w" $ Debug)                                                'final debug option to see new file before we write it out
        Trace.WriteLn(*concat_lines("-- new ADB START --",ADBout,"-- new ADB END --"))
    else
        SAVE_ADB_DEF(ADBfile,ADBout)
    end if
                                                                    'prepare and present summary message
    Mess =<<%txt%    
    Updated Alpha5 Database (ADB) file: 
    {ADBfile}
    Orginal had {LineIn} lines.
    Now has {LineOut} lines.
    Orginal Database file backed up to:
    {ADBbackup}
    %txt%
    ui_msg_box(DialogTtl,evaluate_string(Mess),UI_OK)
    end
Working...
X