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

Temp file not accessible from second web page first time around.

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

  • Temp file not accessible from second web page first time around.

    This seems really weird but I can duplicate it every time. Anybody have a solution?

    User starts a search from the "original" web page which opens Page 1 to run the search:
    - Page 1 gets a temp file name using Session.full_temp_tbl_name = Request.GetRequestTempFileName( ".dbf" )
    - Page 1 creates that file, opens that file, adds records to it, and closes the table. (Records come from filtering a much, much larger table. The initial filter can take a LONG time - over one minute in some cases. That's why I want to dump the results to a temp table - so future sorting, different views, and possibly exporting to an Excel or CSV file will be quick.)
    - Page 1 then re-opens that table and creates a crlf() list based on that data. (The crlf() list is used to create an HTML table. I.e., it's a list of rows for a table.)
    - The user clicks on a button to jump to "Page 2" which might either export the data or display the same data with different fields.
    - Page 2 says that temp table doesn't exist. ERROR!

    Now the weird part:
    - Click the back button a couple times to get back to the "original" page and start the exact same search again.
    - Page 1 works as described above. (I even put some messages in to see if the table was being created or already existed and it is being created "again".)
    - The user clicks on a button to jump to "Page 2" which might either export the data or display the same data with different fields.
    - Page 2 WORKS PEFECTLY.

    At this point, all subsequent attempts to read the temporary file work perfectly as long as the session is still valid. Start any new session and the same issue occurs the first time through.

    This happens in v11 or v12 WAS.

    More info:
    The temporary file - once it works - is stored in my Temp folder. But after the first time through, only the .ddd, .ddm, and .ddx files are there. After the second time through the .dbf file appears. This matches the fact that the second page can't see it the first time through but can every time after that.

    If you don't mind downloading a 20 meg video, you can see it in action here along with views of the folders where the temp files are/should be:
    www.aimsdc.net/temp_file_not_there.wmv (not sure how long I will leave it there but at least for the next couple weeks)

    For now, the only solution I can come up with is to manually create a "temporary" file in the data folder (or some other folder) and include the date in the file name so I can have the login page delete any file that is more than 1 day old. The down side to that is that we could easily have over 100 users in one day plus some of them could log on multiple times per day. At 4 files per session (the .dbf, .ddd, .ddm, and .ddx for every table), that would be over 400 files per day even if they only log on once. With multiple logins we could end up with over 1000 temp files!

    By the way, these are hard coded web pages because the customer wants to see lists that could be as much as 1000 lines long displayed on one page and web components are, or at least were, limited to 100 lines per page. There are no web components in these pages and they are not "published". The vast majority of what's on these pages is xbasic code - the search definitions/filters can be rather complex - and I just copy them to the web folder and they work.

    I also tried moving the temp file to the session folder using Session.SaveDataAsFile() but couldn't make that work at all because I couldn't access it in xbasic once I moved it.

    In versions prior to v11 this was not an issue because you could easily work with files in the session folder. And when the session died, the temp files disappeared right along with the session folder.

    And, in case you are wondering, no, there is no good way to identify specific users at this time. The only way right now would be to compare both the user name and password. But even doing that would only allow me to solve the problem of multiple logins by the same person. And that would mean creating a unique file or folder name for each person based on their name and password - which probably wouldn't be a good idea. That doesn't sound very secure to me and it could get real messy real fast.

  • #2
    Re: Temp file not accessible from second web page first time around.

    Request.GetTempFileName() creates a temporary file that lasts only as long as the current request that creates at. so if page1 has code that uses this method to create a file, the fikle is removed as soon as the processing for page1 is complete. You are seeing the .ddd, .ddm and .ddx files stay behind because you are not creating them using Request.GetTempFileName() so they are "unknown" and will never be removed automatically.

    Using a Session file is what you need in order to be able to have the file available across pages. And you'll want to use 4 Session files, explicitly creating the .ddd, .ddm and .ddx along with your .dbf. Otherwise the cleanup routines will leave the extra files behind.

    If you give more specific details about the trouble you ran in to when trying to use Session.SaveDataAsFile(), I'm sure someone can help you with it.

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

    Comment


    • #3
      Re: Temp file not accessible from second web page first time around.

      Originally posted by Lenny Forziati View Post
      .... the fikle is removed as soon as the processing for page1 is complete. ....
      So why does it show up and remain available for use after running it the second time?

      Originally posted by Lenny Forziati View Post
      Using a Session file is what you need in order to be able to have the file available across pages. And you'll want to use 4 Session files, explicitly creating the .ddd, .ddm and .ddx along with your .dbf. Otherwise the cleanup routines will leave the extra files behind.
      That's what I tried to do in the first place but couldn't, and still can't, figure out how to do it. I was able to create the file but then couldn't access it via xbasic.

      So, I can get the table into the session folder but then can't figure out how to access it so I can read and write to it. Is that possible? If so, what command(s) do I need? If not is there some other method I should be using so each page can access the same table?

      Here's the closest I've been able to get with what I've tried:

      As best I could tell from the Help files, I can't create a file directly in the session folder so I have to create a temporary table using:
      Request.GetRequestTempFileName()
      [code to create the table]
      then (I thought) transfer that to the session folder using:
      Session.SaveDataAsFile()
      then access it using ????

      I originally tried accessing it using Session.FormatFileDataURL() but that only works as a link. It can't be used to access the file in xbasic.

      NOW, after spending at least 4 hours trying to get something to work yesterday and another 1/2 hour today, I finally found this: Session.SaveFileToSessionFile() buried on a "what's changed" page that is about 9 screens in length and covers 77 other commands. BUT, It still took some trial and error to figure out how to make it work because the only "discussion" about this particular command that I could find was the line and a half on that Wiki page and it's not very helpful:
      Session.SaveFileToSessionFile(FileName as C, Key as C) - Added in version 11, Build 3019-4033. Copies a file on disk, typically a temporary file, to session storage.

      It turns out that the "key" in this case is actually the name you want the file to have when it's stored in the session folder. Most of the other "keys" are just the file extension.

      I tried this:

      temp_tbl_name = Request.GetRequestTempFileName( ".dbf" )
      ?"Temp Table Name: " + temp_tbl_name + "<br>"
      [code to create the table]
      result = Session.SaveFileToSessionFile( temp_tbl_name, "temp_table.dbf" )
      ?result + "<br>"

      But the result simply returned "True" and I still have no idea how to access that file (table in this case) with xbasic so I can write to it and read from it.

      So, I've now spent another 1/2 hour of trial and error working on this with the new command and that doesn't count the time to write this message. I'm willing to bet that once I had the right commands and the right syntax I could have the whole thing done in less than 1/2 an hour.

      So what am I missing? I need a command to access the file - not to copy the file back to some other location but so I can write to it and read from it while it's in the session folder - or some other temporary location where it can't be confused with a similar file for another session. (Hmmm, do I need each page to retrieve the file, work with it, then write it back to the session folder for the next page to retrieve it?)

      In other words, I need something more helpful than just "you'll want to use session files". (To which I said, "Well, duh, that's what I was trying to do in the first place.") I'm not trying to be mean but help files often aren't very helpful and sometimes pointing people to the correct command - rather than just a general concept - is all that's needed. It's easy once you know what command to use but finding the right command(s) is the problem and the current help files aren't very good for that at all. Most of the instructions about session files revolve around doing things like saving a report. The only "discussion" about this particular command that I could find was the line and a half that I copied above. I wasn't able to find anything about saving a table to a session folder so you could read and write to it - so maybe it's not even possible to read and write to it while it's in the session folder???

      Are there other commands I should be using? If my syntax is wrong, what's wrong with it? Or am I on the wrong track and it's something else entirely?

      Comment


      • #4
        Re: Temp file not accessible from second web page first time around.

        Originally posted by CALocklin View Post
        So why does it show up and remain available for use after running it the second time?
        I had a theory, then your video reinforced it and wetn on to confirm it as the explanation for this behavior. The big clue is in the same file name being used the second time you visit the page. Request.GetRequestTempFileName() will always create a unique file name and after the request completes, that file will be removed. But your code does not call Request.GetRequestTempFileName() on the second request - instead it uses a value stored in a session variable to create a file. While it has the same name as a previous Request temp file, it is no longer a Request temp file so it will not be removed.

        Originally posted by CALocklin View Post
        That's what I tried to do in the first place but couldn't, and still can't, figure out how to do it. I was able to create the file but then couldn't access it via xbasic.

        So, I can get the table into the session folder but then can't figure out how to access it so I can read and write to it. Is that possible? If so, what command(s) do I need? If not is there some other method I should be using so each page can access the same table?
        Session storage is a place to "temporarily persistently" store files. It is not always part of the file system, and files there cannot be used directly for things like table access. They can only be copied in to and out of Session storage.

        In your case, you would need to use Request.GetRequestTempFileName() to create the dbf, ddd, ddm and ddx files explicitly, and populate the table as needed. Then before that page is complete but after you are done with the table, you would move the 4 files (individually) into Session storage using Session.SaveFileToSessionFile().

        Subsequent pages would then need to retrieve your DBF from the Session and put it in a temporary location in order to work with it. So again you would use Request.GetRequestTempFileName() to create 4 temporary files, then retrieve the actual files from the Session using Session.SaveSessionFileToFile(). Finally, you will need to move the temp files back in to the session at the end of the page as was done the first time through.
        Last edited by Lenny Forziati; 03-03-2016, 02:19 PM.

        Lenny Forziati
        Vice President, Internet Products and Technical Services
        Alpha Software Corporation

        Comment


        • #5
          Re: Temp file not accessible from second web page first time around.

          Thanks Lenny! Got it now.

          Comment


          • #6
            Re: Temp file not accessible from second web page first time around.

            For anyone else who has this issue. I finally ended up going back to my original method of storing the "temp" files in a subfolder of the data folder and having a routine in the login page that deletes them the next day. There were three factors in this decision:

            (1) I couldn't find a way in v11 to get the tables out of the session folder in an xbasic script. I could create a link to them with Session.FormatFileDataURL() but that won't allow me to retrieve them so I can edit the tables. I believe v12 has a newer command that would allow me to do that but my customer is using v11. (Even doing that, the file would have to be retrieved to a "temp file" so there would be no conflict with a file from another session.)

            (2) It seemed a lot easier than retrieving up to 5 files (.dbf, .ddd, .ddm, .ddx, and sometimes .cdx) at the start of every page then re-saving them at the end of every page - and deciding how many to save/retrieve.

            (3) The data is pretty safe where it is and the only thing proprietary about it is that someone took the time and effort to put it together. Anybody with access to a "white pages phone book" could find much of it.

            Comment

            Working...
            X