Computation only works for FIRST record in detail table

Hi,
I am having a weird problem. I have a master/detail form with page computations that work only for the very first record inserted into the detail table. If i try to enter a second or a third record the fields DO NOT get updated with the return values.
This is driving me nuts and i am on a deadline with this project. HELP!!!!!
Here is the code for all the computations below. Interestingly enough, only the name computation works for every new detail record. The others work only for the first.
-- Calulate Social Security PL/SQL Function
DECLARE
p_is16to62ssrate NUMBER(6,2);
p_u16o62ssrate NUMBER(6,2);
p_dob DATE;
p_base_date DATE := SYSDATE;
p_age NUMBER(3);
p_totalss NUMBER(9,2);
BEGIN
SELECT is16to62ssrate, u16o62ssrate
INTO p_is16to62ssrate, p_u16o62ssrate
FROM SSC3_RATES
WHERE ratescheduleid = 1;
SELECT dob
INTO p_dob
FROM SSC3_EMPLOYEES
WHERE ssno = :P25_SSNO;
p_age := TRUNC(MONTHS_BETWEEN(p_base_date,p_dob)/12);
IF (p_age >= 16) OR (p_age <=62) THEN
p_totalss := (:P25_TOTALWAGES * (p_is16to62ssrate/100));
ELSIF (p_age < 16) OR (p_age > 62) THEN
p_totalss := (:P25_TOTALWAGES * (p_u16o62ssrate/100));
ELSE
p_totalss := 0.00;
END IF;
RETURN p_totalss;
END;
-- Calculate Levy PL/SQL Function
DECLARE
-- declare local variables to hold rates from rates table
p_hsdlarate NUMBER(6,2);
p_hsdlbrate NUMBER(6,2);
p_hsdlcrate NUMBER(6,2);
p_hsdldrate NUMBER(6,2);
p_hsdlaminearnings NUMBER(8,2);
p_hsdlamaxearnings NUMBER(8,2);
p_hsdlbminearnings NUMBER(8,2);
p_hsdlbmaxearnings NUMBER(8,2);
p_hsdlcminearnings NUMBER(8,2);
p_hsdlcmaxearnings NUMBER(8,2);
p_hsdldminearnings NUMBER(8,2);
p_hsdldmaxearnings NUMBER(8,2);
p_totalwages NUMBER(8,2);
p_totallevy NUMBER(8,2);
BEGIN
-- Load rate info from table into variables
SELECT hsdlarate, hsdlbrate, hsdlcrate, hsdldrate, hsdlaminearnings,
hsdlamaxearnings, hsdlbminearnings, hsdlbmaxearnings,
hsdlcminearnings, hsdlcmaxearnings, hsdldminearnings,
hsdldmaxearnings
INTO p_hsdlarate, p_hsdlbrate, p_hsdlcrate, p_hsdldrate,
p_hsdlaminearnings, p_hsdlamaxearnings, p_hsdlbminearnings,
p_hsdlbmaxearnings, p_hsdlcminearnings, p_hsdlcmaxearnings,
p_hsdldminearnings, p_hsdldmaxearnings
FROM SSC3_RATES
WHERE ratescheduleid = 1;
-- Assign total wages to variable
p_totalwages := :P25_TOTALWAGES;
-- Determine applicable levy payment and rate
IF (p_totalwages < p_hsdlamaxearnings) THEN
p_totallevy := (p_totalwages * (p_hsdlarate/100));
ELSIF (p_totalwages >= p_hsdlbminearnings) AND (p_totalwages <= p_hsdlbmaxearnings) THEN
p_totallevy := (p_totalwages * (p_hsdlbrate/100));
ELSIF (p_totalwages >= p_hsdlcminearnings) AND (p_totalwages <= p_hsdlcmaxearnings) THEN
p_totallevy := (p_totalwages * (p_hsdlcrate/100));
ELSIF (p_totalwages >= p_hsdldminearnings) THEN
p_totallevy := (p_totalwages * (p_hsdldrate/100));
END IF;
RETURN p_totallevy;
END;
-- Calculate Total Wages PL/SQL Function
DECLARE
t_wages NUMBER(8,2);
BEGIN
t_wages := (:P25_WEEK1_WAGE + :P25_WEEK2_WAGE + :P25_WEEK3_WAGE + :P25_WEEK4_WAGE + :P25_WEEK5_WAGE + :P25_BONUS + :P25_OTHER);
RETURN t_wages;
END;
-- Calculate Employee Name PL/SQL Function
DECLARE
p_firstname VARCHAR2(20);
p_lastname VARCHAR2(20);
p_name VARCHAR2(40);
p_join VARCHAR2(2) := ', ';
BEGIN
SELECT firstname, lastname
INTO p_firstname, p_lastname
FROM SSC3_EMPLOYEES
WHERE ssno = :P25_SSNO;
p_name := Initcap(p_lastname||p_join||p_firstname);
RETURN p_name;
END;
Regards
Glenroy Skelton

Hi,
The first thing that strikes me is the following IF test:
IF (p_age >= 16) OR (p_age <=62) THEN
p_totalss := (:P25_TOTALWAGES * (p_is16to62ssrate/100));
ELSIF (p_age < 16) OR (p_age > 62) THEN
p_totalss := (:P25_TOTALWAGES * (p_u16o62ssrate/100));
ELSE
p_totalss := 0.00;
END IF;The first test will be true for every number as all numbers are greater than 16 or less than 62. I'd suggest changing the OR to an AND or use BETWEEN
Andy

Similar Messages

  • Hide "more" button in a list view, only works for first item in the list

    I have the following code in a list view that outputs several dozen items in a web app.  The code only works for the first item, how can I make it loop through and execute the test for each item in the list view?  The {tag_hide more button} is a checkmark field that yields a numeric 1" if checked otherwise yields a numeric "0".
    <div id="more-option">
            <p class="right"><a href="{tag_itemurl_nolink}" class="btn btn-small btn-very-subtle">More &rarr;</a></p>
          </div>
          <div class="more-selection" style="display: none;">{tag_hide more button}</div>
          <script>
    if ($(".more-selection").text() == "1") {
        $("#more-option").hide();
    </script>

    What's the URL for the site where you are using this?  Offhand, it looks like it should work with your first example so you are either placing the script before those elements are loaded or you might try wrapping your current javascript inside the:
    $(document).ready(function() {
    --- your existing javascript here
    This make sure the code runs once all the html is loaded on the page.  Without seeing a URL and debugging with the js console in Chrome I can't give you a solid answer.
    But, I do know that you can probably do this with a lot less markup.  Once we figure out what the actual problem is I have a better solution mocked up for you on jsfiddle.
    When looking at my HTML code on jsfiddle, please realize I setup some dummy HTML and removed your tags and added actual values which would be output by your tags.  The main thing I did was remove the whole div.more-selection and instead, added a "data-is-selected" attribute on your div.more-option element.  Then, in my javascript for each div.my-option element on the page, we loop through them, find the value of that data attribute and hide that div if it's less than 1 (or 0).
    Here's the fiddle for you to look at:  http://jsfiddle.net/thetrickster/Mfmdu/
    You'll see in the end result that only two divs show up, both of those divs have data-is-selected="1".
    You can try pasting the javascript code near the closing </body> tag on your page and make sure to wrap my js inside a <script> tag, obviously.  My way is neater on the markup side.  If you can't get it to work it's likely a jquery conflict issue.  My version is using the $(document).ready() method to make sure all the code is loaded before it runs.
    Best,
    Chris

  • Exporting PDF files on CS5 - hyperlinks to URLs only work for first page

    I'm new to InDesign and am working through the "Classroom in a Book" training workbook for CS5, I 've got to lesson 14 and have found that when exporting to PDF (interactive) format, the hyperlink to a URL only work for the first page of the document.
    I made my own document with links on multiple pages, and the same thing happened. I followed the lesson to the letter (3 times!)
    I also tried setting up individual links for individual pages and that did work, so how do I get one piece of text to link to one URL on multiple pages of a document (ie on a Master page) ???

    Thanks Peter,  I've actually got CS5.5, so I presume this patch is already updated on this version, because when I tried the 7_0_4 patch it wouldn't run; giving the message: "Some updates failed to install, and "update is not applicable". So I tried the latest update: 7_5_2 patch, but I'm still experiencing the same problems with hyperlinks not working from the Master pages.

  • Changing datasource of reports in a loop only works for first report.

    Hi,
    I have code that loops through a list of reports to change the datasource and save the change in the report. The idea is that this can be done at build time so time taken at runtime is only for opening the report and running it.
    The problem is that the first iteration of the loop works, and any further ones don't. Apart from closing the client document is there anything else that should be explicitly closed? I don't retrieve any ReportSource from the Client Document so I shouldn't need to dispose of that...I don't think. In particular is there something that should be done to the databaseController retrieved from the clientDoc after each loop?
    The code goes like the below:
    for(File report : reports){
         System.out.println("Preparing report: " + report.getAbsolutePath());
         ReportClientDocument clientDoc = CRJavaHelper.getReportClientDocument(
                   report.getAbsolutePath());
         CRJavaHelper.replaceDBConnection(clientDoc, props);
         clientDoc.close();
         System.out.println("Report " + report.getAbsolutePath() + " prepared.");
    getReportClientDocument does this:
    ReportClientDocument clientDoc = new ReportClientDocument();
    clientDoc.setReportAppServer("inproc:jrc");
    clientDoc.open(fullPath,
              OpenReportOptions.openAsReadOnly.value());
    return clientDoc;
    replaceDBConnection does the following:
    DatabaseController dc = clientDoc.getDatabaseController();
    logonDataSource(dc, username, password);
    prepareReport(dc, schema);
    ConnectionInfos cis = dc.getConnectionInfos(null);
    for (IConnectionInfo oldci : cis) {
         IConnectionInfo newci = new ConnectionInfo();
         newci.setKind(ConnectionInfoKind.SQL);
         newci.setAttributes(propBag);
         newci.setUserName(username);
         newci.setPassword(password);
         dc.replaceConnection(oldci, newci, null, DBOptions._useDefault
                   + DBOptions._doNotVerifyDB);
    SubreportController src = clientDoc.getSubreportController();
    IStrings strs = src.getSubreportNames();
    Iterator<?> it = strs.iterator();
    while (it.hasNext()) {
            String name = (String) it.next();
         ISubreportClientDocument subreport = src.getSubreport(name);
         DatabaseController sdc = subreport.getDatabaseController();
         cis = sdc.getConnectionInfos(null);
         for (IConnectionInfo oldci : cis) {
              IConnectionInfo newci = new ConnectionInfo();
              newci.setAttributes(new PropertyBag(propBag));
              newci.setUserName(username);
              newci.setPassword(password);
              sdc.replaceConnection(oldci, newci, null, DBOptions._useDefault
                        + DBOptions._doNotVerifyDB);
    clientDoc.save();

    What's the URL for the site where you are using this?  Offhand, it looks like it should work with your first example so you are either placing the script before those elements are loaded or you might try wrapping your current javascript inside the:
    $(document).ready(function() {
    --- your existing javascript here
    This make sure the code runs once all the html is loaded on the page.  Without seeing a URL and debugging with the js console in Chrome I can't give you a solid answer.
    But, I do know that you can probably do this with a lot less markup.  Once we figure out what the actual problem is I have a better solution mocked up for you on jsfiddle.
    When looking at my HTML code on jsfiddle, please realize I setup some dummy HTML and removed your tags and added actual values which would be output by your tags.  The main thing I did was remove the whole div.more-selection and instead, added a "data-is-selected" attribute on your div.more-option element.  Then, in my javascript for each div.my-option element on the page, we loop through them, find the value of that data attribute and hide that div if it's less than 1 (or 0).
    Here's the fiddle for you to look at:  http://jsfiddle.net/thetrickster/Mfmdu/
    You'll see in the end result that only two divs show up, both of those divs have data-is-selected="1".
    You can try pasting the javascript code near the closing </body> tag on your page and make sure to wrap my js inside a <script> tag, obviously.  My way is neater on the markup side.  If you can't get it to work it's likely a jquery conflict issue.  My version is using the $(document).ready() method to make sure all the code is loaded before it runs.
    Best,
    Chris

  • Suspend only works for first suspend; later attempts fail (Catalyst)

    Currently I am attempting to get suspend working on my desktop. I had managed to get it working, and right after cracking a bottle of Martenellis in celebration, I come to find out the if I enter suspend again, my screen stays black. Sigh.
    Now, I am nearly 100% positive this has to do with the Cataylst I am using for my Radeon 6850. I have enabled set the kernel flag
    vga=0
    properly. In fact, this was what originally allowed me to have the first sucessful suspend.
    What could cause the suspend to work once, then fail if attempted again? I am fairly good at problem-solving, so even if you do not know the exact answer your thoughts would be appreciated here. Thanks!!
    $ fglrxinfo
    display: :0 screen: 0
    OpenGL vendor string: Advanced Micro Devices, Inc.
    OpenGL renderer string: AMD Radeon HD 6800 Series
    OpenGL version string: 4.4.13374 Compatibility Profile Context 15.20.1013

    I'm having a very similar issue, but someone else said that they had also had it happen twice to them and they're using an Intel graphics card. Currently I've disabled C6/C7 power states for my CPU to see if that will help. It really shouldn't have any effect, but I've already tried so much.
    My issue is that if I leave my machine alone and it goes idle and puts the screen to sleep, often the screen won't come back up, it just remains black. I've tried disabling ACPI and that didn't seem to help.

  • JSF actionListeners only work for first requestor?

    Good morning! I'm working on a project where I've built a custom JSF panel that contains 3 buttons. Each button is bound to an action listener method in a form bean. One method takes the value from the text box on the form and adds it as a selectItem to one selectOne object, the second button adds the text box content to a second selectOne object and the third clears both selectOne object and restores them to their default state.
    This all works well as long as you are the first person to press a button after a server re-start. For anyone else that requests this page after that, nothing happens (the page doesn't even seem to refresh, but I can't verify that). I know through the use of breakpoints and debugging that the action listener method is never entered.
    I'm using Weblogic Workshop 9.1 for development (the server is the same version) and using the version of JSF/Beehive that comes with workshop. Any suggestions as to what might be happening to prevent anyone but the first user to fire the listeners would be greatly appreciated!
    Thank you in advance,
    Chris

    There are a couple things you should do:
    1. Implement a debugging phase listener. This is just a simple phase listener for all phases that just prints a debug line at each phase entry/exit.
    2. Add the "messages" tag to show all messages.
    Adding these two may help you discover that you are hitting a validation error.

  • System only works on first power up after plugging in graphics card

    I have a MSI Lightning R7970 that I purchased new however there's an odd problem with it that the internet does not seem to have answers to. Basically my computer only works for the first time after I plug in my graphics card into my motherboard and it works pretty flawlessly (including gaming for hours) until I shut it down or it goes into sleep mode. After that, the computer cannot power up fully but instead only keeps cycling with the fans turning on 1 second and turning off again. This happens all the time and definitely isn't a seating issue because I've gone through this a lot of times already.
    If I take the graphics card out and instead rely on the motherboard onboard graphics, this issue doesn't occur at all. I've pulled out every other component in the system and spent multiple afternoons trying to find another cause but I can't find anything wrong. Everything in the system is new.
    So should I RMA the graphics card? Or are there other settings I should check?
    My config includes i5-4670k, Asus Z87I-Pro, Silverstone ST70F-ES, Crucial Ballistix DDR3 4GBx2.

    Quote
    first time after I plug in my graphics card into my motherboard and it works pretty flawlessly (including gaming for hours)
    So should I RMA the graphics card?
    no
    Quote
    Or are there other settings I should check?
    My config includes i5-4670k, Asus Z87I-Pro, Silverstone ST70F-ES, Crucial Ballistix DDR3 4GBx2.
    could be anything, BIOS/mainboard issue, PSU issue, ram issue
    some kind of mainboard shorting issue
    to check the video card: test it in another PC

  • Master-Detail only shows the first record of the Master's data

    I have an ADF Master Table, Detail table. I use ExcuteWithParams on the Master Table. When executed from a button (Button has partial submit = true for button, Master Table has PartialTrigger on button, and Detail table has PartialTrigger on Master table and button), it works fine. However, I want to pass the parameters in pageFlowScope variables, and have the ExecuteWithParams invoked upon page load. When I try to do this, the Detail table only shows the first record of the Master's data, no mater what row is clicked on the Master table.
    Master table now has no PartialTrigger, and Detail table has PartialTrigger on Master table. In my pageDef, I used an invoke action as follows:
    <invokeAction Binds="ExecuteWithParams" id="invokeExecuteWithParams"
    Refresh="always"/>
    What am I missing? I am using verion 11.1.1.3. Any help would be much appreciated.
    Thanks,
    Jessica

    Yes, it works when I drag the data control as a master detail without filtering any data. I want the user to be able to set search criteria to filter the data in the master table (For example, only pull back data with a transaction date between :startdate and :enddate). I can get it to work if I execute from an executewithparams button on the page, but not if I want to invoke the executewithparams upon page load with the parameter set by pageflowscope variables.
    Thank you for responding.
    Jessica

  • Safari and firefox stop working after a few minutes of browsing, regardless of what site I'm on. I have to restart my computer to get internet access again but it only works for a few more minutes, then I have to restart again. Please help!

    Safari and firefox stop working after a few minutes of browsing, regardless of what site I'm on. I have to restart my computer to get internet access again but it only works for a few more minutes, then I have to restart again. I don't get a spinning ball, it just stops working at whatever page it's on. I can close the program just fine but when I re-open it, either safari or firefox, it freezes trying to load the hompage. This started a few days ago after trying to stream a movie on my computer. I'm on a Mac Air OS X Version 10.6.8 and have downloaded all updates. When I go into finder, it says I have over 80 gigs available. Is there some other memory cache that I need to check? Thanks so much for your help.

    ejwoodall wrote:
    It's not a router problem as I explained in my post. If it was a router problem then I wouldn't have the problem everywhere I go. It is an issue with the software.
    Then I guess the millions of people running 10.5.7 with no issues are just hallucinating that their machines are working fine?
    I'm not trying to belittle your issues; you're certainly having them and I know first hand how annoying an intermittent AirPort issue can be. (In fact, mine was due to an AirPort driver bug that no one else seemed to suffer from.)
    The single best diagnostic you could do is take your system running 10.5.7 to an Apple Store, and try using their in-store network.
    If your machine performs flawlessly, it may be a router issue.
    If your machine has connectivity issues there, it may be a hardware problem with your machine.
    There have been numerous people in multiple threads over the years who swore that an update was buggy because things used to work, but returned later to sheepishly admit that they took their machine in, a problem was found and fixed, and now their Mac works flawlessly with the newer software.
    But simply reinstalling 10.5.5 in no way means the explanation of how firmware bugs may be at play here is incorrect.
    In the context of that explanation, all you've done is possibly reinstall software that asks to add "2 + 3."

  • ITUNES ONLY WORKS FOR 5 MINUTES AT A TIME

    iTunes stopped working about a month ago, but then I fixed it using the msconfig solution. It worked for a while now I have the same problem, i can fix it, but then iTunes only works for about five minutes before closing. This is the only way I can fix it; first, by re-installing iTunes, then, doing the msconfig solution and restarting the computer. Then after about 5 minutes it closes. To open it again I have to go through the whole proccess. I cannot figure out how to permanently fix it.

    Sounds like you have some malware that is interfering with iTunes.
    What do you have to turn off in msconfig to get iTunes working?
    It's pretty involved to remove it. If you have purchased security software like Norton or McAfee, I suggest contacting them for help.
    Otherwise try this
    http://mysite.verizon.net/dbjcgj/id1.html

  • Flash only works for one user

    Using IE7. I have three users on my computer. All
    have Administrator level access. Flash only works for one of them.
    When attempting to play a video on YouTube for example it says "You
    either have JavaScrip turned off or an old version of Adobe Flash
    Player."
    JS is turned on and the current version of Flash Player is
    installed.
    So does anyone know what is going on here?
    Thanks

    I was able to fix my problem of Flash only working on user
    account. I did the following two steps to correct the problem:
    1. First uninstall the Adobe Flash Player plug-in and ActiveX
    control by following the instructions stated in
    tn_14157.
    2. Second Download SubInACL from Microsoft to fix permission
    issues that prevent the Flash Player installation by following the
    instructions stated in
    fb1634cb.
    Following the above two steps, fixed my problem of only
    having Flash run on only one user account. Now it runs on all four
    user accounts.
    As a side note: The Flash Player plug-in and ActiveX control
    would not run in user accounts with Limited access. But when I set
    the permission of the user account to administrative, then Flash
    would work.
    Regards,
    Bob

  • Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times

    Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times.
    Please help to set it up, thanks in advance

    You need to give more info..
    Firstly only works for what.. networking.. backup.. wireless. You need more nouns.. more adjectives... describe what you want and what fails.. then we can figure out why.
    Most likely you have bridged it when it should be in router mode..
    Most likely you are using Lion or ML which has the airport utility bridge the TC by default.
    Change it to working as a router. That might help.
    If you press reset button it will default back to router btw.
    If you are on Lion.. use a real utility. http://support.apple.com/kb/DL1547

  • Creative Zen Nano Plus Media Explorer only works for administra

    Creative Zen Nano Plus Media Explorer only works for the administrator account; for other users the message "The Zen Nano Plus is not connected. Please connect your Zen Nano Plus to the computer." is displayed, but it *is* connected and works under other programs.
    Version is .0.03.
    Thanks for any assistance.
    Edit: System is XPMessage Edited by zigkill on 0--2006 06:23 AM

    RMskater wrote:I think you need to change the permissions to "Everyone".
    How exactly do you do this? I checked this out tonight - when I logged onto my PC using my son's Limited User account (XP Home, BTW) I could connect his N200 and see it in Device Manager and Windows Explorer but both Creative pieces of software (CMS and N200 Media Explorer) did not see that it was there!
    I tried setting the Run As... properties for the CTMS.exe file to run as one of the Admin user accounts but kept getting an error about being unable to find a specific file (which is in the Media Explorer folder!). When I went back to using the current user the error stopped. Perhaps I need to set the Run As.. options on that file as well?
    As we don't use DRM'd music this isn't going to be a problem but it would be good to find out the cause of this once and for all.
    I'm going to see if WMP0 has problems as well or if it's just the Creative ap
    ps.
    PB

  • I keep getting an error when trying to update an app- cannot connect to store. I logged out from my account and tried to log back in and got the same error. I am doing all this from my phone since I no longer own a personal computer (only work)

    I keep getting an error when trying to update an app- cannot connect to store. I logged out from my account and tried to log back in and got the same error. I am doing all this from my phone since I no longer own a personal computer (only work) since I use iCloud and I tunes match

    YAY!!! Saved it in my Mac's Firefox Bookmarks for easy future access!
    Hope you are having a lovely afternoon today! I'm about ready to go bobo....I have an early meeting, and I don't want to oversleep! The nice part is that I work remotely, so I only have to wake up 15 minutes or so before the meeting.... I don't even use an alarm clock anymore (really, my iPhone alarm, which is much more pleasant), unless I have to get up at 6:30 or something....
    TMI?
    GB

  • Flash Player only works for the account that downloaded it

    I downloaded flash player and did not specify any special preferences, however, it doesn't work for the 2 other accounts on the computer.  It only runs for the Administrator account from which i downloaded it. I'm running XP professional. Can someone tell me how to fix this?

    hi, i had already deleted cookies, temp internet files, etc;
    i only have the IE pop up blocker and blocking level set at Medium;
    it's the latest version of FP 10.0.45.2.
    I installed this version a couple of weeks ago and it worked ok for all accounts (the other 2 accounts are not admin) for a week. Then, it stopped working for all accounts, i reinstalled it (some trial and error involved), then when it finally reinstalled, only works for the one account. i just tried to reinstall from one of the other accounts and error mssg said  "failed to register"
    Date: Sun, 6 Jun 2010 11:20:59 -0600
    From: [email protected]
    To: [email protected]
    Subject: Flash Player only works for the account that downloaded it
    Hi ol, I would go to Tools, click on Internet Options and clear the Temp files. Delete Cookies, Delete Files, including the off line content. I would do this using all accounts. Also check the history files while you are there and delete those also unless you have done so recently.
    What version of Flash Player do you have Installed?
    Do you use any adblock or pop up blocker software?
    Thanks,
    eidnolb
    >

Maybe you are looking for