Concatenation Problem

Hi,
i'm having an issue with concatenating 4 string fields into 2 variables.  User fills out form LastName; FirstName; MI; Suffix (Jr., Sr., etc.).  i grab these with an onblur event and rebuild the names to a 'reverse name' and a 'full name'.  If the Suffix is empty (< 1) don't add commas or the Suffix.  If it has an entry add commas.  My problem is that it always adds commas.  i can't figure out why.
Code looks like this:
=================================
var vRevName = getField("revname");              //var p = getField("revname");
var vReqEmail = getField("reqemail");            //var q = getField("reqemail");
var vLname = getField("Lname");                  //var r = getField("Lname");
var vFname = getField("Fname");                  //var s = getField("Fname");
var vMI = getField("MI");                        //var t = getField("MI");
var vSuffix = getField("Suffix");                //var u = getField("Suffix");
var vRank = getField("Rank");                    //var v = getField("Rank");
var vFullName = getField("fullname");            //var w = getField("fullname");
//Create e-mail name from typed name
if (vRank.value != 'Ctr') {
   vReqEmail.value = vFname.value + '.' + vLname.value + '@abc.com';}
else {
   vReqEmail.value =  vFname.value + '.' + vLname.value + '[email protected]'[email protected]';}
//Create 'reverse' and 'full' name from typed name
if (vSuffix.length < 2) {
    vRevName.value = vLname.value + ', ' + vFname.value + ' ' + vMI.value + '., ' + vSuffix.value;
    vFullName.value = vLname.value + ', ' + vFname.value + ' ' + vMI.value + '., ' + vSuffix.value + ', ' + vRank.value;}
else {
    vRevName.value = vLname.value + ', ' + vFname.value + ' ' + vMI.value + '.';
    vFullName.value = vLname.value + ', ' + vFname.value + ' ' + vMI.value + ', ' + vRank.value;}
=================================
i've tried testing the vSuffix for blank, < 1, > 0, and every permutation i can think of but even with NO suffix i still get a vRevName and vFullName with commas where i don't want them.
vRevName = Hominygrits, Hojo B., , CMSgt
vFullName = Hominygrits, Hojo B.,
i'm sure it's something i'm overlooking, but can't see.
Any ideas?
Thanks,
Dave

One may also need to deal with missing name fields or a no value field like the MI or Suffix and having to adjust for the missing not use the following separator for the missing data
This can be addressed by document level functions to concatenate the fields and add the separater as required. And then create a function to build the necessary strings form the forms fields.
// document level scripts
// Concatenate up to 3 strings with an optional separator where needed
function fillin(s1, s2, s3, sep) {
Purpose: concatenate up to 3 strings with an optional separator
inputs:
s1: required input string text or empty string
s2: required input string text or empty string
s3: required input string text or empty string
sep: optional separator string
returns:
sResult concatenated string
// variable to determine how to concatenate the strings
  var test = 0; // all strings null
  var sResult; // result string to return
// force any number string to a character string for input variables
  s1 = s1.toString();
  s2 = s2.toString();
  s3 = s3.toString();
// if sep is missing - null the sep parameter
  if (sep == undefined) sep = '';
assign a binary value for each string present
and adds this value to compute a value used to
determine which action to be taken.
The value is computed using a binary representation for present(1) and not present(0).
  if (s1 != "") test += 1; // string 1 present add binary value: 001
  if (s2 != "") test += 2; // string 2 present add binary value: 010
  if (s3 != "") test += 4; // string 3 present add binary value: 100
  /* return appropriate string combination based on
  calculated test value as a binary string
  switch (test.toString(2)) {
  case "0": // no non-empty strings passed - binary 0
     sResult = "";
  break;
  case "1": // only string 1 present - binary 1
     sResult = s1;
  break;
  case "10": // only string 2 present - binary 10
     sResult = s2;
  break;
  case "11": // string 1 and 2 present - binary 1 + 10
     sResult = s1 +  sep +  s2;
  break;
  case "100": // only string 3 present - binary 100
     sResult = s3;
  break;
  case "101": // string 1 and 3 - binary 1 + 100
     sResult = s1 + sep +  s3;
  break;
  case "110": // string 2 and 3 - binary 10 + 100
     sResult = s2 + sep + s3;
  break;
  case "111": // all 3 strings  - binary 1 + 010 + 100
     sResult = s1 + sep + s2 + sep + s3;
  break;
  default: // any missed combinations
     sResult = "";
  break;
return sResult;
function BuildNames() {
var vLname = this.getField("Lname").value;                  //var r = getField("Lname");
var vFname = this.getField("Fname").value;                  //var s = getField("Fname");
var vMI = this.getField("MI").value;                        //var t = getField("MI");
if (vMI != '') vMI +='.';  // add ".'
var vSuffix = this.getField("Suffix").value;                //var u = getField("Suffix");
var vRank = this.getField("Rank").value;                    //var v = getField("Rank");
var vReqEmail = '';            //var q = getField("reqemail");
var vFullName = '';
var vRevName = '';
// minimum field names for building concatenated strings
if(vRank != '' & vFname != '' & vLname != '') {
console.println(vRank + ' '  + vFname + ' ' + vMI + ' ' + vLname + ' ' + vSuffix);
//Create e-mail name from typed name
if (vRank != 'Ctr') {
   // First.Last
   vReqEmail = fillin(vFname, vLname, '', '.');
   // (First.Last)@abc.com
   vReqEmail = fillin(vReqEmail,'@abc.com', '', '');
   } else {
   // [email protected]
   vReqEmail =  fillin(vFname, vLname, '[email protected]', '.');
//Create 'full' name from typed name
// First MI Last
vFullName = fillin(vFname, vMI, vLname, ' ');
// (First MI Last), Suffix, Rank
vFullName = fillin(vFullName, vSuffix, vRank, ', ');
// Create RevName
// First MI   
vRevName = fillin(vFname, vMI, '', ' ');
// Last, (First MI), Suffix
vRevName = fillin(vLname, vRevName, vSuffix, ', ');
// (Last, First MI, Suffix), Rank
vRevName = fillin(vRevName, vRank, '', ', ');
// fill in fields with built strings
this.getField("reqemail").value = vReqEmail;
this.getField("fullname").value = vFullName;
this.getField("revname").value = vRevName;
return;
// end of doucment level scripts
Then one only needs to call the "BuildNames()" function in each of the input name and rank fields. The fields will fillin when the minimum amount of data is present and adjust for a missing MI. One would use the following scirpt in the "On Blur" action:
// fillin the name fields
BuildNames();

Similar Messages

  • Concatenating problem

    Can anyone suggest a good resource for learning all the rules
    of concatenating in AS 2.0? I did a quick search online and here
    but there are tons to sift through. I'd really like to "get" this.
    I keep running into problems in my projects with this and try
    things several different ways but usually just end up staring at
    the monitor and scratching my head. For instance, right now...
    Can't get this:
    picHolder_mc.loadMovie(PICPATH+"aIns"+i+[yearIndex][currentIndex]);
    //where the "1" is replaced with an index
    To function the same way as:
    picHolder_mc.loadMovie(PICPATH+aIns1[yearIndex][currentIndex]);

    aniebel wrote:
    > Can anyone suggest a good resource for learning all the
    rules of
    > concatenating in AS 2.0? I did a quick search online and
    here but
    > there are tons to sift through. I'd really like to "get"
    this.
    >
    > I keep running into problems in my projects with this
    and try things
    > several different ways but usually just end up staring
    at the monitor
    > and scratching my head. For instance, right now...
    >
    > Can't get this:
    >
    picHolder_mc.loadMovie(PICPATH+"aIns"+i+[yearIndex][currentIndex]);
    > //where the "1" is replaced with an index
    >
    > To function the same way as:
    >
    picHolder_mc.loadMovie(PICPATH+aIns1[yearIndex][currentIndex]);
    Can't you have alns as the array instead of alns1, alns2,
    etc? Then you'd
    use it like
    picHolder_mc.loadMovie(PICPATH+aIns[ i
    ][yearIndex][currentIndex]);
    Andrew

  • Frustrated with concatenation problem, please help!!

    To simplify the senario:
    I have 2 binding variables, V_Field1 and V_Field2, and a lexical parameber P_SELECT
    In the After Form triger
    :P_SELECT := :V_Field1||CHR(32)||:V_Field2
    The SQL is
    SELECT &P_SELECT AS GROUP1 ......
    The point is that I want to select 2 fields together with a space between them, such as LName||' '||FName AS Name, for some reason I always get an "Invalid Number" error when the query is run.
    The query runs fine if :P_SELECT := :V_Field1||:V_Field2
    How can I put a space between V_Field1 and V_Field2!!??
    Thanks

    Hi, Splazm
    Thanks for the reply. I didn't try your 2nd solution. But I know the 1st one would return "invalid number."
    My conlusion is that a concatenated select field in report builder SQL must contain same datatype. The thing is I don't understand "why" ? A select statement such as select 111||' '||222 from dual would work fine in sqlplus. But similar situation wouldn't work in Report. I cannot even use to_char(111)||' '||to_char(222) in Report.
    Anyways, I finally got to work around it. My solution is to write a SQL as follow
    SELECT &P_SELECT
    FROM (SELECT to_char(column1) AS col1,
    to_char(column2) AS col2,
    FROM tableA)
    In the After Form Trigger
    :P_SELECT := :P_SELECT||'||chr(32)||'||:V_FIELD2;

  • Error with the data format in the TXT file, sending as an Email attachment

    Hi all,
    I have an problem in the data formating in the TXT file while sending as an attachment via an email by using the FM "SO_DOCUMENT_SEND_API1".
    For eg:
    The data in the TXT file is looking like as follows:
    0 0 0 0 2        L O U D S P E A K R   O T H E R   3 8 W h i t e                  0 0
    0031  L O U D S P E A K R   O T H E R   3 8 Black                               0 000
    38    L O U D S P E A K R   O T H E R   3 8 Brown                                  0 00040
    L O U D S P E A K R   O T H E R   3 8 Brown                                         0 00042
    and so on
    But it should come as :
    0 0 0 0 2  L O U D S P E A K R   O T H E R   3 8 W h i t e
    0 0 0031   L O U D S P E A K R   O T H E R   3 8 Black
    0 00038    L O U D S P E A K R   O T H E R   3 8 Brown
    0 00040    L O U D S P E A K R   O T H E R   3 8 Brown
    All the internal tables are correctly filled.
    The code is as follows:
    gwa_objtxt = 'Please find attached DATA EXTRACT Sheet'.
      append gwa_objtxt to git_objtxt.
    describe table git_objtxt lines gv_cnt.
      clear git_doc_data.
      read table git_objtxt index gv_cnt.
      git_doc_data-doc_size = ( gv_cnt - 1 ) * 255 + strlen( gwa_objtxt ).
      git_doc_data-obj_langu = sy-langu.
      git_doc_data-obj_descr = lv_mtitle.
      append git_doc_data.
      clear git_packing_list.
      refresh git_packing_list.
    git_packing_list-transf_bin = space.
      git_packing_list-head_start = 1.
      git_packing_list-head_num = 0.
      git_packing_list-body_start = 1.
      git_packing_list-body_num   = gv_cnt.
      git_packing_list-doc_type = 'RAW'.
      append git_packing_list.
      Clear : gv_cnt.
      Describe table git_objbin lines gv_cnt.
      git_packing_list-transf_bin = 'X'.
      git_packing_list-head_start = 1.
      git_packing_list-head_num = 1.
      git_packing_list-body_start = 1.
      git_packing_list-body_num = gv_cnt.
      git_packing_list-doc_type = 'TXT'.
      git_packing_list-obj_descr = 'ATTACH.TXT'.
      git_packing_list-obj_name = 'book'.
      git_packing_list-doc_size = gv_cnt * 255.
      APPEND git_packing_list.
      clear git_receivers.
      refresh git_receivers.
      git_receivers-receiver = gv_eid.
      git_receivers-rec_type = 'U'.
      append git_receivers.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = git_doc_data
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          PACKING_LIST               = git_packing_list
          CONTENTS_BIN               = git_objbin
          CONTENTS_TXT               = git_objtxt
          RECEIVERS                  = git_receivers
        EXCEPTIONS
          TOO_MANY_RECEIVERS              = 1
          DOCUMENT_NOT_SENT                = 2
          DOCUMENT_TYPE_NOT_EXIST      = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR                    = 5
          X_ERROR                                      = 6
          ENQUEUE_ERROR                        = 7
          OTHERS                                        = 8.

    please give the code of
    contents bin =  git_objbin " how  this is getting populated.
    0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>
    0031 L O U D S P E A K R O T H E R 3 8 Black
    0 000
    38
    from this im not able to understand is this over population or concatenation problem
    y dont u make a append to the final table
    like
    data : begin of itxt occurs 0, ,
    s1(132) type c ,
    end of itxt.
    loop at itab.
    itxt-s1+0(4) = itab-f1.
    itxt-s1+4(6) = itab-f2.
    itxt-s1+10(8) = itab-f3.
    itxts1+18(4) = itab-f4.
    append itxt.
    clear itxt.
    endloop.
    exchange this to the contents bin of hte Fm .
    regards,
    vijay.
    can u please mail the text file and the expected o/p to my mail id [email protected]  so that i can see the same from the data provided i m not able to check the result properly .

  • Error with the resource file in Struts

    Hi
    i am working on small struts applications . when i am running my application in tomcat it throwing a error like
    javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:682)
         org.apache.jsp.userRegistration_jsp._jspService(userRegistration_jsp.java:99)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:294)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    My ApplicationResources.properties file is in my package like (WEB-INF/classes/strutsTutorial/) . I gave a path in web.xml like below
    <init-param>
         <param-name>Application</param-name>
         <param-value>strutsTutorial.ApplicationResources</param-value>
    </init-param>
    Can any one help
    Thanks in advance
    Ram

    please give the code of
    contents bin =  git_objbin " how  this is getting populated.
    0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>
    0031 L O U D S P E A K R O T H E R 3 8 Black
    0 000
    38
    from this im not able to understand is this over population or concatenation problem
    y dont u make a append to the final table
    like
    data : begin of itxt occurs 0, ,
    s1(132) type c ,
    end of itxt.
    loop at itab.
    itxt-s1+0(4) = itab-f1.
    itxt-s1+4(6) = itab-f2.
    itxt-s1+10(8) = itab-f3.
    itxts1+18(4) = itab-f4.
    append itxt.
    clear itxt.
    endloop.
    exchange this to the contents bin of hte Fm .
    regards,
    vijay.
    can u please mail the text file and the expected o/p to my mail id [email protected]  so that i can see the same from the data provided i m not able to check the result properly .

  • Data merge - can you insert multiple fields at once?

    Hi,
    I'm using InDesign CS4.
    I'm automating a series of reports using Data Merge from a CSV file. Each row in the CSV file holds the data for each individual report - 135 reports in total.
    The thing is, each report contains a text comments from some research interviews - but some reports have maybe 10 or so comments, others have over 600! The fields are called comment001, comment002 ... right up to comment620 (or so).
    InDesign only seems to let me insert fields from the Data Merge one at a time - it won't let me Shift-select a range of fields ... the alternative is to manually insert about 620 fields one click at a time!! Ouch...
    Does anyone know of a way around this?
    (Hope I've explained the problem properly!)
    Cheers,
    F13

    We see a few Adobe employees from time to time, notably Dov Isaacs and occasionally Matthew Laun (from the InDesign development team), but they are here on their own time and in an unofficial capacity, though they are extremely helpful when they do drop in. Employees are encouraged, at least on the ID team, to monitor the forums, but not necessarily to participate, so they probably do see most of the reported problems, but their jobs are to do development, not provide tech support, and I for one would rather they spend their time fixing bugs and developing new features than have them actively engaging in these threads.
    And rest assured that Adobe appreciates the work that the user community is doing here. It's no secret that we are far better than the free telephone tech support, largely becasue we work with the programs every day while the suppot contractor only has relatively untrained folks reading from the knowledebase unless you can get escalated very high up the chain.
    As for the feature request, by all means file it. I think you are correct that it would be nice, though I can see some issues, too, like how do you decide how multiple fields will be strung together (one after another would be the same as your concatenation problem and using separate lines might not be approprtiate in all cases, either). The place to file is Adobe - Feature Request/Bug Report Form

  • Problems with concatenated primary key

    Hi all,
    I am trying to create cache groups of single tables. When I create a cache group (using the browser based cache admin tool) for a table that has a single row primary key, there are no problems. After creating the cache group I can go to TTISQL and issue a select statement of that table to see all the rows.
    However if I create a Cache group in the same way for a table that has a concatenated primary key (using two columns), TimesTen does indeed says that the cache group is created, but then when I issue a SELECT statement for that table in TTISQL, I get "0 rows returned".
    What could be going wrong ? Please advice.
    Thanks in advance

    if you describe the cache group in ttIsql (just enter 'cachegroups;' and hit return) what do you see?
    What message do you get back if you load the cache group in ttIsql:
    load cache group <cgname> commit every 100 rows;

  • Problem with field GL Account is that it shows concatenated Chart of Accoun

    Hello . Please help me. We have sap BI olap universe . problem with field GL Account is that it shows concatenated Chart of Accounts. But user want to trim the chart of account and show only account in list of values in webi report.
    So What code I can put in Universe to remove this " 9000/" WHICH IS Chart of acct from GL Account
    example List of values shows
    9000/99030
    9000/99070
    I want to show as below
    99030
    99070
    I tried replace function in universe it does not work. Pls help.
    Thanks
    soniya

    Hi,
    You can do it in Web Intelligence using the function Right().
    Depending on the SAP BW version you have it is possible to build such calculated expression in universe on uniquename or name:
    <EXPRESSION>RIGHT[0CALMONTH].currentmember.uniquename,5)</EXPRESSION>
    OR
    <EXPRESSION>RIGHT([0CALMONTH].currentmember.name,5)</EXPRESSION>
    You have to replace 0CALMONTH by the unique definition of GL Accounts and you also need to use the object referencing GL Accounts in your query in addtion to the calculated expression.
    Regatds
    Didier

  • Problem with concatenation, need output in a desired format

    Hi all,
    I have a weird problem with concatenation.
    I should get an output in such a way that the result would be
    Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml
    For this first to get C:\TEMP\test20090210.xml format I said
    CONCATENATE  'C:\TEMP\test' sy-datum '.XML' INTO filepath.
    For this secondly to get /FOLDER1/test20090210.xml format I said
    CONCATENATE  '/FOLDER1/test' sy-datum '.XML' INTO filepath1.
    Now I need to get the format
    Put C:\TEMP\test20090210.xml  /FOLDER1/test20090210.xml
    And to get this I said
    CONCATENATE  'put' filepath INTO  filepath SEPARATED BY space.
    And the output for filepath was Put C:\TEMP\test20090210.xml.
    But I want u2026u2026u2026.Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml.
    How can I achieve this?
    If I say
    CONCATENATE  filepath INTO  filepath1 SEPARATED BY space. It throws a syntax error saying
    u201CUnable to interpret filepathu201D
    Please help me..i am dying to figure out how to concatenate and get the required output.
    My filepath contains u2026 Put C:\TEMP\test20090210.xml
    My filepath1 contains u2026/FOLDER1/test20090210.xml
    I need final output asu2026u2026u2026u2026.
    Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml
    How to attain this..please helpu2026where I am going wrong..i declared filepath and filepath1 as STRING

    Hi all,
    Thanks for immediate reply...now it works..
    but i also need to put a counter like thing to distinguish my files.
    for my filepath....
    i want it as C:\TEMP\test20090210110146 so i said....
    CONCATENATE '    C:\TEMP\test'    sy-datum s   y-uzeit  '.XML'.
    Actually i am generating XML files and naming them as testsystemdatesystemtime.
    But i am concerend that my filed might be overwrriten if a file gets generated in a fraction of a millisecond..so to avoid that now i want to put a counter.
    i.e my filepath should now be as follows each time loop executes...
    C:\TEMP\test20090210110146_1
    C:\TEMP\test20090210110147 _2
    C:\TEMP\test20090210110148 _3.........and son on how can i do it
    i.e testsystemdatesystemtime+ a counter(which tells how many times loop executed)
    Once again thanks to all for immediate help...

  • Problems with Concatenating Binary Data

    Hi
    I am experiencing a problem with the unreliable concatenation of binary data.
    I have a stored procedure that I wrote to perform cell encryption on long text fields (> 4000 characters in length). This takes the string, splits it into chunks of a set length, encrypts and concatenates the encrypted chunks into a varbinary(max) variable.
    It then stores the length of the encrypted chunk at the beginning of the data (the length of output when encrypting strings of a set length is always be the same), e.g.
    DECLARE @output VARBINARY(MAX), @length INT
    SELECT @length = LEN(@encryptedchunk1)
    SELECT @output = CONVERT(binary(8), @length) + @encryptedchunk1 + @encryptedchunk2 + @encryptedchunk3 + ...
    So far so good, and when I decrypt the data, I can read the first 8 bytes of data at beginning of the binary data to get the length of the chunk:
    -- get the length of the encrypted chunk
    SELECT @length = CONVERT(INT, CONVERT(binary(8), LEFT(@encrypteddata, 8)))
    -- then remove the first 8 bytes of data
    SELECT @encrypteddata = CONVERT(VARBINARY(MAX), RIGHT(@encrypteddata, LEN(@encrypteddata) - 8))
    <snip> code to split into chunks of length @length and decrypt
    </snip>
    This is where I am experiencing an issue. 99.4% of the time, the above code is reliable. However, 0.6% of the time this fails for one of two reasons:
    the length is stored incorrectly. The length of the encrypted chunks is usually 4052 and substituting 4052 for the returned value (4051) allows the encrypted chunks to be decrypted.
    the encrypted data sometimes starts at offset 8 instead of 9. The @length variable is correctly read at length 8 but only 7 bytes should be removed from the start, e.g.
    SELECT @length = CONVERT(INT, CONVERT(binary(8), LEFT(@encrypteddata, 8)))
    SELECT @encrypteddata = CONVERT(VARBINARY(MAX), RIGHT(@encrypteddata, LEN(@encrypteddata) - 7))
    Has anyone any ideas on why this is happening and how the process can be made more reliable?
    Julian

    Use datalength, not len. Len() is designed for character strings and will ignore trailing bytes. And count characters. Datalength does exactly what you want: it counts bytes. Look at this:
    DECLARE @b varbinary(200)
    SELECT @b = 0x4142434420202020
    SELECT @b, len(@b), datalength(@b)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Problems with concatenation

    Hello. I'm creating a program to do synthetic division. However, I seem to be having problems in my output, as my concatenations aren't working as expected.
    (I'm still at the rough stages of my program so rough codes will be all I'll be able to post)
    My code:
    public String divide(){
                String quotient = "";
                int dividendLength = dividend.length;
                int forMultiplication = dividend[dividendLength - 1];
                int exponent = dividendLength - 2;
                int forAddition = forMultiplication * divisor;
                quotient = forMultiplication + varUsed + "\\^" + exponent;
                exponent--;
                System.out.println("The quotient so far: " + quotient);
                System.out.println("forMultiplication: " + forMultiplication);
                System.out.println("varUsed: " + varUsed);
                System.out.println("caret: " + "\\^");
                System.out.println("exponent: " + exponent);
                int i = dividendLength - 2;
                while(i > 0){
                    forMultiplication = dividend[i] + forAddition;
                    forAddition = forMultiplication * divisor;
                    quotient += " " + forMultiplication + varUsed + "\\^" + exponent;
                    System.out.println("The quotient so far: " + quotient);
                    i--;
                    exponent--;
                return quotient;
            }Testing it on x^3 -12x^2 -32 / x -3, I get the following:
    The quotient so far: 121\^2
    forMultiplication: 1
    varUsed: x
    caret: \^
    exponent: 1
    The quotient so far: 121\^2 -9x\^1
    The quotient so far: 121\^2 -9x\^1 -27x\^0My questions: How come I'm getting "21" in lieu of "x" in the first term of my output? Also, how do I print out a caret cleanly? When I try to compile with only a single backslash (id est, using the escape sequence "\^" instead of "\\^" as coded above), I get an error. Is there anything I'm missing here?
    On the "21 instead of x issue": Does 21 bear any special meaning when it comes to characters/strings? Like maybe something special for regex or ascii? I'm suspecting that there is a mistake in my polynomial parsing, although I also did println's for them and they all turn out as expected.
    Note: For this rough draft, I'm expecting the output: "1x^2 -9x^1 -27". The actual (and well-formatted, for which I am gunning for) answer is x^2 -9x -27 remainder 123.
    Thanks in advance for any insight!

    Hi paulcw. I don't know what you exactly mean by "don't quote caret". In any case, your post gave me the idea to the solution. I made the caret a character. (If that is what you mean well, the message did get through. Thanks. ^_^)
    I also managed to solve the 21 issue!
    See I changed the quotient assignment outside the while loop to,
    quotient += forMultiplication + varUsed + '^' + exponent;And, I'd get
    The quotient so far: 217
    forMultiplication: 1
    varUsed: x
    caret: ^
    exponent: 1"217" made me wonder for a while. Then it dawned on me: I am assigning an int, char, char, int to a String, initially "". Java is adding them, not concatenating. So, I changed my code to
    quotient += "" + forMultiplication + varUsed + '^' + exponent;And got just what I expected.
    Thanks a lot!

  • Problem with concatenation

    Hi All,
    I have 9 fields with different different lenghts. Now when I am trying to concatinate all the fields just values are concatenated which while displaying give improper results.
    Now what I want is if two fields having length of 25 and 15 respectively so on concatinating it should display result as 40 whatever the length of value is there in these fields. Lets take example: -
    Text1 = 'Problem' (Char 25)
    Text2 = 'Solving' (Char 15)
    then result should be 'Problem                  Solving        '
    I have already tried Respecting Blanks but it is giving me error saying in character mode or in byte mode or separated by expected.
    <removed_by_moderator>
    Edited by: Julius Bussche on Sep 8, 2008 12:20 PM

    Hi,
    data:
       Text1 type c length 25 value 'Problem',
       Text2 type c length 15 value 'Solving',
       text3 type string.
    CONCATENATE text1 text2
                INTO text3 separated by space.
                write: text3.
    Regards,
    Sravanthi

  • Problem with concatenating space character. Please help!

    Hi experts,
      I have requirement for creating fixed length data like this:
      Source Material.
      I am getting source value dynamically. Max size of source in 10.
    But sometime it may come as 'EMS01' and sometimes 'PLTN'. That its value can be of varied length.
    I need to concat Source and Material with space in between. The number of spaces in between is equal to 10 - current size.
    For example: If Source = 'EMS01'
       then there should be 5 spaces between source and material.
    If  source = 'PLTN'
    then there should be 6 spaces between source and material after concatenation.
    I tried like this:
    data: v_source(10),
            v_material(8),
            v_space(9),
            v_spclen type i.
    v_spclen = 10 - STRLEN( v_source ).
    DO v_spclen TIMES.
       v_space = v_space + ' '.
    ENDDO.
    CONCATENATE v_source v_space v_material INTO v_string.
    This does not work because it is putting number 0 in v_space value.
    How to resolve this? Please help!
    Thanks
    Gopal

    Hi,
    Try This.
    data: v_source(10),
           v_material(8),
           v_space(9),
           v_string(255) type c,
           v_spclen type i,
            v_spclen1 type i.            * Delcare  one more variable. This will contain Length of field  v_string after assign V_source to it.
      v_spclen = 10 - STRLEN( v_source ).
    v_string = V_source.
    CONDENSE v_string.
    v_spclen1 =  STRLEN( v_string ).
    v_spclen1 = v_spclen1 + v_spclen.   *   I have Added v_spclen1 and v_spclen to get exact position from where i will add v_material
    v_string+v_spclen1 = v_material.
        write v_string.
    Edited by: ShreeMohan Pugalia on Jul 24, 2009 3:13 PM

  • Problem with concatenated data store and VACHAR(4000) field

    Have a concatenated data store built from 18 columns in one table. The main column for the index is a VARCHAR(4000) field. When we insert more than 3215 characters in that field the row disappers from the index, 3215 characters or less works fine.
    Anyone know why?

    hi,
    If you want to display them in an input field you will need to use expression box and use the formula as store@datastorefield.
    if you want to display in the Plain text go to the display tab in the properties of plain text and use the same formula here, in plain text you can only display the values present in the datastore.
    Regards,
    Rk.

  • Fuzzy searching and concatenated datastore query performance problems.

    I am using the concatenated datastore and indexing two columns.
    The query I am executing includes an exact match on one column and a fuzzy match on the second column.
    When I execute the query, performance should improve as the exact match column is set to return less values.
    This is the case when we execute an exact match search on both columns.
    However, when one column is an exact match and the second column is a fuzzy match this is not true.
    Is this normal processing??? and why??? Is this a bug??
    If you need more information please let me know.
    We are under a deadline and this is our final road block.
    TIA
    Colleen GEislinger

    I see that you have posted the message in the Oracle text forum, good! You should get a better, more timely answer there.
    Larry

Maybe you are looking for

  • How to save Jobs with different priority level in a Queue?

    Hi, Friends, I have a set of Job (see below) objects. I would make a queue: if they have the save priority level, first in and first out. this is easy to do by ArrayList. however, If they have different priority level, I would like make the Jobs with

  • Computer no longer sees DVD or Zip drives

    Hey there all, Here's one for you. I have a G4 Gigabit Ethernet that I've upgraded with a Powerlogix 1.4 Ghz processor and an ATI Radeon 9800 Pro. The two drives that came with the computer (the Zip 100 and the DVD-ROM) have stopped working. I can't

  • I am unable to install ios 5  AAARRRGGGHHH

    I'm connecting my i phone 4g the computer asks me do i want to install the new version ios 5. I click update. I then have a box come up staying backing up i phone with a green bar running through. Underneath itunes it states syncing "i phone" then un

  • Graph in BEX not displaying data for the selected range

    Hi Gurus, I am running a report for the calweek 200801-200840. But the graph is displaying value upto 200835. The data is available in the cube till 200840. Please help!! Thanks Nisha

  • Can I clear my repair and any past cases history in my Apple Support Profile?

    Pretty much as the head line says, you know that when you schedule a repair or open a selfsolve case it all gets to stay in there as a history in your apple support profile, and I'm wondering what If I would like to clean it? I want to give my profil