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

Export routine ideas needed

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

    Export routine ideas needed

    Here is my problem: My rather novice users need to be able to create an export file (excel or text) with fields they select. The problem with using the export genie is twofold: (1) There are around 200 fields whereas the ones they would ever need to select from is no more than 20, and (2) a good many of those 20 have somewhat obscure field names that these users will not understand without some help (examples: �S_addr,� �C_Addr,� �Alt_Addr� and �M_Addr�).

    So my thought was that I would put just those 20 fields on a form or in an xdialog with more descriptive titles for what the field really is, along with a checkbox for selecting the fields to be included in the export. Then the user would click a button that would run a script which would build and run a custom xbasic export script.

    I know I can create an xbasic script that will build another rather complex script and run it because I have done it (see my Automatic Printer Overrides in Learnalpha.com). But it can be a lot of work, so I am hoping someone else has done something along the lines of what I am trying to do. Of course a working sample would be fantastic but probably too much to hope for. Any thoughts, suggestions or cautions would be greatly appreciated.

    Ray Lyons


    #2
    Ray,

    As you probably already know, there are many ways to tackle this using arrays and lists. Since the only purpose for this field list is to select the ones the user wants for the export a quick and dirty way could be to create a XDialog with a multi select list box or check box if you prefer. Manually enter the field names and include lets say 20 spaces(you would need to adjust this) then a delimiter and the actual field name. So your field list would look something like:

    Code:
    Address                                   ^S_addr
    Alternate Address                         ^Alt_Addr
    ... and so on
    When you set the width of your list box on your dialog make sure its less then the carrot or what ever delimiter you choose so it will not show on the list.

    Then you can just parse the selection(s) by using WORD().

    And here's your example:

    Code:
    'Create an XDialog dialog box with a check box - list box
    DIM  vxfld_list as C
    DIM  varC_result as C
    DELETE a_vxfld_list		
    DIM a_vxfld_list[2] as c
    dim temp_list as c 
    temp_list = <<%list%
    Address                                         ^S_addr
    Alternate Address                               ^Alt_Addr
    %list%
    
    a_vxfld_list.initialize(temp_list)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Export Fields",<<%dlg%
    {region}
    Select Fields to Export:| [.35,5vxfld_list^$$a_vxfld_list];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    
    IF varC_result <> OK THEN
    	end
    END IF
    
    'Parse vxfld_list
    kount = w_count(vxfld_list,crlf())
    FOR i = 1 TO kount
    	vfld = word(word(vxfld_list,i,crlf()),2,"^")
    	'Do what ever you need to now that you have the actual field name
    NEXT i
    Hope this helps,

    Scott
    Last edited by Scott Emerick; 10-08-2005, 05:35 PM.

    Comment


      #3
      Ray, beware of permitting so many to be set that the length of the resulting query expression blows past the max expression length (which I think is 1024 chars).

      I've found that with a bit of training on the use of query by form operators my customers prefer using QBF.

      -- tom

      Comment


        #4
        Scott,

        Sorry for taking so long to get back to this but I have been very busy. Although I like the idea of an xdialog, and I am reasonably sure examples of actual field data could be added for each field (which I did not think of in the original post), I think it would be a lot easier to add the examples using a form and some variables.

        The harder part would be generating the export script. Hard but do-able, I believe, if I ever get the time.

        Then there is another part I did not mention and is probably impossible, which would be to use my descriptive field names for the fields instead of the actual field names for the first row of the Excel file. I don�t think the A5 excel export function has any way to do this. It could probably be done using an ASCII export that would be imported into excel with macros, but that I have no interest in messing around that much with excel macros. Actually, I do not even want the user to have to use ms excel in the first place�just an excel file.

        Anyway, thanks for the xdialog example.

        Ray

        Comment


          #5
          Originally posted by Raymond Lyons
          I don�t think the A5 excel export function has any way to do this. It could probably be done using an ASCII export that would be imported into excel with macros, but that I have no interest in messing around that much with excel macros. Actually, I do not even want the user to have to use ms excel in the first place�just an excel file.Ray
          I'm pretty sure Excel will handle a properly formatted ASCII file without requiring a macro. (It may or may not put up a wizard, depend on whether or not it can figure out what it needs on its own.) An ASCII file has the advantage of being usable by just about any program that imports data.

          Comment


            #6
            I have something setup, that might help you. It is a form that lets you check off the fields that you want exported to an excel spreadsheet. Based upon the selections, it exports what the user needs.

            I will try and get the code and form pasted as an attachment in a few days...If your interested?

            Comment


              #7
              Blake, I am sure Excel will handle the ASCII import just fine (actually I assume it would, as I do not use Excel), but the last kicker I threw in using something other than the dbf field names as the first row in the excel table. That I think would require an excel macro and I don't think there is any way to do it on the A5 side.

              Ray

              Comment


                #8
                Sparky,

                YES!!! That's exactly what I am looking for. I assume the form part is easy. I'll be very interested to see how you did the rest of it. My thought was to generate and run an export script (which I know how to do and which I have shared in Learnalpha.com), but I was just hoping to save myself some time that I do not have right now. Besides your solution may go a different and perhaps better route. In any case, I'm waiting!

                Ray

                Comment


                  #9
                  Originally posted by Raymond Lyons
                  Blake, I am sure Excel will handle the ASCII import just fine (actually I assume it would, as I do not use Excel), but the last kicker I threw in using something other than the dbf field names as the first row in the excel table. That I think would require an excel macro and I don't think there is any way to do it on the A5 side.Ray
                  Maybe I'm missing something but wouldn't you just do this (this is paste-able into the interactive window):

                  Code:
                  tbl = table.open("xJobBase")
                  list = tbl.field_name_get() 
                  'you would use whatever alternate names you wanted here
                  'perhaps by enumerating over columns in a browse
                  cc = ""
                  tab = chr(9)
                  for i = 1 to w_count(list,crlf())
                  #cc = cc + iif(cc="", "", tab) + word(list, i, crlf())
                  #next
                  cc = cc + crlf()
                  tbl.fetch_first()
                  while .not. tbl.fetch_eof()
                  #cc2 = ""
                  #for i = 1 to w_count(list,crlf())
                  #cc2 = cc2 + iif(cc2="", "", tab) + tbl.field_get(word(list, i, crlf())).value_get()
                  #next i
                  #cc = cc + crlf() + cc2
                  #tbl.fetch_next()
                  #end while
                  file.from_string("c:\dump.txt", cc)

                  Comment


                    #10
                    I can't seem to make your code work with my test table.

                    There seems to be some problem with that line:

                    #cc = cc + iif(cc="", ....and so on. Maybe other things as well.

                    Ray

                    Comment

                    Working...
                    X