'Join' two different field types together into a String - possible in Java?

Not entirely certain whether this is a straightforward Java or more of a JDBC question:
I have two fields, one is a String and one an integer. I need to concatenate these fields together to form one String, prior to performing an insert on a table. ie:
String s = dbRS.getString("partition_name");    //get full string
String partstr = s.substring(0, 14);      // get first 14 (alpha) characters
int new_partition_number = max_partition_number + 1;      //create new unique partition number, incremented by 1Now I have
- a String (partstr - i.e. "TN1234567890_")
- an integer (i.e. 50)
(NB. The number has to be an integer because it is subject to calculation elsewhere.)
I wish to join these together into a String ("TN1234567890_50") and use the field in an inserted row. I've tried using
String partition_string = new StringBuffer(partstr).append(new_partition_number ).toString();... but this doesn't work.
I read on a forum that it's impossible to cast an integer to a String in this way in Java, which sounds pretty incredulous from where I am! However my Osborne Java 2 Complete Reference doesn't mention it at all.
Any assistance will be very gratefully received!
Thanks.

wonder why he thinks you can't append an int to a StringBuilder.
Works fine. Might of course not yield the expected result depending on expectations, but it works just fine.
But then, the coding conventions reminiscent of C don't bode well.

Similar Messages

  • Can you please help me by saying me how can i join two different picture to make it as one picture.??

    Hi Sir/ Madam,
       My name is Rishav and I am facing some problem with my Photoshop CC. Actually I have a question. If you guys could help me out i will be very obliged. The quest in "Can you please help me by saying me how can i join two different picture to make it as one picture.??"

    Maybe you should post over at
    Photoshop for Beginners
    or start with the "Get Started" section of the Help:
    Photoshop Help | Photoshop Help
    And your question
    Can you please help me by saying me how can i join two different picture to make it as one picture.??
    does not seem particularly specific – do you want to simply combine two images as they are, do you want to clip elements from the one and insert them into the other, …?
    Could you post (lores of) the images and explain what you intend to achieve?

  • Display two different column types in cross tab

    I am using Cross Tab template in crystal XI and I have to show two different column types one is of type int and other is of type string. Below is the format of the report
                                  AmountGiven             Amount Spent            Attended
    Mike                       5000                              3000                         Yes
    Steve                     200                                 200                           No
    Is there a way I can do this showing "yes" or "no" in the third column???
    Thanks...

    Hi
    If you are trying to show "yes" or "no" for a column value in a cross tab, then yes we can try using a formula for it.
    I would suggest you 2 ways that you can try at your end:
    1.
    a) Create a formula in the cross tab expert and write your condition.
    for eg: if Sum({Orders.Order amount}) > 5000 then "yes" else "no"
    b) Then select that formula in the summarized fields in cross tab expert and change the summary to MODE.
    c) You can see the "yes" and "no" Within the same box.
    2.
    a) Add a field to the colums in the cross tab expert.
    b) A column gets inserted in the cross tab.
    c) Right click the field and select format field.
    d) Go to Common tab and write a formula for the display string.
    e) Write the condition in that formula.
    f) You can see a new column with the expected values.
    Hope this helps you..
    Please revert incase of any queries.
    Regards
    Pradeep Hulke

  • Input in one formfield go to two different fields in a MySQL tablerow?

    Hi, I hope you can help me with this.
    How can I have input in one formfield go to two different fields in a MySQL tablerow without having the visitor to type out his input out twice?
    With the second one I would like to use md5.
    Any help is greatly appreciated.

    How can I have input in one formfield go to two different fields in a
    MySQL tablerow without having the visitor to type out his input out
    twice?
    You would need to write your query with the WHERE clause when you update to say "WHERE user=$userid".  That's the most basic way.  The $userid variable would need to come from either a session or a cookie if the user is logged in and you don't want them to enter the information again.  Or if this is from a previous page, the $userid could just be equal to the $_POST variable after sanitization.
    With the second one I would like to use md5.
    That's even simpler.  Before submitting the form, just do $md5_pass = md5($pass);
    http://us.php.net/manual/en/function.md5.php

  • Is there a way to consolidate two different Apple ID's into one. I have an old Apple ID that I used for Itunes and a new I used to set up my iphone.

    Is there a way to consolidate two different Apple ID's into one. I have an old Apple ID that I used for Itunes and a new one I used to set up on my iphone.

    You cannot merge accounts.
    Why did you start a new account?

  • Two different projects spliced together over each other some how?

    Greetings everyone,
    I thought forum users might be interested in this one. I don't use the forum often so I don't know the history but has anybody ever had two different projects spliced together over each other some how? For example, I was tweaking a project and left it alone for several months. I came back today to work on it and clips from other projects were in it some how. Also the audio from the new clips were in the new project and overriding the existing project. Does anybody know how to restore the two and make them separate them without losing any info. from either one? The thing's a mess. I had 1 video track w/ some subtitles, a voice over, and some music in the background. Now it has two video clips, and two of everything else. It's crazy. I don't think it's a virus or anything. Nothing else on my machine is acting strange. I hope nobody else has experienced this yet can help.
    Peace

    If you have a backup external drive and Time Machine, I would suggest the following:
    Locate this specific clip in your Finder. Highlight it and rename it "old", or something similar.
    Launch Time Machine.
    Go back to a date in time when this clip was as you properly edited it.
    Again, make sure Finder is still open and highlight the clip.
    Click "restore" in Time Machine.
    Open iMovie and you will see your project as you had it all those months ago.
    This works for me when I have an iMovie project behaving badly.
    iMovie is a great application: but just like us, it has good days and bad days.
    Dan

  • Two different document types in MIRO

    Hi Gurus,
    Can we have two different FI document types in MIRO for Service PO and Normal PO?
    Standard is RE but we want one more.
    Can you please suggest something?
    Regards,

    You can work with your own document types but I do not hink you can have two different document types for Standard and Service PO.
    The effect of MIRO is still the same whether its Service PO or Standard PO - GR/IR debit and Vendor credit.
    If it is just for reporting, you can always take the PO number from RSEG table.Then drill down to EKKO/EKPO and get all the details.

  • Two different condition types in one report

    Hello,
    i have a problem with the conditional display of a report.
    I want to use two different condition types for one report.
    For example I want to show the report only when the page is not in printer friendly mode and when the value of an item is NULL.
    Is that possible?
    Has anyone a solution for this problem?
    Thank you,
    Tim

    Tim,
    you can use
    IF V('PRINTER_FRIENDLY') = 'YES' AND :P1_ITEM IS NOT NULL THEN RETURN FALSE;
    ELSE RETURN TRUE;
    END IF;
    in the Conditional Display picking PL/SQL Function Body returning a Boolean.
    Denes Kubicek

  • Dataload - Evaluate two different fields

    Hi, I need to evaluate two different fields in a dataload rule and apply condition if true. for instance if field 1 is 600 and field 2 is 30 the change field 1 to 650.

    Hi ,
    I don't want to concatenate two fields nor display it in a single field, but I want to diplay two fields 1 below the other...
    ie..If I am using write statement I would prefer,
    loop at itab.
    wirte: /2 itab-abcd,
            /2 itab-1234.
    endloop.
    my output will be:
    abcd
    1234.
    If need to use da same logic in ALV how would I use ?? hope I am little more clear now..
    Please advice
    Karthik.

  • F4 HELP ON TWO DIFFERENT FIELDS OF A SCREEN .

    Hi Experts ,
    I have a screen  in which i have to aply f4 help on two different fields .
    1. Bussiness unit
    2. SAP GL Account .
    I  have applied for  Bussiness unit. by :
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1013.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_1013.
       PROCESS ON VALUE-REQUEST.
    field B_UNIT MODULE SEARCHHELP_F4.
    But how i can apply on SAP GL Account  ,i have to use one more POV module or i can do it by using the same pov which i used for Bussiness unit.
    Please tell me how i can do with little bit code example.
    Regards,
    Premraj

    Hi,
    use one more FIELD statement and create one more module for GL a/c in same POV event.
    ex
    FIELD <GL a/c fld name> MODULE <Module name>.

  • Joining two different iTunes accounts

    Hi, is it possible, to join two different accounts on iTunes Store, in to one? I've got on both of them apps purchased. One is registred on Poland and the second is on USA (11 cents left).
    Can someone tell me if is it possible?

    transferring money from this new account that is currently registred on US and making this account another account on Poland?
    You can contact the iTunes Store Customer Service department using the form on their Support page (select the category and subcategory closest to the issue you're reporting) and explain your situation to them. Perhaps they can help.
    if I have for example 11 cents and I will add my credit card details to account, can I spend those 11 cents on something, than just pay the rest for something from my c.card?
    If you still have a US credit card, yes. The US iTunes Store won't accept a Polish credit card, though.
    Regards.

  • Combining two different Chart types into one graph

    Hi All,
      I am developing a graphical BW report using WAD. I need to place two differnt chart types into one graph.For example, I have Volume and Quantity .Here the volume should be displayed in Bars and Quantity should be displayed in Lines in the same graph. X axis(Country) is same for these two . I am not sure how to achieve this. Please do let me know if anyone has solution for this.
    Thanks for your time.
    Thanks & Regards,
    Raja

    Hi Andreas,
      One word I can say is 'Perfect' . Even though I am out of office now,I hope the example perfectly will solve my problem.I will try it.
    Thanks for Aduri and Pcrao also for their suggestions .
    Thanks again and I assigned points to all to say my thanks
    Regards,
    Raja

  • Join two source tables and replicat into a target table with BLOB

    Hi,
    I am working on an integration to source transaction data from legacy application to ESB using GG.
    What I need to do is join two source tables (to de-normalize the area_id) to form the transaction detail, then transform by concatenate the transaction detail fields into a value only CSV, replicate it on the target ESB IN_DATA table's BLOB content field.
    Based on what I had researched, lookup by join two source tables require SQLEXEC, which doesn't support BLOB.
    What alternatives are there and what GG recommend in such use case?
    Any helpful advice is much appreciated.
    thanks,
    Xiaocun

    Xiaocun,
    Not sure what you're data looks like but it's possible the the comma separated value (CSV) requirement may be solved by something like this in your MAP statement:
    colmap (usedefaults,
    my_blob = @STRCAT (col02, ",", col03, ",", col04)
    Since this is not 1:1 you'll be using a sourcedefs file, which is nice because it will do the datatype conversion for you under the covers (also a nice trick when migrating long raws to blobs). So col02 can be varchar2, col03 a number, and col04 a clob and they'll convert in real-time.
    Mapping two tables to one is simple enough with two MAP statements, the harder challenge is joining operations from separate transactions because OGG is operation based and doesn't work on aggregates. It's possible you could end up using a combination of built in parameters and funcations with SQLEXEC and SQL/PL/SQL for more complicated scenarios, all depending on the design of the target table. But you have several scenarios to address.
    For example, is the target table really a history table or are you actually going to delete from it? If just the child is deleted but you don't want to delete the whole row yet, you may want to use NOCOMPRESSDELETES & UPDATEDELETES and COLMAP a new flag column to denote it was deleted. It's likely that the insert on the child may really mean an update to the target (see UPDATEINSERTS).
    If you need to update the LOB by appending or prepending new data then that's going to require some custom work, staging tables and a looping script, or a user exit.
    Some parameters you may want to become familiar with if not already:
    COLS | COLSEXCEPT
    COLMAP
    OVERRIDEDUPS
    INSERTDELETES
    INSERTMISSINGUPDATES
    INSERTUPDATES
    GETDELETES | IGNOREDELETES
    GETINSERTS | IGNOREINSERTS
    GETUPDATES | IGNOREUPDATES
    Good luck,
    -joe

  • Formula that looks at two different fields

    Hi,
    I posted this request for help not too long ago but didn't clearly explain what is needed. 
    When text is entered into a field (currentgoal1, currentgoal2 - each equaling 1), the formula needs to look at a different field (point1, point 2 - each holds a list box of with points 1, 3, 5, or NA) to see if "NA" was chosen.  If NA was chosen (rather than a point, 1, 3, 5) then the goalcount (total number of populated currentgoal fields) needs to subtract 1 from goalcount.  
    currentgoal 1 = 1 point
    currentgoal 2 = 1 point
    currentgoal 3 = NA
    3 goals, 2 points, 1 point field with NA
    Since one of the current goals is has a point of NA, the overall count of currentgoals in the goalcount field (total number of populated currentgoal fields) should state 2 with the totalpoints field (all points fields added together) stating 2. 
    How can the formula be adjusted to subtract a currentgoal with a chosen point of NA? 
    Formula used now for counting current goals:
    goalcount = 0
    != null){
    = goalcount + 1;
    != null){
    = goalcount + 1;
    (Table3.Row3.currentgoal3.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row4.currentgoal4.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row5.currentgoal5.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row6.currentgoal6.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row7.currentgoal7.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row8.currentgoal8.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row9.currentgoal9.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row10.currentgoal10.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row11.currentgoal11.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row12.currentgoal12.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row13.currentgoal13.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row14.currentgoal14.rawValue!= null){
    = goalcount + 1;
    if(Table3.Row15.currentgoal15.rawValue!= null){
    = goalcount + 1;
    = goalcount;
    this.rawValuegoalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    goalcount
    if
    goalcount
    (Table3.Row2.currentgoal2.rawValue
    if
    goalcount
    (Table3.Row1.currentgoal1.rawValue
    if
    var

    Sorry, I was trying to edit. Is this better?
    var 
    goalcount = 0
    if
    (Table3.Row1.currentgoal1.rawValue
    != null){goalcount
    = goalcount + 1;}
     if(Table3.Row2.currentgoal2.rawValue!= null){goalcount
    = goalcount + 1;}
     if(Table3.Row3.currentgoal3.rawValue!= null){goalcount
    = goalcount + 1;}
    this.rawValue= goalcount;

  • How to save contents of two different rich edit box into single rtf file in windows 8.1 app

    Developer, I have requirement to save registration data into rtf file.. These can only be done by if I put rich edit box to fill the data.. Now if I am going to write the code for saving the data of different rich edit box into one particular file, it
    only saves the data of last rich edit box.. So plzz suggest that how can I save the contents of different rich edit box together into one rtf file.

    Ok Nishant, just did some quick research, since rtf file is unlike txt file, we cannot simply directly write some content to the rtf.
    You can try to find some third party code that can help you insert text into rtf file or you would like to load the content from rtf out to the richeditbox and merge them to one richeditbox and then save back to the file.
    You could like to see how to read/save rtf file sample from:
    RichEditBox class
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Help with creating multiple events for a single button

    I have a basic gui that is used to view a query. There is a JTextArea where the infromation from the query displays. Now i also have JTextAFields that correspond to each column from the table that i am querying from. I have an edit button that will t

  • I Have several pages in iWeb, but only want to host one of them on mobileme

    I've got four seperate web pages I've designed in iweb, but I only want one of them to be hosted by mobile me. How do I do this? It seems that it wants to post all of the pages to my account.

  • Iweb Movie not publishing

    I have been posting blogs and photo albums etc. to iweb without any problems. As soon as I try to post a movie I get "Publish failed due to a network error. Check your Internet connection and try again." My movie is only 2mb. I have posted to idisk a

  • How to implement Stored procedure in OBIEE

    Hi experts How to implement Stored Procedure in OBIEE.. My Input is Date.. Thanks in advance Regards Frnds

  • Help! How find PLUG-Ins in Photoshop//Scanner?

    Ok;;; Now I have my Master Collection  CS6  from ADOBE all installed....... my system is 10.6.8 S Leopard...and I'm on my MAC PRO::: and I have my 17 x 22 EPSON SCANNER all hooked up;   Before, when  I had opened photoshop in CS 4,  I pulled down the