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

Getting Array elements

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

    Getting Array elements

    What am I missing, I can't seem to get the file name of a file that I've uploaded other lines of code in the same function work ok

    Code:
    function AddPolicy as v (e as p)
    'This function is called after the file(s) selected in the Upload Files dialog have been uploaded to the server.
    'The function is responsible for processing each uploaded file.
    'The passed in 'e' object contains these properties
    
    dim text2 as c
    text2 = e.fileArray[1].fileName
    save_to_file(text2, "C:\A5Webroot\Documents\Fileinfo.txt")
    
    'e.fileCount - the number of files that were uploaded
    'e.fileArray - a property array with one entry for each uploaded file
    'e.uploadProperties - Contains multiple sub-properties for all of the properties set in the Action builder.
    'e.rv  - Request variables
    'e.tmpl - pointer to the Grid definition
    'e.rtc - a pointer variable that contains run-time calculations
    'e.__si - state information
    'e.session  - session variables
    'e.rowNumber  - row number of the Grid row that has focus. If val(e.rowNumber) < 0, then it is a new record row.
    'e.part - either 'G' (for 'Grid')  or 'D' (for 'DetailView'). Test left(e.part,1) = "D" .or left(e.part,1) = "G"
    'e.primaryKeyArray - an array of primary key values for the current row's primary key. If the primary key is based on a single field (or record number in the case of a .dbf table), the array will have one entry. If the primary key comprises multiple columns, the array will have an entry for each column in the primary key.
    
    'e._isLinkedGrid - .t. if the Grid is a linked Grid (i.e. it has a parent Grid)
    'e._linkValues = linking value. Contains a CRLF delimited list of linking values in this format: fieldname|type|linkingValue
    
    'Each entry in the e.fileArray array has these propeties (where 'i' is between 1 and e.fileCount):
    'e.fileArray[i].file.characterSet - character set of the uploaded file
    'e.fileArray[i].file.contentType - MIME type (e.g. 'application/octet-stream')
    'e.fileArray[i].data - data that was uploaded. This will either be binary data or text data. Check the .file.dataType property
    'e.fileArray[i].fileName - filename of the file on the client machine
    'e.fileArray[i].encoding - For text files, specifies the encoding type
    'e.fileArray[i].file.dataType = Either 'text' or 'binary'
    
    'If you want to send any Javascript back to the browser to execute after this event has completed, you can set this property:
    'e.javascript 
    'EXTREMELY IMPORTANT - The Javascript that is sent back to the browser is executed in the context of the IFrame that contains the File Select window.
    'Therefore, in order for the Javascript you send back to invoke methods of the Grid object, you must prefix all methods with 'window.parent'.
    'For example: window.parent.{grid.object}.refresh()
    
    'You can set e.abort = .t. to abort the operation. If you set e.abort to .t. then you can set e.errorText to the text you want to display to the user.
    
    end function

    #2
    Re: Getting Array elements

    Have you checked e.fileArray ?
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

    Comment


      #3
      Re: Getting Array elements

      Hi Frank,

      Thanks for your suggestion but the property does not exist until runtime and then the ? does not work

      The error shown is

      Error executing After Upload Server Side Event event function ('AddPolicy'): command: text32 = e.fileArray[i].fileName Property not found e.fileArray[] subelement not found.

      I assigned 1 to i as I was only uploading one file.
      Last edited by JonLJC; 12-05-2011, 06:09 AM.

      Comment


        #4
        Re: Getting Array elements

        Jon,
        I think Frank was suggesting that you place a debug(1) statement before your 'dim' line. Then, you can explore what elements are set within 'e' at runtime and probably find what you're looking for.
        Andy.

        Comment


          #5
          Re: Getting Array elements

          Hi Andy,
          I've tried this but I just get the message 'File upload is not supported when the Grid is running on the Desktop' so I can't see the code window!

          Comment


            #6
            Re: Getting Array elements

            Oh, that's right. So why don't you:
            (1) use e.javascript to send back an alert telling you the various values you need to inspect, and
            (2) use the e.fileCount value to create a simple loop (rather than explicitly call item 1), and provide yourself with some temporary debugging feedback (as in 1 above) so you know what's happening.

            Comment


              #7
              Re: Getting Array elements

              I would have liked to say this worked but filecount failed as well

              for i = 1 to 5
              strtest = e.fileArray[i].fileName
              AddPolicy= "alert('" + strtest + "');"
              next i

              Error executing After Upload Server Side Event event function ('AddPolicy'): command: strtest = e.fileArray[i].fileName Property not found e.fileArray[] subelement not found.

              Comment


                #8
                Re: Getting Array elements

                Ok. Backtrack. In your AddPolicy function, comment out your edits and only run: e.javascript = alert(e.fileCount)

                This should return the number of files uploaded (typically = 1). If this doesn't work, then something is not setup right with your upload dialog.

                If it works as expected, then do something like:
                if (e.fileCount>0) then
                for i = 1 to e.fileCount
                strtest = e.fileArray[i].fileName
                e.javascript= "alert('" + strtest + "');"
                next i
                end if

                Good luck.
                Andy.

                Comment


                  #9
                  Re: Getting Array elements

                  Hi Andy,

                  Thanks for your help, I've been temporary dirveted to another project for a couple of weeks. I did try your first e.javascript = alert(e.fileCount) came back with the same error. I'll check my upload setting when I get back to this project after the holidays.

                  Comment


                    #10
                    Re: Getting Array elements

                    Sorry to hijack this thread but I am struggling with the upload, too.

                    1. I can see certain e. objects, but not e._currentRowDataNew, why?

                    2. I have the row number in e.rownumber, but how do I retrieve at this point the rest of the row data of the grid? The :customerID as it is shows in the videos (V10FP8) says "variable not found".


                    3. Last not least the function prototype states:

                    'Your code must set these properties in the e object:
                    'e.ajaxCallBackType = "FileDownload"
                    'e.fileToDownload = The name of the file to download
                    'e.Folder = (optional) If e.filetodownload is a relative filename, the name of the folder where e.filetodownload is located

                    How do I set e.values before calling the Call-back function?

                    Thanks a lot!!

                    Comment


                      #11
                      Re: Getting Array elements

                      I'm not sure if this is a bug, my file upload works ok i.e., it uploads the file to the folder I specify naming it correctly. but the e. variables just don't work.

                      Comment

                      Working...
                      X