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 Client-side filename function to work

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

    getting Client-side filename function to work

    Cant seem to get it to work.
    Clien-side filename set to function:fileName

    and in Javascript functions
    function fileName(){
    var fileName = {dialog.Object}.getValue('FileName');
    return encodeURIComponent(fileName);
    }

    and all I get are files name function_fineName

    Sadly I only have 5028 build 5088 so I hope its not just that its broken on this version.

    #2
    Re: getting Client-side filename function to work

    It's unclear what you're trying to do. What does "Client-side filename set to function:fileName" mean? Where is this being set... in what context?

    Your function code is a little bit dangerous. You have a control named FileName, a Javascript function named fileName, and a variable inside that function named fileName. That's a couple too many filenames for safety.

    I would write the function like this...

    Code:
    function getFileName(){
    	var fn = {dialog.Object}.getValue('FileName');
    	return encodeURIComponent(fn);
    }

    Comment


      #3
      Re: getting Client-side filename function to work

      I will change the names, I did change them a few times but do not remember if i set them all to a different value at the same time.

      I am trying to set the name of a file being downloaded from the server (file was embedded into an sql filestream) using an on click event (button).


      EDIT:
      Just changed the function and the client-side file name property to function:getFileName; now just getting a file with this name: function_getFileName.

      Doesn't look like the property actually calls the function its just setting the name to whats typed there, but its supposed to be to set a dynamic file name i think.

      EDIT2:
      Also tried setting that property to ::getFileName and =::getFileName with similar results.
      Last edited by Archesr; 05-13-2019, 01:26 AM.

      Comment


        #4
        Re: getting Client-side filename function to work

        What Javascript is in your button on click event?

        Comment


          #5
          Re: getting Client-side filename function to work

          action javascript file download (the premade items) https://documentation.alphasoftware....20Download.xml

          Sadly i cant use S3 as my version doesn't seem to work with it anymore, i have it setup on a SQL Filestream, the upload and download function works just cant seem to get this client side file name property to work as i think its intended.

          Comment


            #6
            Re: getting Client-side filename function to work

            The syntax you're using for the Javascript function is not right. I'm not sure why you're putting the prefix "function" or anything else before your function name. Have another look at the doc... and at the in-line doc. Your Javascript function name should be just the function name with parens.

            Code:
            getFileName()
            Unfortunately, Alpha uses a number of different syntax variations throughout the UI. Sometimes it's just the name without parens, sometimes it's "javascript:functioname".

            I don't have build 5028, so double check the in-line doc. There should be a note at the bottom of the dialog you're in when setting the function name.

            Is your file sitting on your server? If so, where is it... specifically... what is the full path?

            Comment


              #7
              Re: getting Client-side filename function to work

              The downloaded file is correct, just the function to set the name of the downloaded file is what is not working.

              The file is stored in an SQL FileStream EDIT: this works like an embedded file in an SQL table, the only one that uses the directory to the actual file itself is SQL. Both Upload and Download work well except for this client side file name property. EDIT: (For an embedded object, a system generated filename will be used.)

              I followed the text from the program version i am running and from the how to website, both being the same (see below)
              "To specify a Javascript function enter: function:nameOfYourJavascriptFunction."

              I have tried
              function:getFileName()
              function:getFileName
              :getFileName
              =:getFileName (knew this wasn't the right one because i think this is for an argument)(EDIT: i tried setting the argument to the field just in case, does not work that way ether)
              FUNCTION:getFileName()
              FUNCTION:getFileName
              Function:getFileName

              and i have just tried with the same result, it doesn't use the function it just names the file what i typed in this field.

              getFileName()
              =getFileName()

              I am not sure what i'm doing wrong, and i hope it's not that it just doesn't work on my version, as sadly for now i won't be able to upgrade to anything if this is fixed in a future version or in the current.


              Client-side filename
              Specify the default filename to use when saving the file on the user's computer. The user can override the suggested name. If you set the name to <Default>, then (for a linked file), the filename of the file on the server will be used. For an embedded object, a system generated filename will be used. If you specify a client-side filename with no extension, the extension of the file being downloaded will be used. TIP: You can call a Javascript function to dynamically generate the name of the client-side filename. To specify a Javascript function enter: function:nameOfYourJavascriptFunction. For example: function:setFilename, where 'setFilename' is the name of your Javascript function. The value returned by your Javascript function must be url encoded.

              EDITS- sorry I am not very good at explaining so i often feel the need to change what i said to reflect what i mean closer.
              Last edited by Archesr; 05-13-2019, 04:21 PM.

              Comment


                #8
                Re: getting Client-side filename function to work

                No... my mistake entirely... I misread, misunderstand what you wrote...

                Your Action Javascript, File Download, Client-side filename should be function:getFileName
                So, you have that right.

                Using FileStream, you are trying to download the file that SQL Server saves on your disk? E.g. is the filename something like...

                Code:
                "D:\UserFiles\Dummy-Documents\Dummy-Document\8e4c6374-9b01-4f3c-a909-47f0ea8de473\0347b2ac-3043-4cc3-a88d-8de2fa92535b\00000022-0000015e-0005"
                If so, then I think you need to provide double backslashes...

                Code:
                "D:\\UserFiles\\Dummy-Documents\\Dummy-Document\\8e4c6374-9b01-4f3c-a909-47f0ea8de473\\0347b2ac-3043-4cc3-a88d-8de2fa92535b\\00000022-0000015e-0005"
                In the Action, what is in the "Javascript" property... where you define the filename to download?

                Comment


                  #9
                  Re: getting Client-side filename function to work

                  Yea thats how FileStream is saving them on to the actual disk, however it acts as if the file is embedded into the table to AA gets a field with the blob data, it connects to the file just fine, but since the file name was changed to that GUID when uploaded to SQL i'm trying to get it to change the name on download to the correct file name that was stored on upload.

                  So i'm not using something like telling it to download the GUID from the directory. Dont think thats actually possible with how SQL saves the file name and the GUID (they are not actually available outside of the SQL Server, AA wouldn't get the new file name it gave the file on the actual disk just the blob data of the file and the GUID and that's not the same as the file name on disk.)

                  Here is a picture of how the button action javascript is placed and the file actually downloaded. (Ran it on the server hosting so it doesn't look like a pdf file on download but it is actually the correct file when opened)

                  ScreenCap.jpg

                  the function that is saved is the one you made for me earlier changing the names, i placed it on a calculated field to check that it gave the correct name and it is working, on the calculated field its only places as
                  Code:
                  getFileName()
                  Code:
                  function getFileName(){
                  	var fn = {dialog.Object}.getValue('FileName');
                  	return encodeURIComponent(fn);
                  }
                  Last edited by Archesr; 05-13-2019, 08:54 PM.

                  Comment


                    #10
                    Re: getting Client-side filename function to work

                    I can now duplicate what you're seeing. You have a data bound UX. You've added a "FileUpload/Download" control to your UX and this control is bound to your SQL Server FileStream Column... which is a BLOB. The image displays... and a download happens... and is the image... but Client-side filename does not work.

                    I think you should report this to Alpha. I'm not sure if this is a bug... or just that the File Download Action does not work (entirely) with SQL Server FileStream. I wouldn't think fixing this... or getting it to work would be too much work. Something is going wrong when getting the Client-side Filename... as it's returning "function_getFileName". The Javacsript function is never being called.

                    If you leave Client-side Filename as <Default>, then the Export Filename is picked up. This indicates that almost everything is working... except for the Client-side Filename.

                    Comment


                      #11
                      Re: getting Client-side filename function to work

                      I've just tested with a MySQL Table and a longblob field. This issue has nothing to do with SQL Server and FileStream.

                      The Client-side filename function never gets called. It doesn't matter if you include the parens on the function name... Alpha removes them from the Client-side filename property.

                      The issue is that it's a bug. There have been other recent bugs in Alpha regarding the Javascript functions in File Upload. This is just the next one.

                      Report this to Alpha. Alpha should test each one of these properties... instead of piecemeal fixing one at a time as it's found.

                      Comment


                        #12
                        Re: getting Client-side filename function to work

                        Sigh thats what I was afraid of, I'll send a bug report, I'll try to find another way to get it to work for my version at least.

                        Comment


                          #13
                          Re: getting Client-side filename function to work

                          If you can't move off 5028 then ask Alpha if they'd provide a hotfix for 5028. This bug is still in the current official release and in the latest pre-release.

                          Comment


                            #14
                            Re: getting Client-side filename function to work

                            Originally posted by Davidk View Post
                            I've just tested with a MySQL Table and a longblob field. This issue has nothing to do with SQL Server and FileStream.

                            The Client-side filename function never gets called. It doesn't matter if you include the parens on the function name... Alpha removes them from the Client-side filename property.

                            The issue is that it's a bug. There have been other recent bugs in Alpha regarding the Javascript functions in File Upload. This is just the next one.

                            Report this to Alpha. Alpha should test each one of these properties... instead of piecemeal fixing one at a time as it's found.

                            What bug in Javascript functions in File Upload are you referring to? Nothing has been reported to Alpha.
                            For file download, the Genie suggests that you can set the client side filename with a Javascript expression. It appears that this is not implemented and the bug is in the genie. The help text should not have suggested that you can set the client-side filename at runtime using a Javascript function. We will look into what's involved in allowing the client side filename to be set dynamically at runtime or we will fix the help text in the genie.

                            Comment


                              #15
                              Re: getting Client-side filename function to work

                              we have made a change so that in the next release the ability to set the client-side filename dynamically (by calling a JS function) is now supported

                              Comment

                              Working...
                              X