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

View non-DB tables w default form? Help

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

    View non-DB tables w default form? Help

    In converting an A5 v1 app to v4, I discovered that something I knew how to do in v1 was something I have been unable to figure out how to do in v4, namely view the contents of a table (say on a diskette) that is not in the v4 database using the table's default form. And, optionally, view it with it's default browse, all without even temporarily adding the table to the v4 database.

    It turns out that a lot of trial and error with v1 code got me very close to what I want (but not quite in that a version of the code for Button 2 for the default browse only gets me the browse attached to and last used for the table, not the default browse). In any case, it seems to me that using butchered v1 code is not a good practice for future versions of A5 in which it may not work at all. Also, the code for button 1 won't work if the path has spaces in it, such as "C:Program FilesA5v4".

    Anyone know how to accomplish what I want using v4 code?

    Ideally, I would also like to be able to specify which attached form or browse to use when I know what they are named. But using the defaults would suffice (especially when others do not exist or I do not know their names)

    The code below is taken from 2 buttons on form in an A5 v4 database (the code was originally in a v1 application). A sample database should be attached to this message.
    �********BUTTON 1, mainly sets the variable DbfName to be the path and table name
    �**of table not in the current A5 database:
    DIM Global DbfName AS C
    DIM HDHistoryDir AS C
    HDHistoryDir=A_DB_current_path+"history"
    Old_dir=dir_get()
    dir_put(HDHistoryDir)
    '**The above puts the file open in a specific path. When it doesn't exist
    �**you just go to My Computer
    DbfName=UI_GET_FILE("Open A Different History File","database(*.dbf)","","X")
    IF DbfName=""
    parent.resynch()
    end
    end if
    dir_put(Old_dir)
    ' **Display the changes on the form (just need to refresh the variable object, but...).
    parent.RESYNCH()

    �**********END OF BUTTON 1 CODE********


    �********BUTTON 2, opens the default form layout for the table selected with button 1.
    ' **Make sure the file exists. FILE_EXISTS() is true for *.dbf
    IF FILE_EXISTS( DbfName ) = .F. .OR. "*" $ DbfName
    ' Complain if the file L_NAME is bad.
    UI_MSG_BOX( "You need to select a file first.", "Unable to open: " + DbfName )
    ELSE
    ' Open the default form layout.
    CARD_SPAWN("FORM_VIEWER","SPAWNDB="+DbfName+"Default Form")
    '**The above was derived thru trial & error from the following v1 code, which does not
    �**work in v4, except possibly one time, after which the code gets automatically
    �**truncated to something that won't work.
    'CARD_SPAWN("FORM_VIEWER", "SPAWNDB=~" + DbfName + "~ SPAWNNEW=0 SPAWNCHILD=1 USE=~~")
    END IF
    END
    �************END OF CODE FOR BUTTON 2*********

    Interestingly, if you leave out the +"Default Form" in:
    CARD_SPAWN("FORM_VIEWER","SPAWNDB="+DbfName+"Default Form")
    what you get is the last used non-default form attached to the table (if there is one), not the default form. And when there is a named browse, similar code will always get you the last used named browse and never the default.

    Ray Lyons


    #2
    RE: View non-DB tables w default form? Help

    Ray:

    Here's a piece of code that opens the default form of a user's configuration table in our app.

    '============
    username=alltrim(your_name)
    user_path=app_path+"OSOMDOCS"+Chr(92)+Username

    userfile=user_path+Chr(92)+"app_user_defaults"
    f=Form.View("Default Form for app_user_defaults@"+userfile+"")
    '============

    your_name and app_path are global variables holding the user name and A5 master path respectively. App_path ends in a backslash and OSOMDOCS is an always-present subfolder of the main data folder where the data files are located. The setup is automatically created for each new user of the app. The user and workstation configuration tables are never added to the .adb.

    This is a preview of my presentation to the NY User group on Monday!

    Finian
    Finian

    Comment


      #3
      RE: View non-DB tables w default form? Help

      Thanks Finian. I will play with this, and it sounds like it will work for what I am doing. I'll probably find out, but do you happen to know

      1) can the code be modified to open a named form (when one exists and the name is known)?

      2) can one do the same thing(s) with a browse? As I stated, my butchered v1 code for a browse will NOT open the default browse but instead opens the named browse that was last opened for the table.

      Thanks again.

      Ray

      Comment


        #4
        RE: View non-DB tables w default form? Help

        1) can the code be modified to open a named form (when one exists and the name is known)?
        Do you mean can you open a named form if the table is not added to the .adb? I'm not sure, I haven't tried in that situation. A5 does keep track of form names in the .adb so it's possible that you may not be able to do it. Or it might open some times and not others.

        2) can one do the same thing(s) with a browse?
        I've never tried. I guess you could substitute "Default Browse" for "Default Form" in the code and see what happens.

        Finian
        Finian

        Comment


          #5
          RE: View non-DB tables w default form? Help

          Finian,
          Using:
          Form.View("Default Form for app_user_defaults@"+dbfname+"")

          in my button code I get the default form, and unlike my card_spawn() alternative it works even when the path has spaces in it, such C:Program Files. SO that's progress, and for forms maybe good enough. However, the saved forms (and names) are in the table's related files, so there should be a way to open them if one knows the name. But try as I may I can't make variations of your code do anything except open the default form.

          As for the using similar code with Browse.view(), it does not work even to open the default browse. My card_spawn at least does the browse too.

          My worry about both methods is that they are not supported, at least in v4. I was hoping there would be some supported method. I presume your method is undocumented and thus may or may not work in v5?? In any case, being able to view tables outside of the DB is a handy thing to be able to do. I suppose one could always bring them into the DB temporarily, but clearly that should not be necessary.

          Thanks again.

          Ray Lyons

          Comment


            #6
            RE: View non-DB tables w default form? Help

            You can temporarily add and then drop the table to/from your
            database. This works for me:

            dir_put(a5.get_path()) ' table is in application directory
            file_add_to_db("chat.dbf")
            browse.view("default browse for chat@"+a5.get_path()+chr(92)+"chat.dbf")
            file_drop_from_db("chat.dbf")

            Comment


              #7
              RE: View non-DB tables w default form? Help

              Ray:

              As I recall, I cribbed the code to open the default form from a message that (I'm pretty sure) Selwyn posted here so that was documented enough for me!

              The method for opening a form with a known name is detailed on p. 143 of my manual Form.View(FormName@Table Name) but that (I just checked) works only if the table is added to the db, even if you use the full path the the table.

              As Peter pointed out it's very easy to add and drop tables from a database so I haven't been overly concerned. In our case, the configuration tables are relatively small and I figured that the default form would be adequate for our needs. And, as the number of tables in the db heads over 200 I'm glad to have a way to keep the numbers down even if only a little.

              Finian
              Finian

              Comment

              Working...
              X