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

Running an Import operation on the A5 web

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

    Running an Import operation on the A5 web

    I searched the message board, but I didn't find a clear direction on how to do that, first is that possible ?
    I have the operation created on the desktop, but I would like to invoke from the web application.

    If it's, what is the starting point?


    any help is appreciated.

    #2
    Re: Running an Import operation on the A5 web

    One way to start is to create an import operation on the desktop. The xbasic code that is produced can be easily adapted to work in a web page. Just remove any user interface code which will not work on a web page. Search the forums for upload files and you will find posts on how to use a dialog component to browse and upload a file. Steve Wood had several excellent posts where he details how to build an upload component, dialog or grid.

    Steve

    Comment


      #3
      Re: Running an Import operation on the A5 web

      Thanks Steve. Let me do the search and I'll give it a shot.

      Comment


        #4
        Re: Running an Import operation on the A5 web

        Let me know if you need to see a sample. I have several based on Steve Wood's suggestions. For my application the user uploads a csv file from another system that confirms to a structure that I desgned for the Alpha application. They can name it anything they like as my code renames the file to what my code looks for. I also do scan to make sure the a certain field name is present to insure it is the right file. Once it checks out the import process runs which comes right from xbasic script produced under the desktop.

        Steve

        Comment


          #5
          Re: Running an Import operation on the A5 web

          I would greatly appreciate a sample, it should be easier to follow.

          Comment


            #6
            Re: Running an Import operation on the A5 web

            First read this post by Steve Wood. You will be creating a component that will work in conjunction with Xbasic on the web page. I have posted one of my upload pages. In this case the user is importing a csv file produced by another application.

            http://msgboard.alphasoftware.com/al...ht=upload+file

            What follows is code from the page. Make careful of of the extra line of code you will need to placed in the section of page code that begins with the line
            Delete tmpl_upload

            Code:
            <%A5  
            	if eval_valid("submitButton")then
            	    
            
             	file.from_blob("c:\A5Webroot\\" + FileToUpload.filename, FileToUpload.data)
                
            	result = file.exists("bio.txt")
            
            	
            	if result = .T. then	
            
            		file.remove("bio.txt")
            	end if
            	
            file.rename(filetoupload.filename, "bio.txt")
            ' Check to make sure this is a BIO file
            
            	dim scanner as P
            	dim fbuffer as C
            	fbuffer = file.to_string("c:\a5webroot\bio.txt")
            
            
            	scanner = stringscanner.create(fbuffer)
            	if scanner.skiptostringi("Gender")=.t. then
              
            		?filetoupload.filename
            	'import data to bio table
            
            		a_tbl2 = table.open("[PathAlias.ADB_Path]\bio")
            
            		a_tbl2.delete_range(".T.")
            		a_tbl2.pack()
            		a_tbl2.close()
            
            
            
            
            		temporary_import_table = file.temp_path_get()+ "bio_temp_table.dbf"
            		import_destination_table = "[PathAlias.ADB_Path]\bio"
            
            		import_filename = filename_decode("[PathAlias.ADB_Path]\bio.txt")
            
            		import.type = 0
            		import.names = "use"
            		import.file = import_filename
            		import.db = temporary_import_table
            		import.skip_lines = 0
            		import.skip_bytes = 0
            		import.field_sep = ","
            		import.record_sep = "<CR>"
            		import.text_qualifier = "\""
            		import.record_len = 96
            		import.rem_blanks = .F.
            		import.escape_newlines = .F.
            		import.fields = 8
            		import.field1 = "studentid,n,0,10,0"
            		import.field2 = "studentlastname,c,1,16,0"
            		import.field3 = "studentfirstname,c,2,11,0"
            		import.field4 = "studentmiddlename,c,3,10,0"
            		import.field5 = "gradyear,n,4,5,0"
            		import.field6 = "gender,c,5,1,0"
            		import.field7 = "birthyrmoday,n,6,9,0"
            		import.field8 = "grade,n,7,3,0"
            		import()
            
            
            		a_tbl3 = table.open(import_destination_table)
            		append.t_db = temporary_import_table
            		append.m_key = ""
            		append.t_key = ""
            		append.m_filter = ""
            		append.t_filter = ""
            		append.type = "All"
            		append.m_count = 8
            		append.m_field1 = "STUDENTID"
            		append.m_exp1 = "@bio_temp_table->STUDENTID"
            		append.m_field2 = "STUDENTLASTNAME"
            		append.m_exp2 = "@bio_temp_table->STUDENTLASTNAME"
            		append.m_field3 = "STUDENTFIRSTNAME"
            		append.m_exp3 = "@bio_temp_table->STUDENTFIRSTNAME"
            		append.m_field4 = "STUDENTMIDDLENAME"
            		append.m_exp4 = "@bio_temp_table->STUDENTMIDDLENAME"
            		append.m_field5 = "GRADYEAR"
            		append.m_exp5 = "@bio_temp_table->GRADYEAR"
            		append.m_field6 = "GENDER"
            		append.m_exp6 = "@bio_temp_table->GENDER"
            		append.m_field7 = "BIRTHYRMODAY"
            		append.m_exp7 = "@bio_temp_table->BIRTHYRMODAY"
            		append.m_field8 = "GRADE"
            		append.m_exp8 = "@bio_temp_table->GRADE"
            		append.t_count = 0
            
            		a_tbl3.append()
            
            	
            
            		a_tbl3.close()
            
            	      response.redirect("processing_done.a5w")
            
            
            	Else
            		response.Redirect("not_bio_file.a5w")
            	END IF
            End if
            
            
            �*** start of normal component code
            %>
            
            <html>
            <head>
            
            <%a5
            Delete tmpl_upload
            DIM tmpl_upload as P
            tmpl_upload = a5w_load_component("upload")
            'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
            'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
            'Each component on a page must have a unique alias (componentName property).
            with tmpl_upload
            	componentName = "upload"
            end with 
            '=======================================compute the HTML for the Component=======================================
            delete x_upload
            dim x_upload as p
            x_upload = a5w_run_Component(tmpl_upload)
            '=============================================================================================================
            if x_upload.RedirectURL <> "" then 
            	response.redirect(x_upload.redirectURL)
            	end
            end if 
            ?x_upload.Output.Head.JavaScript
            ?x_upload.Output.Head.CSS_Link
            
            
            � the following line needs to added to the a5w page to work in conjunction with the component
            
            
            x_upload.Output.Body.Dialog_HTML = stritran(x_upload.Output.Body.Dialog_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")
            
            
            %>
            <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
            <!--CSS for tmpl_upload -->
            <link rel="stylesheet" type="text/css" href="file:///C:/Program Files/A5V8/css/Army/style.css">
            <!--Alpha Five Temporary Code End -->
            
            <meta NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
            <title></title>
            </head>
            <body   background="jfk_background.jpg">
            
            <p>&nbsp;</p>
            
            <p>&nbsp;</p>
            
            <p>&nbsp;</p>
            
            <p>&nbsp;</p>
            
            <p>&nbsp;</p>
            
            <p>&nbsp;</p>
            
            <p><br>
            <table align=center>
            	<tr>
            		<td><%A5 ?x_upload.Output.Body.Dialog_Echo %></td>
            	</tr>
            	<tr>
            		<td><%A5 ?x_upload.Output.Body.Xbasic_Code_Errors %></td>
            	</tr>
            	<tr>
            		<td><%A5 ?x_upload.Output.Body.Dialog_HTML %></td>
            	</tr>
            </table></p>
            
            
            
            </body>
            </html>

            Comment


              #7
              Re: Running an Import operation on the A5 web

              Steve;

              I sent you a private message.

              Comment


                #8
                Re: Running an Import operation on the A5 web

                Hi,

                Does anyone have an example file I could use?

                Denis

                Comment

                Working...
                X