cancel
Showing results for 
Search instead for 
Did you mean: 

iCommand applet removing leading spaces from query output!!

Former Member
0 Kudos

Hi,

I am using an iCommand applet to retrieve data from a table. In some of the records we got values like ' xyz'(with initial spaces). But when I use document.appletname.getValue(1,1) to get value, then in that it is showing value as 'xyz' instead of ' xyz'. Please suggest what I need to do, if in case it is a bug. This is the product version 11.5.3 b66.

Thanks,

Ravi Kumar

Accepted Solutions (0)

Answers (3)

Answers (3)

jcgood25
Active Contributor
0 Kudos

In your Oracle query if you add a single character at the beginning and end of your column value then the standard applet trimming will not give you a problem. Then after .getValue() from the iCommand just strip off these 2 characters.

Regards,

Jeremy

Former Member
0 Kudos

Ravi, the applets always trim leading and trailing spaces from string data types (whereas when you view the query output directly, it will not trim them). Instead of using the iCommand object, use an AJAX-based approach and execute the query using the Illuminator servlet, returning the data as XML. I also have a working prototype of an MII action that returns an MII dataset as a JSON object (which makes client side scripting much easier).

Former Member
0 Kudos

Oh Ok. I thought it was bug. Then if trimming of spaces happens then it would cause lot of problems in my case.

Could you just through some more light on how that url will look like. Because I don't know what parameters I need to use for building the url. I searched the help file. But I didn't get that.

Once again thanks for that info.

Ravi Kumar.

0 Kudos

Ravi,

My first question is why would you have leading spaces? Generally that indicates data entry error.

Second, do you have direct access to the database? If so I would run a query in the database to see if the query also strips out the spaces. It may not be MII causing your data change.

Regards,

Mike

Former Member
0 Kudos

No I need this space. As xmii doesn't recognize clob type data type. I am parsing xml and keeping it in a table with column varchar2 datatype. And now I am querying that output and concatinating that one from client side script.

And sometimes during xml parsing I will get initial spaces in some of the records. So I need this space.

I have direct acces to database. I checked the select length(columnname) from tablename there in oracle as well as in querytemplate. Both are giving same output. But when I use it on page after assigning query to iCommand applet, then it is showing this problem.

Thanks,

Ravi Kumar

Former Member
0 Kudos

Not just that it is also removing ending spaces as well. I need these spaces both initial and ending to build the xml on client side script.

Thanks,

Ravi Kumar

0 Kudos

Ravi,

What I was asking you to do was to do a select on the field and see whether the spaces were kept as part of the output. I have run into circumstances where the select length will sometimes give correct results, but trailing spaces were removed. I don't remember which database it was, but it was easily proved to be happening. Please give it a try.

Thanks,

Mike

Former Member
0 Kudos

Hi Mike,

I checked the database in there. I got spaces inside those records. I am using Oracle 10g. I am quite sure there is no problem with data in database. Because I am able to see those spaces in queryoutput from query template. But I am not able to see from page.

Best Regards,

Ravi Kumar

0 Kudos

Ravi,

Let me make sure I understand this. When you run the query template by itself in the editor, it returns the spaces. But when you try to use the output in your web page, the spaces disappear. Can you do a concatenation in a query and see if the spaces remain between the two items being concatenated and pass that to the webpage?

Mike

0 Kudos

Check out this link and see if it might be your problem (and possibly your solution).

[Trimming white spaces|www.daniweb.com/forums/thread96869.html]

Former Member
0 Kudos

I will let u understand what I am doing. We need to build an xml from using the data residing in oracle database. We thought of using a stored procedure which will return clob type datatype. As xmii is not recognizing this datatype. We parsed this xml into small pieces of string of length 4000 char inside the stored procedure for returning it. When I make a call to this stored procedure from query template, I am getting the data, There is no problem with it. But sometimes it might consist spaces inside those returned output from stored procedure. These spaces are getting eliminated.

I will give some example data of the returned data.

"<?xml version='1.0' encoding='UTF-8'?><item id='100'"

" text='Process Performance Monitoring' im0='lightgreen.gif'"

............

If you see my above output. I need to have initial space in the second record, when I concatenate the data from client side script. or else it won't be of right format.

I guess this explains what I am doing.

Thanks,

Ravi Kumar.

0 Kudos

Hi Ravi,

I think I understand what you are doing. From what I am reading, it looks like it may be a an html issue. My previous link does not apply.

This from [http://www.w3schools.com/html/html_primary.asp]

"HTML will truncate the spaces in your text. Any number of spaces count as one. Some extra information: In HTML a new line counts as one space. "

I suspect that it is trimming spaces where you don't want it too, including the leading spaces and trailing spaces. It should be pretty easy to test this directly in html.

Since you are trying to use html to get around the unavailable CLOB handling, I suspect that you will need to do some more coding in javascript to handle the xml properly, but I am not sure what to suggest.

Good luck,

Mike