Where to put page redirect code when using htp.prn

Apex 4.0 oracle 11g.
The user starts on page 7, chooses rows from a list and clicks a Run button which redirects them to page 10 which has a process (on load before header) using htp.prn to create a text file which the user then can save. The end of this process has apex_application.g_unrecoverable_error := true; because if it doesn't have this, the HTML gets put into the text file too.
Anyway, when the user is done saving this text file, to all appearances they are still on page 7 (since page 10 doesn't really load, just runs that process) but I want them to go to page 14 after saving, not stay on page 7. I can't figure out where to put the redirect. The branching on page 7 doesn't seem to get activated after they hit the save button of the popup file save window, page 10 never loads for a branch on that page to work and I tried to put
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:14:&APP_SESSION.');
after the htp.prn call in but then the popup file download window doesn't come up at all and the user is immediately redirected to page 14.
This is the process - I've tried the redirect inside its own begin end; and it didn't make any difference. If I put it in a separate process, it never gets run because as soon as the htp.prn is done, all processing stops. Any ideas on how I can get this file created and then redirect user to page 14? Thanks!
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="this_file_add.txt"');
-- Close the HTTP Header
owa_util.http_header_close;
-- Loop through all rows in CLIENT_TABLE
for x in (select HEADER_TRANS_TYPE
, HEADER_FILLER
, TRANS_TYPE_CD
, SOURCE_DEPT_NBR
, DEST_DEPT_NBR
, ENV_TYPE
, FILE_SEQ_NBR
from TEMP_CRA_EXTRACT
loop
-- Print out rows
htp.prn(x.HEADER_TRANS_TYPE|| x.SOURCE_DEPT_NBR|| x.DEST_DEPT_NBR|| x.TRANS_DATE || x.ENV_TYPE || lpad(x.FILE_SEQ_NBR, 4, '0') || rpad(x.HEADER_FILLER, 48) || x.TRANS_TYPE_CD || rpad(x.XREF_NBR, 12) || chr(13) || chr(10) );
end loop;
-- Send an error code so that the rest of the HTML does not render
apex_application.g_unrecoverable_error := true;
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:14:&APP_SESSION.');
end;

I would recommend using Thread Safe Queues. Your acquisition callback can place items in the TSQ and then you can process the data in a separate thread. TSQs are nice because they allow you to install a callback function to run for certain events. Most importantly, you can install a callback for the Items in Queue or Queue Size Changed event which will run the callback if a certain number of items are in the queue. This lets you take advantage of multithreading in a simple and safe way using a standard Producer/Consumer architecture. However, you may still run into problems with this architecture if your acquisition thread is running much faster than the consumer thread. You could eventually overflow the queue. In that case, your only options are to either get a faster system, slow down the acquisition or do the data handling post process.
National Instruments
Product Support Engineer

Similar Messages

  • Where to put JAAS classfiles (loginmodules) when using it from a web app

    Hi,
    I am using JAAS authentication from a web application, the problem is that the login modules that I use, and all the classes that the LoginModule uses are not loaded from the WEB-INF/classes or WEB_INF/lib folder. I have to put them on the jdk/jre/lib/ext. The problem is that the classes I put there collide with other applications that use the same installed JDK.
    I have developed it using jdk1.3.1 and JAAS 1.0.
    Is there a way to put specify where login module classes should be loaded that does not interfere with other applications (that is, I do not want to put any class on the jdk/jre/lib/ext folder).
    Cheers

    Unfortunately, the only alternatives are to put all resources required by JAAS in jre/jre/lib/ext OR on the system classpath when the JVM is started.
    This is apparently due to a bug in JAAS. The implementers of JAAS have the LoginContext written so that it loads resources only from the system classpath. Unless this was, for some reason intentional. I don't know what the plans are for JAAS going forward with respect to this.
    Has it been fixed in J2SE 1.4?
    I'll have you know this wreaks havoc with attempting to have your LoginModule use an EJBs to authenticate a user and add Principals to the Subject.

  • Replace xml code when used as a xmltype converted from clob.

    I am still new at all this so I will try to make sense.
    I have the "sys_xmlgen" where it takes my clob_content which is a clob and converts it into the v_xml which is xmltype.
    ****code to show change of clob to xmltype.
    SELECT sys_xmlgen(clob_content) INTO v_xml FROM xmltest2 WHERE item_id = v_item_id;
    update xmltest2 set xml = v_xml where item_id = v_item_id;
    **end of code
    When you use sys_xmlgen it changes the xml into this example:
    <?xml version="1.0"?>
    <CLOB_CONTENT>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
    &lt;!DOCTYPE metadata SYSTEM &quot;csdgm2.dtd&quot;&gt;
    &lt;?xml-stylesheet href=&quot;FGDC_V2.xsl&quot; type=&quot;text/xsl&quot;?&gt;
    &lt;metadata&gt;
    &lt;idinfo&gt;
    </CLOB_CONTENT>
    I need to remove the <CLOB_CONTENT> tag and change some things such as the "&lt;" to a "<" and so on. But when I do a replace statement
    select replace(clob_content, '&lt;', '<') into v_xml from xmltest2;
    It says I can not do a clob into number.
    Just to make myself clear, the clob_content is clob and v_xml is xmltype. SOOO I think that is where my problem is. Does anyone know the syntax to replace the code in my xml so that it looks like the original clob xml??
    Any help would be appreciated.

    I am still new at all this so I will try to make sense.
    I have the "sys_xmlgen" where it takes my clob_content which is a clob and converts it into the v_xml which is xmltype.
    ****code to show change of clob to xmltype.
    SELECT sys_xmlgen(clob_content) INTO v_xml FROM xmltest2 WHERE item_id = v_item_id;
    update xmltest2 set xml = v_xml where item_id = v_item_id;
    **end of code
    When you use sys_xmlgen it changes the xml into this example:
    ?xml version="1.0"?>
    <CLOB_CONTENT>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
    &lt;!DOCTYPE metadata SYSTEM &quot;csdgm2.dtd&quot;&gt;
    &lt;?xml-stylesheet href=&quot;FGDC_V2.xsl&quot; type=&quot;text/xsl&quot;?&gt;
    &lt;metadata&gt;
    &lt;idinfo&gt;
    &lt;citation&gt;
    &lt;citeinfo&gt;</CLOB_CONTENT>
    I need to remove the <CLOB_CONTENT> tag and change some things such as the "<" to a "<" and so on. But when I do a replace statement
    select replace(clob_content, '<', '<') into v_xml from xmltest2;
    It says I can not do a clob into number.
    Just to make myself clear, the clob_content is clob and v_xml is xmltype. SOOO I think that is where my problem is. Does anyone know the syntax to replace the code in my xml so that it looks like the original clob xml??
    Any help would be appreciated.

  • Web pages are black when using Safari 4.0.3 on Windows 7

    Web pages are black when using Safari 4.0.3 on Windows 7. It does not matter what page I try to view, all page are black. Sometime I can see pictures and white text box.
    Screen capture:
    http://users.jyu.fi/~ksalone/virhe/Safari403_Problem_onWin7.PNG

    Hi and welcome....
    Try deleting the temporary internet files (cache)
    How to Delete the Contents of the Temporary Internet Files Folder
    Carolyn

  • Values of return code when using dba_audit_session

    Is there anywhere I can look up the possible values for return code when using dba_audit_session?
    I am generating a report over the data and have so far only been able to provide the returncode and whether the username exists (ie username or "other" error)
    Thanks
    (using 9i)

    So far I have fathomed out:
    Return code: 0 everything OK
    Return code: 1017 wrong username or password
    Return code: 28000 locked account
    Return code: 28001 expired account

  • Partial page load problem when using Muse in an existing non-Muse Masterpage; how to issue a jquery

    Partial page load problem when using Muse in an existing non-Muse Masterpage; how to issue a jquery args.get_isPartialLoad().
    My page is loaded into a palcehold within the Ajax update panel within the current Masterpage, so page loadload doesn't occur. But if my Muse page can capture  the partial pageload then I can tell jquery to run the Muse formating routine.

    Jackie,  I am having the same issue and agree that it obscures our site analytics.
    I only have the "WebMarketing" subscription - so I cannot see how often people visit my site (unless I just dont know how to view that).  Here is a screen shot of how many different locations I have and how much it affects my site visitor count based on the other locations which seem "legit" because they have more page views than visits.
    I hope there is a way to fix or block this.

  • Where to put data processing routine when acquiring data using DAQmx

    I have a program that is aquiring data using the DAQmx Acquire N Samples mechanism with automatic reset and a data handler callback routine. DAQmx acquires N samples (usually 1024) from the board, calls the handler to do something with it, and then resets to get the next batch of data. The program acquires a number of lines of data, say 512 lines of N points each, with one callback call per line. Triggering is done by a hardware trigger at the start of each line of data. So far so good.
    The issue is that the time that it can spend in the callback is limited, or else the callback is not finished when the next batch of data is ready to be transferd from the DAQmx buffers and processed. There is a substantial amount of analysis to be done after the entire frame has been acquired, and it ends up taking far longer than the time between lines; so where to put the processing? The data acquisition is started from a control callback callback that exits back to the idle loop after it starts the data acquisition process, so there is no code waiting to execute, to return to, when the data acquisition is finished.
    I could try to put the data analysis routine into an idle-time routine and trigger it with a semaphore, or I could put it into a timer control callback with, say, a 10 millisecond repetition rate and poll a flag, setting the flag when all of the data has been acquired. Any suggestions would be appreciated.

    I would recommend using Thread Safe Queues. Your acquisition callback can place items in the TSQ and then you can process the data in a separate thread. TSQs are nice because they allow you to install a callback function to run for certain events. Most importantly, you can install a callback for the Items in Queue or Queue Size Changed event which will run the callback if a certain number of items are in the queue. This lets you take advantage of multithreading in a simple and safe way using a standard Producer/Consumer architecture. However, you may still run into problems with this architecture if your acquisition thread is running much faster than the consumer thread. You could eventually overflow the queue. In that case, your only options are to either get a faster system, slow down the acquisition or do the data handling post process.
    National Instruments
    Product Support Engineer

  • I wonder there is a way to put a query code when i make VSR.

    After applying vsr, program, GBTC2IQ0 is automatically generated. 
    I want to know what kind of naming rule is applied for this name(GBTC2IQ0).
    and where is it saved ?
    Also, I wonder there is a way to put a query code(like select...) when I make VSR.
    (* no badi.)

    Hello, check Finder Preferences>General, & then the Sidebar tab also.

  • Computer does not put itself to sleep when used in lid-closed mode

    Hi. I'm having a small problem when using my macbook pro with the LED display, lid closed and with external keyboard and mouse. If I leave the computer unattended, the display goes to sleep at the time specified in system settings under energy saver. The computer, however, does not go to sleep - the white power indicator remains solid and noises for new email etc can still be heard.
    I should probably just try to remember to put it to sleep manually but I keep forgetting. Does anybody know what settings I need to adjust?

    I tried cycling the old battery many times, and the computer would still shut down unexpectedly instead of going to sleep when it ran out of power. I got a free replacement from the supplier [http://myworld.ebay.com/cbkusaelectronics>, but I have cycled this new battery twice now, and it still does not go to sleep when it runs out of power. The capacity of the battery is fine (4.9 Ah), and the timing calibration seems fine as well. I have two older batteries from NewerTech and they allow sleep every time, so I think my computer is fine. Can anyone enlighten me about the cause of this problem? Does my battery lack some 'sleep battery' cell in it for use after the other 4 cells discharge? Or does my battery lack a chip that communicates with the computer? Is there any hope of getting this battery to support sleep when discharged?
    Has anyone else seen this problem consistently in a brand of battery? Does anyone have a recommendation for a cheaper battery that does not exhibit this problem? I have been happy with NewerTech, but they cost over $130.
    (I only paid $44 plus $10 shipping, so I probably got what I paid for. It is maybe still worth it to have a high capacity battery for such a low cost, but I can't rely upon it in those last few minutes or I may lose work.)

  • How can I keep pages from scrolling when using keyboard page-down

    The bottom of the pages window has a gear. You can select "Page" in the drop down menu and click the arrow, to perform a page down. The new page is positioned exactly like the previous page. But when I type fn+down-arrow or cmd+down arrow the new page view is either higher or lower than the previous page. Resizing the window makes it almost possible to get a consistent page display but not quite. It's awkward trying to read a document when each new page jumps to a new position. The arrow next to the gear is the only solution I've found.
    Does anyone know a way to achieve this page down view using just the keyboard. I'm using the iMac wireless keyboard?
    Thanks,
    Mark

    It is an annoyance, due to the 2 meaning two different things.
    The page down key means the whole window view which is not the physical page that you see in Pages.
    Apple could have clarified it by labelling the key +window down/up.+
    Peter

  • Where Is File Stored On Computer When Using: File.applicationStorageDirectory

    When using the File.applicationStorageDirectory function, where is Adobe storing the program on an Windows/Apple computer? I know what it means, but I would just like to be able to verify for myself that the file is being created when I'm developing my application.

    Adobe Flash Platform * Working with File objects in AIR
    Windows: C:\Documents and settings\userName\ApplicationData\applicationID\Local Store
    Mac: path/Library/Application Support/applicationid/Local Store (AIR 3.3 and later), where path is is either /Users/userName/Library/Containers/bundle-id/Data (sandboxed environment)                     or /Users/userName (when running outside a sandboxed environment)

  • Printer Driver Problem?  Page margins shift when using paper tray vs. manual feed

    I am printing to an Apple LaserWriter 12/640 PS. The printed page and page margins are PERFECT (WYSIWYG; "What you see is what you get") when printing either to: (a) the MANUAL FEED TRAY of the Apple LaserWriter 12/640 PS; or (b) PDF to view on screen.
    HOWEVER, when printing to the LaserWriter using the (ordinary/usual) paper cassette (you know, the thing that holds the 200+ sheeets of blank paper), two margin problems occur: (1) the uppermost portion of page content is shifted down 3/4" (maybe closer to 11/16") vs. its position on the manually fed paper.  This, in turn, causes the botttom portion of the page content to run off below the printed page.  (2) The "unprintable region" on the right edge of the paper expands from 1/8" with the manually fed paper to 7/16" when using the paper cassette.  This shows up as an extra 5/16" (7/16" - 1/8" = 5/16") of white space/missing page content on the right edge.
    The problem is consistent and reproduceable.  It happens with cassette fed output from Safari, Word 2011, Acrobat X, TurboTax, Quicken Essentials for Mac, and TextEdit.
    BIG problem when printing long documents whose content and margin settings I cannot control (e.g., third-party documents from Acrobat, anything from Quicken Essentials or TurboTax, pages from Safari, etc.).  The only workaround is to feed everything manually (UGGH!).
    I suspect the printer driver is faulty since the problem detailed above happens with so many applications.  Is there a way to edit a plist (using the application/utility "Pref Setter" or similar) to overide the driver's margin settings?
    I believe the print driver is "Apple LaserWriter 12/640 PS v2015.105" (from Sytem Prefences->Print&Scan->Options and Supplies->Driver).
    Any help greatly appreceated.

    Thanks!  It works perfectly!  I even saved my original "oversize" document by printing it to PDF with the scaling so the problem is permanently cured, at least for this document.

  • How do I choose which pages to print when using hp eprint

    When using HP ePrint on my Ipad, to print to my HP Photosmart C4580 wireless printer, can I choose a range of pages to print?  There doesn't appear to be an option for this.
    This question was solved.
    View Solution.

    Sure, have only the pages you want to print all set up in the attachment.  Now send it to your ePrinter and only those will print out.
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Muse page content "jumps" when using menu button

    I Created a simple portfolio website in Adobe Muse. Two pages (projects and contact) and for both using the same underlaying stramien page (don't know the English word for that). I added a menu widget to navigate between the two pages. Works fine, but whenever I use the menu button the page content (text and/or pictures) make a little vertical jump before they are in their right position. Obviously this little "jump" is not like it is supposed to be. The website is not yet published or online, cause it's not finished yet, but the problem occurs when I preview what I've made so far.
    What could be the cause of this problem and how can I repair it ??
    Alexander

    are you using Chrome?
    try loading my page, www.stacystechpubs.com using Chrome.
    Then you see a bar of menu items across the page (home, who am I, terms,...) try clicking on one, then the next one, then the next one. You'll see the box 'Stacy's Tech Publications' jumps when you click on a link.
    If you still aren't sure what I mean I need to take a screen capture video and upload it.

  • Where does the date come from when using Tip type = dateFormat

    Hi,
    Can anyone tell me when using personilizations where the date that is shown comes from when using tip type = dateFormat? Today it shows (example: 24-Sep-2012) but yesterday it was the 23rd so seems to increment by one day. Is there a way to change the date shown here, to sysdate for example?
    Thanks

    Hi,
    You can check Inline Messaging, Tips, Hints and Bubble Text section in OA Framework Developer Guide
    Thanks,
    Jit

Maybe you are looking for