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

Run Import Silent

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

    Run Import Silent

    I need to import a user defined CSV file. I first used a stored operation but you had to specify the exact file. I then used the xbasic code and used a variable to specify the file. However when the xbasic was created it used the import() as the final command to do the import. I cannot find documentation on this command and I wish to know if there is a way to do this silently. A dialog box comes up that tells the user how many records were imported and if they want to view the resulting table and I would like them not to see this or have the option.


    So...

    Is there a way to use the built in action to import a file that the user chooses (if this is the case then you can choose to run this silently)

    if not...

    Is there a way in xbasic to run the import silently. Thanks.

    #2
    Re: Run Import Sillent

    John,

    How about import.run_silent() function ?

    from the help file:


    http://support.alphasoftware.com/alp...help/index.htm

    As far as having the user pick a file---you could have the variable set to whatever the user chooses and then run the import I would think.

    Mike
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #3
      Re: Run Import Sillent

      That function would be fine if I could get the import stored operation to accept a variable. It only accepts a hard file. If I could and someone could show me how to save the operation and have it use a variable then that would work. The import silent function is only for saved operations.

      I still have the dilemma. Thanks though

      Comment


        #4
        Re: Run Import Sillent

        John,

        Create the Import as a saved operation. Then right click on the import operation's name and choose "View Xbasic". Choose the tab to see the code without the confirmation dialog and copy that to clipboard.

        On your form in design mode create a character variable (say vImport) .

        Now place this variable on your form--drag it from the drag/drop list.
        Go into properties to make sure it is formatted to enough characters for long file structures--say 100.

        On the setup tab choose "File Select" from the drop down list (instead of the default "type-in Field).


        Place a button on the form and on it's OnPush event paste the Saved Operation you copied into either xbasic or inline xbasic (for action scripting).

        Change this line to include your variable (in this case I used vImport as the variable):
        Code:
        import_filename = filename_decode (vImport.value)

        Mike
        Mike
        __________________________________________
        It is only when we forget all our learning that we begin to know.
        It's not what you look at that matters, it's what you see.
        Henry David Thoreau
        __________________________________________



        Comment


          #5
          Re: Run Import Sillent

          Mike,

          Thanks for the response. I have done essentially exactly what you had mentioned, however, this will not run silently.

          The code works fine:import.type = 0
          import.names = "none"
          import.file = import_filename
          import.db = import_destination_table
          import.skip_lines = 3
          import.skip_bytes = 0
          import.field_sep = ","
          import.record_sep = "<CR><LF>"
          import.text_qualifier = ""
          import.record_len = 124
          import.rem_blanks = .F.
          import.escape_newlines = .F.
          import.fields = 4
          import.field1 = "region,c,0,60,0"
          import.field2 = "dealer,c,1,60,0"
          import.field3 = "town,c,2,35,0"
          import.field4 = "zip,c,3,10,0"
          import()

          I have tried the other import comands instead of the import() but to no avail and I cannot get it into the silent mode.

          Comment


            #6
            Re: Run Import Sillent

            John,

            I just created a completely silent import operation using what I described previously....well almost! I did leave out that you have to change the actual "import()" function to import.run_silent(your named import operation here). Click on the the import.run_silent() function in the editor and then right click to bring a list of operations and choose the one you want. Mine looks like this---import.run_silent("Import_Test")

            It should work as easy as it sounds.

            You could also use:

            Code:
            import.run("your import operation name", .t., .f.)
            where the .t. is for running silent.



            Mike
            Last edited by MikeC; 01-05-2007, 04:01 AM. Reason: more info
            Mike
            __________________________________________
            It is only when we forget all our learning that we begin to know.
            It's not what you look at that matters, it's what you see.
            Henry David Thoreau
            __________________________________________



            Comment


              #7
              Re: Run Import Sillent

              Mike,

              Thanks for sticking with me on this, however. if you use the import_run_silent then don't you have to use a saved operation. The saved operation does not let you put in a variable.

              Oh wait, do you mean create an xbasic operation and run that silently? Oh let me try that...

              Comment


                #8
                Re: Run Import Sillent

                :-) yep! From my prior post---convert a saved import operation into xbasic and make the changes I mentioned.


                Heading off shortly here--think you should have it now though!

                Mike
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Run Import Sillent

                  Well, I tried this, however...

                  When I tried the run_import_silent it still required a name of an operation and just ran the operation. The operation still had a hard coded file name in it so it ran that instead of the variable that i had planned. I tried just creating saved code instead and trying to run the code silently but there was no option. Sorry for the problem, but anything you can help me with would be great.

                  Comment


                    #10
                    Re: Run Import Sillent

                    John,
                    Follow Mike's instructions from earlier. I have removed the bits concerning the variable (all though there is nothing wrong with doing it that way) and use ui_get_file() directly in the code
                    Originally posted by MikeC View Post
                    John,

                    Create the Import as a saved operation. Then right click on the import operation's name and choose "View Xbasic". Choose the tab to see the code without the confirmation dialog and copy that to clipboard.


                    Place a button on the form and on it's OnPush event paste the Saved Operation you copied into either xbasic or inline xbasic (for action scripting).
                    Mike
                    Once you have the code pasted in
                    replace
                    Code:
                    import_filename = filename_decode("yourhardcodedfile.csv")
                    with
                    Code:
                    import_filename = ui_get_file("File to Import","Text(*.csv)")
                    If import_filename = "" then
                        end
                    end if
                    I have tested this and I get no confirmation dialogs. I also tested Mike's version with the select variable on a form and that also worked.

                    Nothing in the code that you posted earlier determines the confirmation dialog. The code that does that is
                    Code:
                    a5_imp_append_op_result(a_records_processed,a_records_total,"0",import_destination_table)
                    When you view the xbasic for the operation and choose the tab 'Without Confirmation Dialogs' this line should not be there.
                    Tim Kiebert
                    Eagle Creek Citrus
                    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                    Comment


                      #11
                      Re: Run Import Sillent

                      Thanks Tim for joining in...the more ways that something can be explained is always beneficial as people interpret other's ideas so differently that many times it is just a case of not completely seeing what someone is actually saying.

                      Question--doesn't the ui_get_file() make it so that it has to be a predetermined file? Seems that way to me but have never used it before...nice to be exposed to new useful functions though!


                      Mike
                      Mike
                      __________________________________________
                      It is only when we forget all our learning that we begin to know.
                      It's not what you look at that matters, it's what you see.
                      Henry David Thoreau
                      __________________________________________



                      Comment


                        #12
                        Re: Run Import Sillent

                        Originally posted by MikeC View Post
                        ....
                        Question--doesn't the ui_get_file() make it so that it has to be a predetermined file? Seems that way to me but have never used it before...nice to be exposed to new useful functions though!

                        Mike
                        Using ui_get_file() is really no different to using the file select style under object properties of a form variable. they both open a dialog to choose a file. Obviously if one is importing a file it has to be there in order to import it :) but I guess that is not what you meant. You could also store the file name in a table field, so your import would look for a file specific to the record you were currrently working with. Or the file name could be made up of the customer name or Id. Again just another way to supply the file name to the operation. I used ui_get_file() so that the code could be run independant of a form for testing purposes since the main problem was running silent as opposed to how to supply the file name.

                        The only thing that is predetermined in my use of ui_get_file() is that I told it to only look for csv file types. (since that is what John said he is importing.) This is done with the second argument. Setting this to "" will include any file type but you might as well restrict the file type to that which matches the import operation.
                        Tim Kiebert
                        Eagle Creek Citrus
                        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                        Comment


                          #13
                          Re: Run Import Silent

                          Thanks Tim. Just a matter of preferences then I guess. The added benefit to your method is to limit the user to just the file type the import operation was designed to use...something to definitely consider if and when I actually do an import myself (have never even looked at the import operation until John posted his question!). :-)


                          Mike
                          Mike
                          __________________________________________
                          It is only when we forget all our learning that we begin to know.
                          It's not what you look at that matters, it's what you see.
                          Henry David Thoreau
                          __________________________________________



                          Comment


                            #14
                            Re: Run Import Silent

                            Thanks guys, it works now. I was copying the wrong xbasic. I was not using the correct without dialog tabs. I really appreciate all the help and I learned a bunch in the process.

                            Comment


                              #15
                              Re: Run Import Sillent

                              This Illustrates in a Fun way what Mike has said below!"more ways that something can be explained is always beneficial" ain't always so...and it ain't always your fault when they cannot understand. It may be in the genes.

                              Originally posted by MikeC View Post
                              Thanks Tim for joining in...the more ways that something can be explained is always beneficial as people interpret other's ideas so differently that many times it is just a case of not completely seeing what someone is actually saying.

                              Mike
                              Last edited by SMARTII; 11-24-2009, 02:10 AM.
                              First Love

                              Comment

                              Working...
                              X