Problem with a string
Hi,
I have a report (made with crystal reports) in wich I have embedded a xcelsius dashboard. I am passing string values to that dashboard using a crosstab (I am forced to do this that way due to programming and database limitations). Examples of those string would be :
15426, 1000, 34567, ...
In my xcelsius model, i then extract each of the values to separate columns and use them to populate a table. I use FIND and MID functions to do so. I then get the following
CELL A1 : 15426
CELL A2 : 1000
CELL A3 : 34567
CELL A4 : =A1A2A3+A4
When i hit preview, i get all the values in my table exept the cell A4 value... its like xcelsius cant make the calculations passed a certain level .....
I tried to copy/paste the string directly in my xcelsius model with same results...
Thanks for your help guys
PS: Sorry for my real bad english... I tried my best to explain my problem...
hi ,
i have also same problem, in my case alll value are string type, now i want to change them in numeric in excel but i am not getting correct answer.
i tried a lot method, but they did not work, then i multiply every field with 1 and then add them in this case its showing value result but some time the result is wrong. i can findout whats the problem.
can anyone suggest how to change value from string to numeric in excel or what should i do.
regards,
PIyushGahlot
Similar Messages
-
Problem with output string to command
hey i have no idea why this aint working
its a simple output string to command.
what it is supposed to do is make a new directory given by the input string
e.g. mkdir /home/luke/dep
thanks for the help
//methods input save files
saveFile = JOptionPane.showInputDialog("Save Files To : ");
//method command for saving files
//Stream to write file
FileOutputStream fout;
try { Process myProcess = Runtime.getRuntime().exec("mkdir" + saveFile );
InputStreamReader myIStreamReader = new InputStreamReader(myProcess.getInputStream());
fout = new FileOutputStream ("file.txt");
while ((ch = myIStreamReader.read()) != -1) { new PrintStream(fout).print((char)ch); } }
catch (IOException anIOException) { System.out.println(anIOException); }What you fail to understand is that "aint working" and "Problem with output string to command" tells us absolutely squat about what your problem is. This is the same as saying to the doctor "I'm sick" and expecting him to cure you. As mentioned by Enceph you need to provide details. Do you get error messages? If so post the entire error and indicate the line of code it occurs on. Do you get incorrect output? Then post what output you get, what output you expect. The more effort you put into your question the more effort others will put in their replies. So until you can manage to execute a little common sense then the only responses you will get will be flames. Now is your tiny little brain able to comprehend that?
-
Hello, I am working on a program that converts Roman numerals to Arabic numbers and the opposite. I have the Arabic to Roman part down, yet Roman to Arabic part is causing troubles for me.
I know that there are many solutions out there, yet I would like just solutions within my code that would fix the problem it has.
Instead of the whole code, here's the method that changes Roman to Arabic.
//method to convert Roman numerals to Arabic numbers
public static int toArabic (String x)
int arabica=0;
char chars;
for (int y=0; y<=(x.length()-1); y++)
chars=x.charAt(y);
switch (chars)
case 'C':
if( x.length() == 1)
arabica+=100;
y++;
else if (x.charAt(y+1)=='M')
arabica+=900;
y++;
else if (x.charAt(y+1)=='D')
arabica+=400;
y++;
else
arabica+=100;
break;
case 'X':
if(x.length() == 1)
arabica+=10;
y++;
else if (x.charAt(y+1)=='C')
arabica+=90;
y++;
else if (x.charAt(y+1)=='L')
arabica+=40;
y++;
else
arabica+=10;
break;
case 'I':
if(x.length() == 1)
arabica+=1;
y++;
else if (x.charAt(y+1)=='X')
arabica+=9;
y++;
else if (x.charAt(y+1)=='V')
arabica+=4;
y++;
else
arabica++;
break;
case 'M':
arabica+=1000;
break;
case 'D':
arabica+=500;
break;
case 'L':
arabica+=50;
break;
case 'V':
arabica+=5;
break;
There's a problem with this, however, is that whenever I put something in like XX, CC, XXX, or II, the program says
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(String.java:687)
at RomanNumerals.toArabic(RomanNumerals.java:172)
at RomanNumerals.main(RomanNumerals.java:33)
I think this problem is caused by the if-else and else-if statements in my method for cases C, X, and I, as this problem doesn't come up when I do similar things to cases without the if statements. Could you perhaps find out what is causing this problem? I've been working on it for days after finishing the rest and I can't figure it out.
Thanksimport java.io.*;
public class RomanNumerals{
public static void main (String [] args)
DataInput keyboard=new DataInputStream (System.in);
String input;
try
//options
System.out.println("1. Roman numerals to Arabic numbers");
System.out.println("2. Arabic numbers to Roman numerals");
System.out.println("3. Exit");
System.out.print("Enter your option: ");
input=keyboard.readLine();
int choice=Integer.parseInt(input);
switch (choice)
//Roman numerals to Arabic numbers
case 1:
String romanInput, ro;
int answer1;
System.out.print("Enter a Roman numeral: ");
romanInput=keyboard.readLine();
ro=romanInput.toUpperCase();
answer1=toArabic(ro); //line 33 where the error occurs
System.out.println("The Arabic number is: "+answer1);
break;
//Arabic numbers to Roman numerals
case 2:
String arabicInput, answer;
System.out.print("Enter an Arabic number: ");
arabicInput=keyboard.readLine();
int arabic=Integer.parseInt(arabicInput);
answer=toRomans(arabic);
System.out.println("The Roman numeral is: "+answer);
break;
case 3:
break;
default:
System.out.println("Invalid option.");
catch(IOException e)
System.out.println("Error");
//method to convert Arabic numbers to Roman numerals
public static String toRomans (int N)
String roman="";
while (N>=1000)
roman+="M";
N-=1000;
while (N>=900)
roman+="CM";
N-=900;
while (N>=500)
roman+="D";
N-=500;
while (N>=400)
roman+="CD";
N-=400;
while (N>=100)
roman+="C";
N-=100;
while (N>=90)
roman+="XC";
N-=90;
while (N>=50)
roman+="L";
N-=50;
while (N>=40)
roman+="XL";
N-=40;
while (N>=10)
roman+="X";
N-=10;
while (N>=9)
roman+="IX";
N-=9;
while (N>=5)
roman+="V";
N-=5;
while (N>=4)
roman+="IV";
N-=4;
while (N>=1)
roman+="I";
N-=1;
return(roman);
//method to convert Roman numerals to Arabic numbers
public static int toArabic (String x)
int arabica=0;
char chars;
for (int y=0; y<=(x.length()-1); y++)
chars=x.charAt(y);
switch (chars)
case 'C':
if( x.length() == 1)
arabica+=100;
y++;
else if (x.charAt(y+1)=='M')
arabica+=900;
y++;
else if (x.charAt(y+1)=='D')
arabica+=400;
y++;
else
arabica+=100;
break;
case 'X':
if(x.length() == 1)
arabica+=10;
y++;
else if (x.charAt(y+1)=='C') //the line 172 where error occurs
arabica+=90;
y++;
else if (x.charAt(y+1)=='L')
arabica+=40;
y++;
else
arabica+=10;
break;
case 'I':
if(x.length() == 1)
arabica+=1;
y++;
else if (x.charAt(y+1)=='X')
arabica+=9;
y++;
else if (x.charAt(y+1)=='V')
arabica+=4;
y++;
else
arabica++;
break;
case 'M':
arabica+=1000;
break;
case 'D':
arabica+=500;
break;
case 'L':
arabica+=50;
break;
case 'V':
arabica+=5;
break;
return(arabica);
}When I put in XX as the input, this is what the error comes out as:
Enter a Roman numeral: XX
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(String.java:687)
at RomanNumerals.toArabic(RomanNumerals.java:172)
at RomanNumerals.main(RomanNumerals.java:33) -
Comma problem with global string variable
Hi,
I'm fiighting with comma problem for global string variable. I've on page string for example "7nndqrr52vzyb,0" and by dynamic column link I'm assigning this string to global variable. Then I'm trying to display value of that global variable on another page but I see only string till comma, nothings more. I'm not sure what I'm doing wrong because when I'm trying to assign that value normally by computation process as a constant value is fine and see on another page correct string. I'll be really glad for help.
Thanks
Cheers,
MariuszWhen it tries to display the string, it sees the comma and wants to believe the string is terminated. You could escape the , in the string or replace it with a different character..
See this link: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BEIGDEHF
Thank you,
Tony Miller
Webster, TX
If vegetable oil is made of vegetables, what is baby oil made of?
If this question is answered, please mark the thread as closed and assign points where earned.. -
hi
i am new here
2 days ago i was finish my database administrator course.-it mean that is the first course from 6(as much i know)
first you should know that english is not my lang so if i will maskes i am sorry
anyway after i am talking about me i will talk about my problem
i am trying to connect to sqlplus
after i click on this tool i get
user name:
pass:
host string:
i know that i need to go to the file tnsnames.ora and take from there the host string
i did that and after the parameter "host=" i saw the host string name.
after i did that i tried to connect with sysdba but without pass cuase if i conn with sysdba i dont need pass
in "host string " i write the host string accurding to the tnsnames.ora ang it doesn't work
as aresult i get a line that ask me the pass what sould i do?
tasks to all of you![b]"Host string" entry to connect through SQL*Plus is the SID entry from the tnsnames. Not the parameter host=...
This is the first parameter, something else like the following :
DEMO92 =
(DESCRIPTION =
(ADDRESS_LIST =...The host which you said is the hostname which is the host of the database, not thedatabase itself.
Nicolas. -
The problem with the strings Convert each other
Hello all,
Could you help me to solve the following problem using LV7.1? Thank in advance.
How can I convert a string of "hexadecimal value" with Normal display style to other string of " the same hexadecimal value" with Hex display style?
Best regards,
Evan_LvHi Evan,
look at the attachment
At the moment there is no error checking (any characters other than (0-9|A-F|a-f) will give an error; only even number of chars is converted). You can do the error checking as an exercise on your own!
Message Edited by GerdW on 08-21-2007 09:08 AM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
HexString.vi 22 KB -
Updated to CR 2008 - now have new problem with truncated String fields.
Hi there
I'm hoping someone has a simple answer for this one... notice there's a lot of it on forums but I haven't found an answer.
Since updating to Crystal 2008 (Crystal 12), we have found that some reports are suddenly truncating string fields at 255 characters, despite the field value being much longer in the database.
Does anyone know what to do to allow these fields to print in completion?
Database connection is ODBC RDO.
regards
-KarenWhat is the database Oracle, SQL server etc.
Can you query the database directly with another query tool, eg SQL Server Management Studion or SQL developer/Toad for Oracle.
You can then run the Crystal query directly and see if its your ODBC connection that is truncating the datafield or Crystal.
I have memo fields on SQL server with up to 2000 characters and these display in Crystal 2008 without any problem. We use ODBC (RDO) too.
Ian -
Problem with retriving string from mysql DB
hi,
i am storing kannada (india) string into mysql database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this problem..
thanks
dayahi,
i am storing kannada (india) string into mysql
database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this
problem..
thanks
daya
hi,
i am storing kannada (india) string into mysql
database, that column is
utf8_general_ci . when saw in db it showing ??????.
while retriving it also printing ?????.
what do with this problme, please help to solve this
problem..
thanks
dayayou should store the text (kannada-writing) not within a normal CHAR or VARCHAR field in the MySQL-Database. instead store it in a BLOB-field and then retrieve the String by String out=new String (rs.getBytes()); (the BLOB field is used like a Stream so make the appropriate preparations and it should work!
if not you can alter the above new String to new String(rs.getBytes(),"string-format"); where string-format is the iso-name for your language for instance for western europe "ISO-8859-1" -
Unmarshal problem with German Strings
Hi,
I am passing a String that its content is a UTF-8 encoded XML to
JAXB unmarchal method.
in some places the XML content contains,German letters ( <tag>german words</tag>).
after running unmarchal on these XML content the Geramn Strings got Gebrish.
the Geramn letters passed OK to the JAXB unmarchal method.
Please assist.
Thanks,
shimon.I have an umlaut problem also, but in my case I want to be rid of it. I am looking for an explanation of why some umluts appear within my Apex app. when moving PL/SQL between servers.
I am going from Server A workspace A (development) to Server B workspace B (production) with a PL/SQL package. When the package renders on Server B the umlauts show up on certain labels. I was able to trace it back to the PL/SQL code that replaced the   with a space when comparing Server A version to Server B. I had saved it from Server A using Toad and recompiled using SQL*PLUS into Server B. Once I found each occurrence of the space and replaced it the umlauts disappeared, which was great. But I was curious so I saved the package from Server B using Toad and recompiled it back into Server A and the umlauts appeared again within Apex labels.
It appears there are some differences between my servers, web servers, Apex, something else, etc., but it has so far eluded my detection. I compared all my NLS settings, in both databases and both DADS and they are identical. My O/S is identical, my Apex is the same (development apex running on both servers, same version). My workspace name is different and my schema name is different.
When I look at the source code using TOAD on the server the umlauts do not show and nor do they show when I save the package. It seems only when I go to a different server and recompile that the umlauts appear.
Anyone have ideas? Thanks.
Perry -
A record selection problem with a string field when UNICODE database
We used report files made by Crystal Reports 9 which access string fields
(char / varchar2 type) of NON-UNICODE database tables.
Now, our new product needs to deal with UNICODE database, therefore,
we created another database schema changing table definition as below.
(The table name and column name are not changed.)
char type -> nchar type
varchar2 type -> nvarchar2 type
When we tried to access the above table, and output a report,
the SQL statement created from the report seemed to be wrong.
We confirmed the SQL statement using Oracle trace function.
SELECT (abbr.) WHERE "XXXVIEW"."YYY"='123'.
We think the above '123' should be N'123' because UNICODE string
is stored in nchar / nvarchar2 type field.
Question:
How can we obtain the correct SQL statement in this case?
Is there any option setting?
FYI:
The environment are as follows.
Oracle version: 11.2.0
ODBC version: 11.2.0.1
National character set: AL16UTF16With further investigating, we found patterns that worked well.
Worked well patters:
Oracle version: 11.2.0
ODBC version: 11.2.0.1
National character set: AL16UTF16
Report file made by Crystal Reports 2011
Crystal Reports XI
Not worked patters:
Oracle version: 11.2.0 (same above)
ODBC version: 11.2.0.1 (same above)
National character set: AL16UTF16 (same above)
Report file made by Crystal Reports 2011 (same above)
Crystal Reports 2008 / 2011
We think this phenomenon is degraded behavior of Crystal Reports 2008 / 2011.
But we have to use the not worked patters.
Anything wrong with us? Pls help.
-Nobuhiko -
Problems with the Strings Urgent Help needed
I have a unique problem. I have to retrieve a particular value from a String. I tried using String tokeniser but in vain. I cannot use java.util.regex package to match the expressions as the version of java on the client m/c is 1.1.8 and they are not ready to upgrade the same.
The string From which I have is a very long one running into more than 100 lines which can vary from case to case all I know is to retrieve the value which is just in front of "TestValue" which occur only once in the String Can Anybody suggest a bettter alternative.
Thanx.
ebistrioStringTokenize on TestValueHow would you suggest that was done?
As I understand it StringTokenizer tokens = new StringTokenizer(string, "TestValue"); would not tokenize on the string "TestValue" but on any of the characters 'T', 'e', 's', 't', 'V', 'a', 'l' or 'u'. This is a common java pitfall in my opinion due to bady named parameters (I feel it should be called "delims" not "delim") or in other people's opinion due to bad parameter type (should be a char[] not a string).
A clearer explanation of the problem would help. -
ActionListener problem with the String and TextField in different packages.
i have the following string in the first file. This String text is changing values with the execution of the file
class Baby {
public static String Update="";
void tata() {
Update="Connecting...";
Update="Authenticating...";
Update="Getting data...";
....I want with the help (obviously) by an Action Listener to update constantly the value of a TextField. The Action Listener and the TextField are located both in another file and class.
UpdateTextField.addActionListener(actionListener);
UpdateTextField.setText(Baby.Update);Is it possible? I cant find a solution.
Any help would be appreciated.Well that is really something... If it wasn't for the<tt> Click here and press <Enter>, </tt>the GUI would have been soooo counter-ituitive. :)
I was actually trying to steer OP away from the ActionEvents in the first place. Frankly, I just see no need for it in his app. I was thinking along the lines of ...
import javax.swing.*;
public class Test
JLabel label;
public Test(){
label = new JLabel("Initializing...");
JFrame f = new JFrame();
f.getContentPane().add(label, "Center");
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
f.setBounds(0, 0, 200, 60);
f.setLocationRelativeTo(null);
f.setVisible(true);
LongProcess process = new LongProcess();
process.start();
class LongProcess extends Thread
int[] waitTimes = new int[]{
2000, 500, 2000, 500, 5000, 1000};
String[] operations = new String[]{
"Starting", "Connecting", "Connected",
"Reading", "Processing", "Done"};
public void run(){
try{
for(int i = 0; i < waitTimes.length; i++){
sleep(waitTimes);
updateLabel(i);
catch(InterruptedException ioe){
ioe.printStackTrace();
updateLabel(operations.length-1);
protected void updateLabel(final int index){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
label.setText(operations[index] + "...");
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new Test();
}... see how this approach rids the application from any Events being fired? See how OP can put his network connections and file reads on a separate thread -- then update the JLabel via SwingUtilities.invokeLater()? In my opinion, this would be a much better outline to OP's situation.
Disclaimer: I'm not saying this is the only approach, I'm sure there are other solutions -- and may even be better than this. -
Problem with a String[] variable
Hi
I'm reading values from a table and I need to store them in a String[] variable.
This example shows I would do it without accesing to the database: String[] data = new String[] {"a","b","c"};
Now, I want to do the same thing but reading it from a database table. I do know how to read each value from the table, the problem is that I'm not sure on how to concatenate the values in the string[].
Thank you all in advance =)
Yeseniaint count = triptypeDataProvider.getRowCount();
String[] triptypes = new String[count];
int row=0;
try {
triptypeDataProvider.cursorFirst();
do {
triptypes[row] = triptypeDataProvider.getValue("triptype.name").toString();
row++;
} while (triptypeDataProvider.cursorNext());
} catch (Exception ex) {
error("put your message here" +
ex.getMessage());
log("put your message here: " +
ex.getMessage(), ex);
} -
Please Help - Very strange problem with internal String encoding
I created a file in one-byte russian encoding cp1251 and declared String literal with 2 letters:
String str = "ab"; //attention! ab - two russian characters
After I got bytes from it - str.getBytes("cp1251") - it returned 2 byte's array.
Now I created a file with UTF-8 encoding with equal content and suddenly:
After I got bytes from it - str.getBytes("cp1251") - it returned 4! byte's array. Why?
I need to get a one-byte encoded arrays (cp1251 or koi8-r) but getBytes ALWAYS returns two-byte encoded arrays.
It is very strange: cp1251 is always one-byte encoded, but .getBytes("cp1251") returns two-byte on each letter. Why? Please help.I did not read a string from a file. I created 2 .java files with different encodings (cp1251 and UTF-8) and compiled them, telling compiler with -Dfile.encoding=*** to read them correctly. While execution java interprets two looking equal in editor strings as different objects with different .intern() representation.
Why java consider source .java file encoding while creating internal representation of String object and creates from looking equally in editor strings two DIFFERENT Unicode representations. And it is impossible to convert one representation to other - impossible to get two equal byte[] arrays. -
.ear problem with getRealPath(String path)
Repost from interest.servlet group
Hello all,
I am using weblogic 6.1/NT 4x
I have created .ear file which contains two files ejb-jar.jar and web.war which
has all jsps and other standard classes application uses.
I have followed guidelines in the documentation for creating the .ear file which
is under
Packaging Enterprise Applications @
http://edocs.beasys.com/wls/docs61/programming/packaging.html#1044277
I deployed this ear file in my applications directory through console.
Now my application needs to read image file from the
database and write it to the file system so that my
jsp pages can read the image file through html tag
<img src="/images/...">
When my MainServlet initializes I am calling the ServletConfig.getServletContext().getRealPath("/")
I am expecting this to return me the real path like http://localhost/ which it
does if I don't use ear file and do it traditional DefaultWebApp way. But in ear
file it returns me null because J2EE documentation clearly says : " This method
returns null if the servlet container cannot translate the virtual path to a real
path for any reason (such as when the content is being made available from a .war
archive). "
I wanted to know the workaround for this if anyone is aware of such problem.
Any feedback would be greatly appreciated.
thanks NafisRepost from interest.servlet group
Hello all,
I am using weblogic 6.1/NT 4x
I have created .ear file which contains two files ejb-jar.jar and web.war which
has all jsps and other standard classes application uses.
I have followed guidelines in the documentation for creating the .ear file which
is under
Packaging Enterprise Applications @
http://edocs.beasys.com/wls/docs61/programming/packaging.html#1044277
I deployed this ear file in my applications directory through console.
Now my application needs to read image file from the
database and write it to the file system so that my
jsp pages can read the image file through html tag
<img src="/images/...">
When my MainServlet initializes I am calling the ServletConfig.getServletContext().getRealPath("/")
I am expecting this to return me the real path like http://localhost/ which it
does if I don't use ear file and do it traditional DefaultWebApp way. But in ear
file it returns me null because J2EE documentation clearly says : " This method
returns null if the servlet container cannot translate the virtual path to a real
path for any reason (such as when the content is being made available from a .war
archive). "
I wanted to know the workaround for this if anyone is aware of such problem.
Any feedback would be greatly appreciated.
thanks Nafis
Maybe you are looking for
-
Xorg 1.8 and nvidia drivers 'nvidia-xconfig' NEED tip to fix
[what part of my xorg.conf needs to me moved, and to where?] Hi, I routinely swap between intel, savage, nvidia drivers running my ARCH install off my USB. Ok, so I'm using xorg 1.8 and the intel works though of course the nividia with nvidia-xconfig
-
I have Acrobat 9 installed (up to date) and when I use PDFMaker to convert a fairly large Word file (30 pages) it will freeze towards the end. I can use it on smaller files, and I can use the "built in" PDF converter that Word has on the large file
-
Iphoto starts but then quits.
Hey, The names Stu My iPhoto keeps quitting about 30 seconds after I start it up. I have seriously tried everything. here's the crash report, any ideas? Process: iPhoto [158] Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto Id
-
Retriving data using web dynpro
I want to make simple application whic stores data and retrive specified fields using web dynpro. can anyone provide tutorial link to do this
-
OATM on Oracle applicaitons 11.5.10.2
Friends - we are in process of tablespace migration using OATM Utility. so far i completed step 1 to step 7 from below items. Oracle Applications Tablespace Migration Utility Main Menu 1. Migration Sizing Reports 2. Create New Tablespaces 3. Generate