Re: SV: Witango-Talk: Showing progress bar before opening resultset in Excel
Hi Bengt. Maybe I've misunderstood your problem, but, let me rephrase. You can't output an HTML page (which you need to show the progress bar) in the same HTTP request that you use to output the downloadable Excel data. You need two request/responses. This is a limitation of the way HTTP requests/responses work, not a limitation of Tango. One request has one and only one response, and one response has one and only one header type, content-disposition, etc. (As far as I can imagine...) So you need to make the browser send you another HTTP request. There are lots of ways you might do this, but the scenario I suggested is like this: - The first response prepares the data, shows the progress bar and makes a second request. (Probably a Javascript redirect) - The second response sends the Excel headers and the Excel data to the browser. These can both be in the same taf. For example, at the beginning of your taf you might put in something like this: * Warning: Undebugged, and it's a while since I wrote Tango stuff... @IF @@user$downloadIsPrepared @COMMENT Your original code... /@COMMENT @EXCLUDE @ASSIGN local$DebugMode ForceOff @ASSIGN local$FileExtension .xls @ASSIGN local$FileName value=Labsvar @ASSIGN local$Tab '@CHAR CODE=9' @ASSIGN local$httpHeader 'HTTP/1.1 @HTTPSTATUSCODE @HTTPREASONPHRASE@CRLFContent-type: application/vnd.ms-excel@CRLFContent-Disposition: attachment; filename=@VAR local$FileName@VAR local$FileExtension@CRLFLocation: http://@CGIPARAM SERVER_NAME/@VAR local$FileName@VAR local$FileExtension@CRLF@CRLF' @ASSIGN local$encodeResults FALSE @PURGERESULTS /@EXCLUDE@PURGERESULTS@var user$exceldata encoding=none @COMMENT Clean up the user variables /@COMMENT @ASSIGN user$downloadIsDone 0 @ASSIGN user$excelData @ELSE // Go to the rest of your taf, which will include things like this: html head titleLoading your data/title script language=JavaScript function submitToSelf() { location.href=@APPFILE?@CGIPARAM NAME=HTTP_SEARCH_ARGS; } /script /head body onload=submitToSelf(); Write a page with the start of your progress bar... @PUSH Get some data Write some more of the progress bar (I'm not sure how you're doing this without making lots of trips backwards and forwards between client and server, but let's assume you've got it figured out...) @PUSH Get some more data and assign it to a user variable @ASSIGN user$downloadIsPrepared 1 @ASSIGN user$excelData @@local$someDataYouHavePrepared Finish writing the progress bar Put in a link for people without Javascript noscript a href=@APPFILE?@CGIPARAM NAME=HTTP_SEARCH_ARGSClick here to continue/a noscript /body html /@IF Or am I missing your point? Edmund On Mon, 20 Dec 2004 10:02:49 +0100, Bengt Bredin [EMAIL PROTECTED] wrote: Hi Edmund ! Thanks for your reply but I can't get hold of it anyway. I can't get the normal HTML page in Request 1 to show without PUSH because I use branch to reconnect to Request 2 and Witango execute all components from start to the end (Request 1 and 2). And PUSH makes my Excel HTTP header not to work in Request 2, it ends up in the browser. Can I redirect any other way or what am I missing ? /Bengt -Ursprungligt meddelande- Frn: Edmund Edgar (mailing list account) [mailto:[EMAIL PROTECTED] Skickat: den 20 december 2004 00:39 Till: [EMAIL PROTECTED] mne: Re: Witango-Talk: Showing progress bar before opening resultset in Excel Hi Bengt. When you send the HTML to show the progress bar and PUSH it out to the browser, your application server sends the browser a bunch of HTTP headers to tell it to show your content as a normal HTML page. If you want to show both an HTML page (for show a progress bar) and an Excel page (for the data), you'll have to send the browser two pages, with two distinct HTTP requests. For example, you could do it like this: Request 1 will: - Send some normal HTML page HTTP headers. - Do the calculations. - Write the progress bar. - Save the results of the calculations in a USER-scope variable. - Set another USER-scope variable to say it's finished (in case the script got stopped halfway through). - Redirect to the user to Page 2. Request 2 will: - Check if the calculations have been finished. (You set a USER-scope variable to let you check that in Request 1) - Send the Excel HTTP headers. - Send the results of the calculations from your other USER-scope variable. (You saved them in request 1.) - Clear the USER variables. Edmund On Sun, 19 Dec 2004 16:13:27 +0100, Bengt Bredin [EMAIL PROTECTED] wrote: Hi all ! I have a working app that do sql searches, calculations and then present the resultset in Excel. I'm trying to insert a progress bar to the browser while
SV: SV: Witango-Talk: Showing progress bar before opening resultset in Excel
Hi Edmund and thanks again. I feel that my knowledge about http header is week. I've tried your example out (I think) but it ends up with showing either the HTML page (only with push set at the result action) but the Excel data in the browser or Not showing the HTML page (no push in result action) but Excel data downloaded ok. As I understand the javascript sends the first HTTP request (if push is activated) and the Excel request sends the other one but it ends up in the browser. There is no @PUSH metatag to use inside the HTML page, only to the result action. I keep on trying, will not give up so easily, thanks for you help. /Bengt -Ursprungligt meddelande- Från: Edmund Edgar (mailing list account) [mailto:[EMAIL PROTECTED] Skickat: den 20 december 2004 11:50 Till: [EMAIL PROTECTED] Ämne: Re: SV: Witango-Talk: Showing progress bar before opening resultset in Excel Hi Bengt. Maybe I've misunderstood your problem, but, let me rephrase. You can't output an HTML page (which you need to show the progress bar) in the same HTTP request that you use to output the downloadable Excel data. You need two request/responses. This is a limitation of the way HTTP requests/responses work, not a limitation of Tango. One request has one and only one response, and one response has one and only one header type, content-disposition, etc. (As far as I can imagine...) So you need to make the browser send you another HTTP request. There are lots of ways you might do this, but the scenario I suggested is like this: - The first response prepares the data, shows the progress bar and makes a second request. (Probably a Javascript redirect) - The second response sends the Excel headers and the Excel data to the browser. These can both be in the same taf. For example, at the beginning of your taf you might put in something like this: * Warning: Undebugged, and it's a while since I wrote Tango stuff... @IF @@user$downloadIsPrepared @COMMENT Your original code... /@COMMENT @EXCLUDE @ASSIGN local$DebugMode ForceOff @ASSIGN local$FileExtension .xls @ASSIGN local$FileName value=Labsvar @ASSIGN local$Tab '@CHAR CODE=9' @ASSIGN local$httpHeader 'HTTP/1.1 @HTTPSTATUSCODE @HTTPREASONPHRASE@CRLFContent-type: application/vnd.ms-excel@CRLFContent-Disposition: attachment; filename=@VAR local$FileName@VAR local$FileExtension@CRLFLocation: http://@CGIPARAM SERVER_NAME/@VAR local$FileName@VAR local$FileExtension@CRLF@CRLF' @ASSIGN local$encodeResults FALSE @PURGERESULTS /@EXCLUDE@PURGERESULTS@var user$exceldata encoding=none @COMMENT Clean up the user variables /@COMMENT @ASSIGN user$downloadIsDone 0 @ASSIGN user$excelData @ELSE // Go to the rest of your taf, which will include things like this: html head titleLoading your data/title script language=JavaScript function submitToSelf() { location.href=@APPFILE?@CGIPARAM NAME=HTTP_SEARCH_ARGS; } /script /head body onload=submitToSelf(); Write a page with the start of your progress bar... @PUSH Get some data Write some more of the progress bar (I'm not sure how you're doing this without making lots of trips backwards and forwards between client and server, but let's assume you've got it figured out...) @PUSH Get some more data and assign it to a user variable @ASSIGN user$downloadIsPrepared 1 @ASSIGN user$excelData @@local$someDataYouHavePrepared Finish writing the progress bar Put in a link for people without Javascript noscript a href=@APPFILE?@CGIPARAM NAME=HTTP_SEARCH_ARGSClick here to continue/a noscript /body html /@IF Or am I missing your point? Edmund On Mon, 20 Dec 2004 10:02:49 +0100, Bengt Bredin [EMAIL PROTECTED] wrote: Hi Edmund ! Thanks for your reply but I can't get hold of it anyway. I can't get the normal HTML page in Request 1 to show without PUSH because I use branch to reconnect to Request 2 and Witango execute all components from start to the end (Request 1 and 2). And PUSH makes my Excel HTTP header not to work in Request 2, it ends up in the browser. Can I redirect any other way or what am I missing ? /Bengt -Ursprungligt meddelande- Från: Edmund Edgar (mailing list account) [mailto:[EMAIL PROTECTED] Skickat: den 20
Witango-Talk: Showing progress bar before opening resultset in Excel
Hi all ! I have a working app that do sql searches, calculations and then present the resultset in Excel. Im trying to insert a progress bar to the browser while the search and calculation works. I insert a pushed result action before the sql and calc parts and it shows in the browser ok but when the sql and calc are finished the result now only shows in the browser and not to Excel. If its not possible to use push, how can I create a progress bar before presenting the resultset to Excel ? The http header looks like this: @EXCLUDE @ASSIGN local$DebugMode ForceOff @ASSIGN local$FileExtension .xls @ASSIGN local$FileName value=Labsvar @ASSIGN local$Tab '@CHAR CODE=9' @ASSIGN local$httpHeader 'HTTP/1.1 @HTTPSTATUSCODE @HTTPREASONPHRASE@CRLFContent-type: application/vnd.ms-excel@CRLFContent-Disposition: attachment; filename=@VAR local$FileName@VAR local$FileExtension@CRLFLocation: http://@CGIPARAM SERVER_NAME/@VAR local$FileName@VAR local$FileExtension@CRLF@CRLF' @ASSIGN local$encodeResults FALSE @PURGERESULTS /@EXCLUDE@PURGERESULTS@var request$exceldata encoding=none Hope anyone can guide me on this one. /Bengt TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
Re: Witango-Talk: Showing progress bar before opening resultset in Excel
Hi Bengt. When you send the HTML to show the progress bar and PUSH it out to the browser, your application server sends the browser a bunch of HTTP headers to tell it to show your content as a normal HTML page. If you want to show both an HTML page (for show a progress bar) and an Excel page (for the data), you'll have to send the browser two pages, with two distinct HTTP requests. For example, you could do it like this: Request 1 will: - Send some normal HTML page HTTP headers. - Do the calculations. - Write the progress bar. - Save the results of the calculations in a USER-scope variable. - Set another USER-scope variable to say it's finished (in case the script got stopped halfway through). - Redirect to the user to Page 2. Request 2 will: - Check if the calculations have been finished. (You set a USER-scope variable to let you check that in Request 1) - Send the Excel HTTP headers. - Send the results of the calculations from your other USER-scope variable. (You saved them in request 1.) - Clear the USER variables. Edmund On Sun, 19 Dec 2004 16:13:27 +0100, Bengt Bredin [EMAIL PROTECTED] wrote: Hi all ! I have a working app that do sql searches, calculations and then present the resultset in Excel. I'm trying to insert a progress bar to the browser while the search and calculation works. I insert a pushed result action before the sql and calc parts and it shows in the browser ok but when the sql and calc are finished the result now only shows in the browser and not to Excel. If it's not possible to use push, how can I create a progress bar before presenting the resultset to Excel ? The http header looks like this: @EXCLUDE @ASSIGN local$DebugMode ForceOff @ASSIGN local$FileExtension .xls @ASSIGN local$FileName value=Labsvar @ASSIGN local$Tab '@CHAR CODE=9' @ASSIGN local$httpHeader 'HTTP/1.1 @HTTPSTATUSCODE @HTTPREASONPHRASE@CRLFContent-type: application/vnd.ms-excel@CRLFContent-Disposition: attachment; filename=@VAR local$FileName@VAR local$FileExtension@CRLFLocation: http://@CGIPARAM SERVER_NAME/@VAR local$FileName@VAR local$FileExtension@CRLF@CRLF' @ASSIGN local$encodeResults FALSE @PURGERESULTS /@EXCLUDE@PURGERESULTS@var request$exceldata encoding=none Hope anyone can guide me on this one. /Bengt TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf -- Using Opera's revolutionary e-mail client blah blah blah blah TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf