Double counting an insert in the db

When I run the following code – the INSERT INTO occurrence seems to repeat itself – Thus, I am double counting each word:
Example, if I have three words, (Help, Hope & Peace) – each word is placed in the word table – but, when inserted into the occurrence table, it puts them in thusly:
Help
Hope
Peace
Help
Hope
Peace
It does it twice.  Can you help me find out why so that I can find a fix?
CODE:
<?
mysql_select_db($database_connDB, $connDB);
$url = addslashes( $_GET['url'] );
if( !$url )
   die( "You need to define a URL to process." );
else if( substr($url,0,7) != "http://" )
   $url = "http://$url";
$result = mysql_query("SELECT page_id FROM page WHERE page_url = \"$url\"");
$row = mysql_fetch_array($result);
if( $row['page_id'] )
   $page_id = $row['page_id'];
else
   mysql_query("INSERT INTO page (page_url, page_title, page_description) VALUES (\"$url\", 'No Title', 'No Description Provided')");
   $page_id = mysql_insert_id();
if( !($fd = fopen($url,"r")) )
   die( "Could not open URL!" );
while( $buf = fgets($fd,1024) )
   $buf = trim($buf);
   $buf = strip_tags($buf);
   $buf = ereg_replace('/&\w;/', '', $buf);
   preg_match_all("/(\b[\w+]+\b)/",$buf,$words);
   for( $i = 0; $words[$i]; $i++ )
     for( $j = 0; $words[$i][$j]; $j++)
      $cur_word = addslashes( strtolower($words[$i][$j]) );
         $result = mysql_query("SELECT word_id FROM word
                                WHERE word_word = '$cur_word'");
         $row = mysql_fetch_array($result);
         if( $row['word_id'] )
            $word_id = $row['word_id'];
         else
            $results = mysql_query("SELECT common_id FROM common WHERE common_common = '$cur_word'");
                                    $row = mysql_fetch_array($results);
                                    if( !$row['common_id'])
                                    mysql_query("INSERT INTO word (word_word) VALUES (\"$cur_word\")");
            $word_id = mysql_insert_id();
                                    else
                                    $common_id = $row['common_id'];
         mysql_query("INSERT INTO occurrence (word_id,page_id)
                      VALUES ($word_id,$page_id)");
?>

Trying something different.

Similar Messages

  • [Forum FAQ] How to calculate the total count of insert rows within a Foreach Loop Container in SSIS?

    Introduction
    We need to loop through all the flat files that have the same structure in a folder and import all the data to a single SQL Server table. How can we obtain the total count of the rows inserted to the destination SQL Server table?
    Solution
    We can use Execute SQL Task or Script Task to aggregate the row count increment for each iteration of the Foreach Loop Container. The following steps are the preparations before we add the Execute SQL Task or Script Task:
    Create a String type variable FilePath, two Int32 type variables InsertRowCnt and TotalRowCnt.
    Drag a Foreach Loop Container to the Control Flow design surface, set the Enumerator to “Foreach File Enumerator”, specify the source folder and the files extension, and set the “Retrieve file name” option to “Fully qualified”.
    On the “Variable Mappings” tab of the container, map the variable FilePath to the collection value.
    Drag a Data Flow Task to the container, in the Data Flow Task, add a Flat File Source, a Row Count Transformation, and an OLE DB Destination, and join them. Create a Flat File Connection Manager to connect to one of the flat files, and then configure the
    Flat File Source as well as the OLE DB Destination adapter. Set the variable for the Row Count Transformation to “User::InsertRowCnt”.
    Open the Property Expressions Editor for the Flat File Connection Manager, and set the expression of “ConnectionString” property to
    “@[User::FilePath]”.
    (I) Execute SQL Task Method:
    In the Control Flow, drag an Execute SQL Task under the Data Flow Task and join them.
    Create one or using any one existing OLE DB Connection Manager for the Execute SQL Task, set the “ResultSet” option to “Single row”, and then set the “SQLStatement” property to:
    DECLARE @InsertRowCnt INT,
                   @TotalRowCnt INT
    SET @InsertRowCnt=?
    SET @TotalRowCnt=?
    SET @TotalRowCnt=@InsertRowCnt+@TotalRowCnt
    SELECT TotalRowCnt=@TotalRowCnt
    On to parameter 1. 
    On the “Result Set” tab of the Execute SQL Task, map result 0 to variable “User::TotalRowCnt”.
    (II) Script Task Method:
    In the Control Flow, drag a Script Task under the Data Flow Task and join them.
    In the Script Task, select variable InsertRowCnt for “ReadOnlyVariables” option, and select variable TotalRowCnt for “ReadWriteVariables”.
    Edit the Main method as follows (C#):
    public void Main()
    // TODO: Add your code here
    int InsertRowCnt = Convert.ToInt32(Dts.Variables["User::InsertRowCnt"].Value.ToString()
    int TotalRowCnt = Convert.ToInt32(Dts.Variables["User::TotalRowCnt"].Value.ToString());
    TotalRowCnt = TotalRowCnt + InsertRowCnt;
    Dts.Variables["User::InsertRowCnt"].Value = TotalRowCnt;
    Dts.TaskResult = (int)ScriptResults.Success;
              Or (VB)
              Public Sub Main()
            ' Add your code here
            Dim InsertRowCnt As Integer =        
            Convert.ToInt32(Dts.Variables("User::InsertRowCnt").Value.ToString())
            Dim TotalRowCnt As Integer =
            Convert.ToInt32(Dts.Variables("User::TotalRowCnt").Value.ToString())
            TotalRowCnt = TotalRowCnt + InsertRowCnt
            Dts.Variables("User::TotalRowCnt").Value = TotalRowCnt
            Dts.TaskResult = ScriptResults.Success
           End Sub
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Microsoft SQL Server 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • I want to stylise a finder window on a CD-ROM... that is, when a CD data disc I've created is inserted into the Mac and double-clicked, the finder window has the layout and background I've chosen. Is there any Apple software which will do this?

    I've created a CD-ROM which essentially has a website on it.
    I've added an autorun for PC users (assuming those guys still exist) which launches "index.html". So no worries there.
    For Mac users, as autolaunch isn't an option (correct me if I'm wrong?), I want to control the look and layout of the Finder window which opens when the disc is inserted and the CD icon is double-clicked. What's the best Apple software to use to do this?
    Thanks in advance.

    Nice to hear your story.

  • How do I get a 0 to display when a count = 0 (zero)? (The cell is blank)...

    (Running Business Objects Release 2 (Web-I), No other reporting modules)
    How do I get a 0 to display when a count = 0 (zero)? (The cell is blank)...
    In my reports, I count the number of tests of one of our products and another count on the number of failures.  I then use a simple formula to give me the defect rate percentage (DR%)
    The universe objects used in the calculation are:
    Assembly Number (dimension)
    Human Sn (dimension)
    Test Code Description (dimension)
    I created a variable (called [Count Assys]) that counts the number of Assemblies Tested:
    Formula: =Count([Assembly Number];All)
    Another variable (called [Failed Count]) counts the number of failed tests:
    Formula: =Count([Test Code Description];All) Where ([Test Code Description] <> "FUNCTIONAL TESTS PASSED")
    NOTE: There is a "not equal to sign" between [Test Code Description] and "FUNCTIONAL..." above, but the forum is blanking it when I preview the message.  Not a big deal, but it may be important for someone looking to help...
    I then have a third variable called [DR%] that divides [Failed Count] into the number of [Count Assys], which yields a number formatted as a percentage.
    Formula: =[Failed Count]/[Count Assys]
    The above works great! 
    The problem is: when I have a zero defect count (everything passes), the cell is blank, so the percentage variable remains blank.  I want a zero (0) to appear if nothing failed so the percentage appears as 0%
    I've searched this forum completely and have tried several Properties changes and different variable strings (like =If([Failed Count]<1,0) and the cell stays blank and cannot come up with an answer.
    This one seems simple to me, but everything I've tried has yielded zero <smile> results.
    Thanks,
    Charles
    Edited by: Charles Norman on Dec 9, 2008 12:44 PM
    Edited by: Charles Norman on Dec 9, 2008 12:47 PM

    Hi Charles,
    Use [Dr%] Variable formula as =if(IsNull([Dr%]);0;[DR%])
    Here IsNull returns the Boolean value of variable [Dr%] if its true then inserts 0 else the percentage values of failed tests based on the  total number of assembly tests performed.
    I Hope this is what you want to achieve....
    Thanks....
    Pratik

  • How do you get word count to print at the end of a document in Pages?

    How do you get word count to print at the end of a document in Pages?

    Pages v5 does not provide a user assignable word count variable. With some AppleScript, and a paste operation from the clipboard, you can have locale punctuated word count in this format: 7,803 — anywhere in your document. The following AppleScript works with Pages '09 v4.3 through Pages v5.5.2 on Yosemite.
    I would suggest that you copy paste the following AppleScript into your [Apple] Script Editor and save it (suggestion) wordcnt.applescript. Then, follow this with an option+Save As… and this time set the File format to Script Bundle, or Application with hidden extension — saved to your Desktop. Provided you have a Pages document open, you are then a double-click from the ability to paste your current word count into Pages.
    Note: If you have Pages word count display enabled, it will automatically count your pasted value as another word which initially may deceive on true word count at the time the script was run.
    AppleScript
    --- copy below this line ---
    property locale : "en_US.UTF-8" -- In Terminal, use the locale command to see yours
    if not ApplicationIsRunning("Pages") then
         display dialog "Pages must be running to use this utility."
         return quit
    end if
    tell application "Pages"
        tell body text of front document
            set wordCnt to count words
            -- Don't want punctuated numbers? Remove the single quote from printf format
            set the clipboard to (do shell script "export LC_ALL=" & locale & "; printf \"%'d\" " & wordCnt)
        end tell
    end tell
    on ApplicationIsRunning(appName)
         tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
         return appNameIsRunning
    end ApplicationIsRunning

  • Can't sync iphone to itunes; says not enough space but it's double counting content on phone and same content in itunes

    My iphone is pretty full but there is still some space.
    I tried to sync to update it from itunes and it says it needs 9 more gigs of space to sync, which is ridiculous and wrong.  I deleted a ton of content in itunes on my computer and it still says it needs 8 gigs.
    So I looked at the content that itunes on my computer says is on my phone - it only sees 2 songs, the last two I downloaded and synced. It doesn't see the rest of the 700 as being on my phone.
    I think for some reason the itunes in my computer is not recognizing the identical content on the phone as already downloaded and it thinks it still needs to download all the content from my computer to the phone - thus double counting as it sees that the phone is almost full but isn't recognizing 99% of the itunes content is already on the phone.
    Not sure how to get out of this do-loop.  I'd hate to erase the content on my phone and start over in case it still won't sync.  At least now I have the vast majority of the content I want on the phone on it.

    Had same problem. Then I played a purchased song (on my iMac), connected by iPhone and ran a sync, go same message about 27 songs (in my case) not authorized for download, all of which were purchased songs. then went back and went to iTunes store and tried to log in. Then it asked me from my password which rang a bell!!! I'd changed my password last week. Entered new password and voila!! problem solved!

  • How do I create a DVD with no theme, i.e., it plays what was recorded when inserted in the player?

    How do I create a DVD with no theme, i.e., it plays what was recorded when inserted in the player?  Nothing extra, just the recorded content.

    Hi
    No Menu on DVD
    from. Mishmunken
    How to create a DVD in iDVD6 without menu (there are several options)
    1. Easy. Drop your iMovie in the auto-play box in iDVD's Map View, then set your auto-play item (your movie) to loop continuously.
    Disadvantage. The DVD plays until you hit stop on the remote
    2. Still easy. If you don't want your (auto-play) movie to loop, you can create a black theme by replacing the background of a static theme with a black background and no content in the drop-zone (text needs to be black as well).
    Disadvantage. The menu is still there and will play after the movie. You don't see it, but your disc keeps spinning in the player.
    3. Still quite easy but takes more time. Export the iMovie to DV tape, and then re-import using One-Step DVD.
    Disadvantage. One-Step DVD creation has been known to be not 100% reliable.
    4. (My preferred method) Easy enough but needs 3rd party software. Toast lets you burn your iMovie to DVD without menu - just drag the iMovie project to the Toast Window and click burn.
    Disadvantage. you'll need to spend some extra $$ for the software. In Toast, you just drop the iMovie project on the Window and click Burn.
    5. The "hard way". Post-production with myDVDedit (free-ware)
    Tools necessary. myDVDedit ( www.mydvdedit.com )
    • create a disc image of your iDVD project, then double-click to mount it.
    • Extract the VIDEO_TS and AUDIO_TS folders to a location of your choice. select the VIDEO_TS folder and hit Cmd + I to open the Inspector window
    • Set permissions to "read & write" and include all enclosed items; Ignore the warning.
    • Open the VIDEO_TS folder with myDVDedit. You'll find all items enclosed in your DVD in the left hand panel.
    • Select the menu (usually named VTS Menu) and delete it
    • Choose from the menu File > Test with DVD Player to see if your DVD behaves as planned. If it works save and close myDVDedit.
    • Before burning the folders to Video DVD, set permissions back to "read only", then create a disc image burnable with Disc Utility from a VIDEO_TS folder using Laine D. Lee's DVD Imager.
    //lonestar.utsa.edu/llee/applescript/dvdimager.html
    hope this helps!
    From LynnLU USA
    www.mediasoftmac.com/dvd-creator-articles/convert-mov-video-to-dvd-on-mac.html#1 29
    Yours Bengt W

  • Record is not inserting into the Table thourgh forms 10g

    Hi All,
    I have the form built in 10g(10.1.2.0.2).
    Basically the form has 2 blocks.
    Block 1 with only one item, where we enter some value and hit enter(this will navigate to block2 and execute the query).
    Block 2(tabular) will fetch the records. Now this block2 have 3 columns(caseid, userid, date).
    Now when I insert a new record, I just need to enter the caseid only. And userid and date have to be automatically populated.
    I can populate the USERID and DATE fields.
    And when I enter some value in caseid item of block 2, and then do Control+S(to insert the record and Save the transaction),
    i get the message saying FRM-40400: Transaction complete: 1 records applied and saved.
    But when I query again for the same, I dont se the record inserted into the table.
    Why is this happening?
    Help please...

    @ Inol
    There is no promary or foriegn key relation ship. The form is fetching records from just one table. As I said block1 has col1. and Block2 has col2,3,4.
    @Andreas
    Yes I did select * from table, select count(*) from table in SQL*Plus. Nothing is inserted.
    And one thing I have to tall here is, I have a ON-INSERT trigger in block2.
    The code in ON-INSERT trigger is
    --  :BLOCK2.DATE := TO_DATE(:DATE,'DD-MON-YYYY') ;
    /* commented since I was populating date by assigning $$DATETIME$$ to the Initial value property of the data item. */
    :BLOCK2.SOURCE_CASE := :BLOCK1.SOURCE_CASEID;Forgot to tell you,
    Since I was inserting the record from block2(3 columns), to the table which has 4 columns, there is another item in block 2 which has the visible property No.
    So the block 2 has 4 columns. And the hidden column will hold the value that is in the item of block1. This is what i'm pushing in the ON-INSERT trigger.
    Edited by: Charan on Sep 20, 2011 1:51 PM

  • Display value and percentage of row in pivot table w/o double counting...

    Hello,
    I am wondering how/if one can show a metric value and the row percentage it represents without double counting. So far, I have attempted to duplicate the metric value layer, move the duplicated layer in the measures section of the pivot table next to the original layer (i.e. I have the value twice in the measure section), and set the format of the duplicated layer to "show data as > percent > row".
    This makes the trick in terms of the data I see in the table; however, the values displayed in the table are double counted in the chart. I guess this makes sense since I have duplicated the metric value.
    Any thoughts on how I could tackle this issue differently?
    Thanks,
    JP

    You can do all that in the Pivot Table... Go to the measure properties and Duplicate Layer...than Show as...
    Dont need to duplicate the criteria...
    Antonio
    BExpert Brazil

  • Re: How to keep an array ordered when inserting into the middle

    I would use a for loop with two different int values used as a counter:
    int q = 0;
    int insertPosition = 3;
    for(int i = 0; i < (origArray.length + 1); i++) {
        if(insertPosition == i) {
            newArray[i] = "put on socks";
        } else {
            newArray[i] = origArray[q];
            q++;
    }Edited by: kavon89 on Jan 4, 2009 6:08 PM
    messed the code up a bit, now fixed

    Here is a screen shot of the photo when it's open in "Paint."
    Now here is a screen shot of the frame I inserted in the page where I'd like to place the photo:
    Finally, here is a screen shot of what happens when I try to paste the photo in the frame (see how tiny the photo is??):
    So what are your thoughts?

  • Why can't I set the date and time insert to the format I want?

    I would like the date to be formatted in the short form on my docs.  However whenever I insert date and Time it always come out  at the long form i.e.
    Monday, 15 April 2013.
    Right clicking allows me to edit it but the next time I inset it the long form re-appears.
    I've tried to do it via the system preferences > language and text > region > customise  route but the same thing thing happens.  I choose the short form at the top of the choices but it still comes out in the long form on the docs.
    Only a minor point but it is irritating 'cos it should be simple (probably is 'cept I'm a bit slow).
    I'm running Mountain Lion 10.8.3
    Thanks
    W.

    Wilfred.   I found this in one of the More like this posts   >>>>>  opposite your first post.  It might apply if you are on Pages 08.   Insert Date/Time: Apple Support Communities
    I would never have thought of double or right clicking on the date itself.  I haven't tested it to see what formats exist.   One last suggestion, if we don't resolve it here, write a new post and put it in the iWork pages columns.   There you may meet up with the gurus in that persuasion.

  • How to count 2 inserts together?

    hello people,
    i've just started programming with Java in NetBeans
    and now i'm trying to make a countmachine
    but i don't know how to get further
    the script must count 2 inserts
    1 + 1 = 2
    and show the result in another textfield, what has to be lock (no insert over here)
    i make the code like this:
    public class ED5_1 extends javax.swing.JFrame
    public ED5_1()
    initComponents();
    private void initComponents()
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    id_invoerGetal1 = new javax.swing.JTextField();
    id_invoerGetal2 = new javax.swing.JTextField();
    id_Optellen = new javax.swing.JButton();
    jLabel3 = new javax.swing.JLabel();
    id_resultaat = new javax.swing.JTextField();
    id_Modulus = new javax.swing.JButton();
    id_Vermenigvuldigen = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    jLabel1.setForeground(new java.awt.Color(0, 0, 255));
    jLabel1.setText("Getal 1");
    jLabel2.setForeground(new java.awt.Color(0, 0, 255));
    jLabel2.setText("Getal 2");
    id_invoerGetal1.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(java.awt.event.ActionEvent evt)
    id_invoerGetal1ActionPerformed(evt);
    id_Optellen.setToolTipText("Getallen met elkaar optellen");
    id_Optellen.setLabel("Optellen");
    jLabel3.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
    jLabel3.setForeground(new java.awt.Color(0, 0, 255));
    jLabel3.setText("Antwoord");
    id_Modulus.setText("Modulus");
    id_Modulus.setToolTipText("De rest na deling");
    id_Vermenigvuldigen.setText("Vermenigvuldigen");
    id_Vermenigvuldigen.setToolTipText("Getallen met elkaar vermenigvuldigen");
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.Gro upLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(27, 27, 27)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
    .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
    .add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
    .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
    .add(id_invoerGetal1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
    .add(id_invoerGetal2)
    .add(id_resultaat))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED, 38, Short.MAX_VALUE)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
    .add(id_Vermenigvuldigen, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(id_Modulus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(id_Optellen, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addContainerGap(org.jdesktop.layout.GroupLayout.D EFAULT_SIZE, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.Gro upLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(44, 44, 44)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.TRAILING)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
    .add(id_invoerGetal1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(id_Optellen))
    .add(jLabel1))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
    .add(jLabel2)
    .add(id_invoerGetal2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(id_Modulus))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
    .add(id_Vermenigvuldigen)
    .add(6, 6, 6)
    .add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
    .add(jLabel3)
    .add(id_resultaat, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(49, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    private void id_invoerGetal1ActionPerformed(java.awt.event.Acti onEvent evt)
    // TODO add your handling code here:
    public static void main(String args[])
    java.awt.EventQueue.invokeLater(new Runnable()
    public void run()
    new ED5_1().setVisible(true);
    //String Optellen;
    //Optellen = id_invoerGetal1.getText();
    //id_resultaat.setText(Optellen);
    private javax.swing.JButton id_Modulus;
    private javax.swing.JButton id_Optellen;
    private javax.swing.JButton id_Vermenigvuldigen;
    private javax.swing.JTextField id_invoerGetal1;
    private javax.swing.JTextField id_invoerGetal2;
    private javax.swing.JTextField id_resultaat;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    Can someone please help me?

    JavaBeginner wrote:
    you are right I know.
    i need more practiseYes, lots.
    but can you please tell me where i need to put the code to make this workNope, not worth my time.
    between what?
    and maybe a little start if it is not too muck to ask :$I think it is too much to ask. I'm only a volunteer, as is everyone else in this forum.
    Sure you're not a student trying to sucker somebody into doing your homework for them?
    Are you offering money?
    Honestly, based on the previous post that I've answered I don't think you have enough basic Java knowledge. You will be a time sink for anyone foolish enough to bother answering all the questions that you'll be posting here. I'm not interested.
    %

  • How to avoid double-counting in Total field

    Hi Gurus,
    I'm new to Essbase.
    Here's a question I don't know how Essbase handle it, my source data stores at relational database, normally one row in the fact table associates with only one row in dimension table, but very common scenario like one fact row can associate with many rows in dimension table, to simplify we have 4 tables:
    1. DimProduct(ProductID, ProductName). there's one row like 1, "Bike"
    2. FactSales(ProductID, Quantity), there's one row like 1, 10
    3. FactSalesReasons(ProductID,ReasonID), there're 2 rows like 1,1 and 1,2 , suppose there're 2 reasons associate with this product sale, that means 1-N relationship between fact and dimension.
    4. DimReason(ReasonID,ReasonName), there're 2 rows like 1,"Quality" and 2, "Promotion"
    I expect the report as follows:
    ProductName ReasonName Quantity
    Bike Quality 10
    Promotion 10
    Total 10
    But while built cube, I got the value 20 of Total. I know Microsoft SSAS has a many-many dimension usage can avoid this double counting issue (no need to write extra calculation script), can Essbase do similar way?
    Thanks!
    Xiao

    What I would recommend in this case would be in a calc script. I would guess that this dimension is sparse which usually has a low calculation priority (calcs first and may get overwritten). So, at least for a first pass at a calculation...
    ========
    SET UPDATECALC OFF;
    Calc All;
    "Total Reason" = @AVG(SKIPNONE,@CHILDREN("Total Reason"));
    ========
    SKIP options are "none", "missing", "zero" or "both".
    This will calculate for all accounts.

  • Incorrect INSERT in the sample Employee project

    Hi,
    In the sample Employee project provided with the 10.1.2 release the following code generates an incorrect insert (the runtime is 10.1.3 (Build 051113)).
    UnitOfWork uow = this.getSession().acquireUnitOfWork();
    Employee newEmployee = new Employee();
    newEmployee.setFirstName("Joseph");
    newEmployee.setLastName("Fletcher");
    PhoneNumber phone = new PhoneNumber();
    phone.setAreaCode("123");
    phone.setNumber("4567890");
    phone.setType("Home");
    newEmployee.addPhoneNumber(phone);
    uow.registerNewObject(newEmployee);
    uow.commit();
    Triggers the following exception:
    TopLink Warning]: 2006.01.24 04:01:47.894--UnitOfWork(23525817)--Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 051113)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-01400: cannot insert NULL into ("POMOWNER"."PFWPOC_PHONE"."EMP_ID")
    Error Code: 1400
    Call:INSERT INTO PFWPOC_PHONE (TYPE, P_NUMBER, AREA_CODE, EMP_ID) VALUES ('Home', '4567890', '123', NULL)
    Query:InsertObjectQuery(PhoneNumber[Home]: (123) 456-7890)
    [TopLink Finer]: 2006.01.24 04:01:47.909--ClientSession(19523049)--Connection(29494967)--rollback transaction
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 051113)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-01400: cannot insert NULL into ("POMOWNER"."PFWPOC_PHONE"."EMP_ID")
    Error Code: 1400
    Call:INSERT INTO PFWPOC_PHONE (TYPE, P_NUMBER, AREA_CODE, EMP_ID) VALUES ('Home', '4567890', '123', NULL)
    Query:InsertObjectQuery(PhoneNumber[Home]: (123) 456-7890)
         at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:282)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:658)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:707)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:496)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:442)
         at oracle.toplink.publicinterface.Session.executeCall(Session.java:717)
         at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:117)
         at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:103)
         at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:238)
         at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:156)
         at oracle.toplink.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:172)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:433)
         at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:60)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:622)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:586)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:479)
         at oracle.toplink.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:110)
         at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:259)
         at oracle.toplink.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:47)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:603)
         at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:519)
         at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:100)
         at oracle.toplink.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:72)
         at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2528)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:981)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:938)
         at oracle.toplink.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:240)
         at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:217)
         at oracle.toplink.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:173)
         at oracle.toplink.publicinterface.Session.writeAllObjectsWithChangeSet(Session.java:3123)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(UnitOfWork.java:1240)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeSet(UnitOfWork.java:1328)
         at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(UnitOfWork.java:1095)
         at oracle.toplink.publicinterface.UnitOfWork.commit(UnitOfWork.java:864)
         at com.oocl.csc.frm.pom.test.TestBidirRel.testBidirRel(TestBidirRel.java:80)
         at com.oocl.csc.frm.pom.test.TestBidirRel.main(TestBidirRel.java:107)
    Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into ("POMOWNER"."PFWPOC_PHONE"."EMP_ID")
    Indeed the EMP_ID cannot be null as it is part of the PK. This should not be null.
    Regards,
    -horea

    Hi Chris,
    Thank you for looking into this. I checked your suggestions and in our sessions.xml file we do define a custom sequence table (seems to be working fine in all other projects), the same defined via the project MW.
    Also, the insert in the employee table seems to be generated correctly:
    [TopLink Fine]: 2006.01.25 02:41:29.930--ClientSession(27651180)--Connection(3834717)--INSERT INTO POC_EMPLOYEE (EMP_ID, GENDER, VERSION, F_NAME, L_NAME, COUNTER, MANAGER_ID, END_DATE, START_DATE, BKUP_KEY, MAIN_KEY, START_TIME, END_TIME, ADDR_ID) VALUES (302, NULL, 1, 'Joseph', 'Fletcher', 0, NULL, NULL, NULL, NULL, NULL, {ts '2000-02-01 09:00:00.617'}, {ts '2000-02-01 17:00:00.617'}, NULL)
    Below is the sessions.xml we use.
    Regards,
    -horea
    <?xml version="1.0" encoding="UTF-8"?>
    <toplink-sessions version="10g Release 3 (10.1.3.0.0)" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <session xsi:type="session-broker">
    <name>FooBroker</name>
    <event-listener-classes/>
    <profiler>toplink</profiler>
    <logging xsi:type="toplink-log">
    <log-level>all</log-level>
    <logging-options>
    <log-exception-stacktrace>false</log-exception-stacktrace>
    <print-thread>false</print-thread>
    <print-session>true</print-session>
    <print-connection>true</print-connection>
    <print-date>true</print-date>
    </logging-options>
    </logging>
    <session-name>FooSession</session-name>
    </session>
    <session xsi:type="server-session">
    <name>FooSession</name>
    <event-listener-classes/>
    <primary-project xsi:type="xml">TestEmployeeProject.xml</primary-project>
    <login xsi:type="database-login">
    <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
    <user-name>foo1</user-name>
    <password></password>
    <sequencing>
    <default-sequence xsi:type="table-sequence">
    <name>Custom</name>
    <table>POC_SEQUENCE</table>
    </default-sequence>
    </sequencing>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <connection-url>xxxxxxxxx</connection-url>
    </login>
    <connection-pools>
    <read-connection-pool>
    <name>ReadConnectionPool</name>
    </read-connection-pool>
    <write-connection-pool>
    <name>default</name>
    </write-connection-pool>
    </connection-pools>
    <connection-policy/>
    </session>
    </toplink-sessions>

  • Insert only the selected

    Hi:
    In my application i have used html_db collection to enter data
    here the query i am using to driver the collection is
    select
    html_db_item.text(1,pobj.name,20,25) "object Name",
    html_db_item.text(1,null,20,25) "Incomming Hours ",
    html_db_item.text(1,null,20,25) "Design Hours "
    from projects pro.
    project_objects pobj
    where pro.id = pobj.pro_id and
    pro.id = :p10_projects
    here projects and objects are assoicated to each other each project will have several set of objects now my requirement the above query will drive all the object but if i need to enter the data for only tow or three objects i need to make some selection ie like using a row selector
    here the collection i have created is
    declare
         i number:=1;
         q varchar2(32676);
         la_cks wwv_flow_global.vc_arr2;
    begin
    if htmldb_application.g_fcs.count > 0 then
    la_cks := htmldb_application.g_fcs;
    end if;
    htmldb_collection.create_or_truncate_collection('BASELINE_COLLECTION');
    for i in 1..htmldb_application.g_f02.count
    loop
    htmldb_collection.add_member(
    p_collection_name => 'BASELINE_COLLECTION',
    p_c001 => htmldb_application.g_f01(i),
    p_c002 => htmldb_application.g_f02(i),
    p_c003 => htmldb_application.g_f03(i),
    p_c004 => htmldb_application.g_f04(i),
    p_c005 => htmldb_application.g_f05(i),
    p_c006 => htmldb_application.g_f06(i),
    p_c007 => htmldb_application.g_f07(i),
    p_c008 => htmldb_application.g_f08(i),
    p_c009 => htmldb_application.g_f09(i),
    p_c010 => htmldb_application.g_f10(i),
    p_c013 => htmldb_application.g_f13(i),
    p_c014 => htmldb_application.g_f14(i));
    end loop;
    end;
    and the insert query i am using is this
    BEGIN
    for i in 1..htmldb_application.g_f01.count
    loop
    INSERT INTO REPLAN_EFFORT
    PROJECT_NAME,
    OBJECTS_NAME,
    INCOMMING_DOC,
    DESIGN,
    DESIGN_REVIEW,
    DESIGN_REWORK,
    BUILD,
    BUILD_REVIEW,
    BUILD_REWORK,
    TEST_CASE_PREP,
    TEST_CASE_REVIEW,
    TEST_CASE_REWORK,
    INSTALLATION_SCRIPT,
    UNIT_TESTING,
    WAIT_TIME
    VALUES
    :P10_PROJECTS,
    htmldb_application.g_f01(i),
    htmldb_application.g_f02(i),
    htmldb_application.g_f03(i),
    htmldb_application.g_f04(i),
    htmldb_application.g_f05(i),
    htmldb_application.g_f06(i),
    htmldb_application.g_f07(i),
    htmldb_application.g_f08(i),
    htmldb_application.g_f09(i),
    htmldb_application.g_f10(i),
    htmldb_application.g_f11(i),
    htmldb_application.g_f12(i),
    htmldb_application.g_f13(i),
    htmldb_application.g_f14(i));
    END LOOP;
    END;
    please suggest me how to use in a row selector in collection
    thanks
    sudhir

    Unfortunately it did not work. I also developed the code and access the field and checked its property called "ReadOnlyField"  which is already set to false.
    Below is the xml that i am using. Can you please share the xml that you had used?
    <?xml version="1.0" encoding="utf-8"?>
    <FieldTypes>
      <FieldType>
        <Field Name="TypeName">MyCustomField</Field>
        <Field Name="ParentType">Text</Field>
        <Field Name="TypeDisplayName"> My Custom Field</Field>
        <Field Name="TypeShortDescription"> My Custom Field</Field>
        <Field Name="AllowBaseTypeRendering">True</Field>
        <Field Name="ReadOnlyField">False</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="ShowInListCreate">TRUE</Field>
        <Field Name="ShowInSurveyCreate">TRUE</Field>
        <Field Name="ShowInDocumentLibraryCreate">TRUE</Field>
        <Field Name="ShowInColumnTemplateCreate">TRUE</Field>
        <Field Name="FieldTypeClass">My Assembly Information goes here</Field>
      </FieldType>
    </FieldTypes>

Maybe you are looking for

  • Iphone 3GS  to update 4.1 or not?

    I read a while ago that the 4.1 update had alot of bugs. Thanks to all, i have held out and still run 4.0.1 Is 4.1 good now or should i stick with what i got?

  • How to create an action to insert hundreds of different numbers for limited edition prints?

    Hi, I sell limited edition prints of a run of between 350 and 500. I am trying to get it set up so that my signature and the print number is included as part of the print. Here is an example: You'll see at bottom left there is my signature and undern

  • Problem when calculating Salary rows

    Hello all, We use Jdeveloper 11.1.1.4.0 with JHS 11.1.1.4.26. I'm trying to calculate the Salary field from Employees table and then put the result in the table footer as follows: 1- Building an Entity on Employees table 2- Going to Salary field Attr

  • Compund data error for query

    Hi All, Iss Of Compund data, Controlling area is a compound object for cost center. Suppose ....... Controlling are is - ca01 cost center - cc01, cc02 now while we use thes in report variable. controlling area value given CA01 for cost center value s

  • How Do I Manually Add A Skype Name To My Contacts?

    I have the Skype Names for several contacts and would like to add them manually. Seems silly that I can add all sorts of telephone numbers to their profile but not their Skype Name. Anyone know how I do it?