Commas in string fields
Please can someone suggest to me how I read in a String from the
previous page that contains a comma.
I have a drop down list on one page that includes town names such as
"Colchester, Essex". On the next page I do
request.getParameter("town") but it only ever returns the String as
far as the comma e.g. Colchester,. How do I stop the comma acting as
a delimiter?
Sorry for being vague.
Thanks, Love Emma
use request.getParameterValues()
this will return u a string array of all the comma separated values
YourJumbly <[email protected]> wrote in message
news:[email protected]..
> Please can someone suggest to me how I read in a String from the
> previous page that contains a comma.
>
>
> I have a drop down list on one page that includes town names such as
> "Colchester, Essex". On the next page I do
> request.getParameter("town") but it only ever returns the String as
> far as the comma e.g. Colchester,. How do I stop the comma acting as
> a delimiter?
>
>
>
> Sorry for being vague.
>
>
> Thanks, Love Emma
Similar Messages
-
I am trying to parse a string field
I am reading a field from a table that contains several comma seperated control fields. Like this -
TYPE=A,CREATE USER=amanger ,MODIFIED USER=amanger ,SHORT PAID ITEM 03P89-24 TO
CONTRACT PRICE OF 5.36 EA PER BUYER LYNNE HENRY.
I need to check position 6 to see if it is an A or a C, if it is then I need return all the rest of the string after the 3rd comma. In this case it would be
SHORT PAID ITEM 03P89-24 TO CONTRACT PRICE OF 5.36 EA PER BUYER LYNNE HENRY.
I tried this
if (Left ({L_HAPI.OBJECT}, 6) = "A")
or (Left ({L_HAPI.OBJECT}, 6) = "C")
then Split ({L_HAPI.OBJECT}, "," , 3 )
else ""
but it did not work.
I need to set up a formula that will work, can anybody help me?This should do the trick for you...
IF RIGHT(SPLIT({TableName.StringField}, ",") [1], 1) IN ["A", "C"]
THEN SPLIT({TableName.StringField}, ",") [4] ELSE ""
HTH,
Jason -
MODEL clause to process a comma separated string
Hi,
I'm trying to parse a comma separated string using SQL so that it will return the parsed values as rows;
eg. 'ABC,DEF GHI,JKL' would return 3 rows;
'ABC'
'DEF GHI'
'JKL'
I'm thinking that I could possibily use the MODEL clause combined with REGULAR expressions to solve this as I've already got a bit of SQL which does the opposite ie. turning the rows into 1 comma separated string;
select id, substr( concat_string, 2 ) as string
from (select 1 id, 'ABC' string from dual union all select 1, 'DEF GHI' from dual union all select 1, 'JKL' from dual)
model
return updated rows
partition by ( id )
dimension by ( row_number() over (partition by id order by string) as position )
measures ( cast(string as varchar2(4000) ) as concat_string )
rules
upsert
iterate( 1000 )
until ( presentv(concat_string[iteration_number+2],1,0) = 0 )
( concat_string[0] = concat_string[0] || ',' || concat_string[iteration_number+1] )
order by id;
Can anyone give me some pointers how to parse the comma separated string using regexp and create as many rows as needed using the MODEL clause?Yes, you could do it without using ITERATE, but FOR ... INCREMENT is pretty much same loop. Couple of improvements:
a) there is no need for CHAINE measure
b) there is no need for CASE in RULES clause
c) NVL can be applies on measures level
with t as (select 1 id, 'ABC,DEF GHI,JKL,DEF GHI,JKL,DEF GHI,JKL,DEF,GHI,JKL' string from dual
union all
select 2,'MNO' string from dual
union all
select 3,null string from dual
SELECT id,
string
FROM T
MODEL
RETURN UPDATED ROWS
partition by (id)
DIMENSION BY (0 POSITION)
MEASURES(
string,
NVL(LENGTH(REGEXP_REPLACE(string,'[^,]+','')),0)+1 NB_MOT
RULES
string[FOR POSITION FROM 1 TO NB_MOT[0] INCREMENT 1] = REGEXP_SUBSTR(string[0],'[^,]+',1,CV(POSITION))
SQL> with t as (select 1 id, 'ABC,DEF GHI,JKL,DEF GHI,JKL,DEF GHI,JKL,DEF,GHI,JKL' string from dual
2 union all
3 select 2,'MNO' string from dual
4 union all
5 select 3,null string from dual
6 )
7 SELECT id,
8 string
9 FROM T
10 MODEL
11 RETURN UPDATED ROWS
12 partition by (id)
13 DIMENSION BY (0 POSITION)
14 MEASURES(
15 string,
16 NVL(LENGTH(REGEXP_REPLACE(string,'[^,]+','')),0)+1 NB_MOT
17 )
18 RULES
19 (
20 string[FOR POSITION FROM 1 TO NB_MOT[0] INCREMENT 1] = REGEXP_SUBSTR(string[0],'[^,]+',1,CV(POSITION))
21 )
22 /
ID STRING
1 ABC
1 DEF GHI
1 JKL
1 DEF GHI
1 JKL
1 DEF GHI
1 JKL
1 DEF
1 GHI
1 JKL
2 MNO
ID STRING
3
12 rows selected.
SQL> SY. -
Look Up For Comma Separated Strings
Hi,
How to look up for comma separated string from livecycle forms manager ??
Plz gimme an idea on this.
Raghava Kumar V.S.S.Hi
My point is that the more detailed you ask your question, the more likely you are to get an answer.
Those of us who monitor these newsgroups also appreciate you doing as much of your own research as possible, before asking us for help - we're more likely to spend our own (personal and valuable) time helping you, if we know that you've spent your own time doing research, and you've still not been able to solve the problem.
I look forward to your next question :-)
Howard -
Add a carriage return in a Unbound String Field
Post Author: Razzle00
CA Forum: Formula
Hi,
How can I add a carriage return to an unbound string field in a crystal report. I am using the bundled version of CR with MS Visual Studio 2003 & 2005. My formula needs to look something like this....
'Heading One:' + CARRIAGE RETURN + trim({tablename.fld_1}) + CARRIAGE RETURN + 'Heading Two:' + CARRIAGE RETURN + trim({tablename.fld_2})
this code all needs to be in 1 unbound string field. Is this possible?
Thanks,
RazzlePost Author: SKodidine
CA Forum: Formula
To add a carriage return, add CHRW(13)
For example:
'Heading One:' & chrw(13) & 'sample text';
will result in:
Heading One:
sample text -
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 -
Edirectory ldap, what do I put in the DN String field?
Experts,
I am trying to configure LDAP authentication. I've done this many, many times against Active Directory. In AD it is usually DOMAIN_NAME\%LDAP_USER%.
This has been driving me nuts today. We are running eDirectory. I have my server's IP address and port.
What do I put in the DN String field? I've tried many combinations of TREENAME\%LDAP_USER%, nothing seems to work.
If it is more complicated than that, where do I look in NDS to figure out what I need to put in the DN String field?
Thanks!
DanDan,
I'm actually surprised you had success with that on AD as I never did. I recommend you get a little lower level and use DBMS_LDAP. Here's a little sample code to get you started:
FUNCTION ldap_authenticate (
p_username IN VARCHAR2
, p_password IN VARCHAR2
RETURN BOOLEAN
AS
l_dn VARCHAR2(256) := p_username || '@domain.com';
l_bind PLS_INTEGER;
l_session DBMS_LDAP.SESSION;
BEGIN
IF p_username IS NULL
THEN
RAISE_APPLICATION_ERROR(-20001,'A username must be supplied');
END IF;
IF p_password IS NULL
THEN
RAISE_APPLICATION_ERROR(-20002,'A password must be supplied');
END IF;
dbms_ldap.use_exception := TRUE;
l_session := dbms_ldap.init(
hostname => 'server.domain.com'
, portnum => 389
l_bind := dbms_ldap.simple_bind_s(
ld => l_session
, dn => l_dn
, passwd => p_password
l_bind := dbms_ldap.unbind_s(l_session);
RETURN TRUE;
EXCEPTION
WHEN OTHERS
THEN
RETURN FALSE;
END;Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen -
Comma delimeted string in IN clause of PL/SQL block
Hi,
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.
If i m using sql query then give me result.
I m using oracl 10g and following code. DEPT table having 'miller' and 'cleark' ename rows.
Can you please suggest the other way to get proper result.
declare
cnt number:=0;
strin varchar2(40);
begin
strin:='miller,cleark';
select count(*)
into cnt
from dept
where ename in (strin);
dbms_output.put_line('cnt:-'||cnt);
end;Thanks.Apart from the solutions you've already been given, let's be clear...
user548963 wrote:
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.Yes it does, it's giving exactly the expected result for what you have provided. It may not be what you're desiring, but it's absolutely correct.
The IN Clause is expecting multiple arguments to be in the set of data. You are providing it with a single argument... a single string. Just because your string has got commas in it does not make that string into multiple arguments. -
How to remove the comma from string
Hi,
I Have string like below :
String some1="123,44.22";
I want to remove comma from string and final output should be 12244.22.
public class getOut{
public static void main(String args[]){
String some1="123,44.22";
getChars(int 0,some1.length(),char[] dst,0);
can somebody in the forum give me idea how to remove comma from the String and
have a string without comma.
Thanks
Jackint idx = oldString.indexOf(',');
if(idx >= 0)
newString = oldString.substring(0, idx) + oldString.substring(idx + 1);or for jdk 1.4 and later
str = str.replaceAll(",", ""); -
how to use string field and its purpose...
STRING: Character string with variable length This data type can be used only in types (data elements, structures, table types) and domains. In the dictionary a length can be specified for this type (at least 256 characters). It can be used in database tables only with restrictions. For a description of them, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. The system proposes 132 characters as default for the output length. You cannot attach search helps to components of this type.
SSTRING: Short character string with variable length. In the Dictionary the number of characters can be specified for this type (from 1 to 1333). This data type can be used only in types (data elements, structures, table types) and domains. It can be used in database tables. To do so, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. String fields of this type can be used in indexes and in the WHERE condition of a SELECT statement. You cannot use them in table keys -
Using a comma-delimited string in Dynamic SQL
Hi --
If I receive a comma-delimited string as an in parameter, can I simply use that (in string format) when building my dynamic sql?
Thanks,
ChristineThe problem is, that you can not use bind variables
here, only literals. This causes
eventual performance problems.And to avoid the inevitable database performance problems Dmytro mentions you can use a function to convert the string to a varray and select from that. This also avoids having to use dynamic sql.
First you create a varray and conversion function.
SQL> create or replace type tabstr_t as table of varchar2(255)
2 /
Type created.
SQL> create or replace function tabstr (
2 p_str in varchar2,
3 p_sep in varchar2 default ','
4 )
5 return tabstr_t
6 as
7 l_str long default p_str || p_sep;
8 l_tabstr tabstr_t := tabstr_t();
9 begin
10 while l_str is not null loop
11 l_tabstr.extend(1);
12 l_tabstr(l_tabstr.count) := rtrim(substr(
13 l_str,1,instr(l_str,p_sep)),p_sep);
14 l_str := substr(l_str,instr(l_str,p_sep)+1);
15 end loop;
16 return l_tabstr;
17 end;
18 /
Function created.Then you can use these in either regular sql.
SQL> var s varchar2(100)
SQL> exec :s := 'Smith,Scott,Miller'
PL/SQL procedure successfully completed.
SQL>
SQL> select * from emp where ename in
2 (select upper(column_value) from table(tabstr(:s)));
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10Or in pl/sql.
SQL> var c refcursor
SQL> begin
2 open :c for
3 select * from emp where ename in
4 (select upper(column_value) from table(tabstr(:s)));
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10 -
String Field rendering as Number Field in CR Basic for VS2008
I recently migrated from CR for VS2005 to CR Basic for VS2008 and am creating my first report using CR 2008. The SQL result set returns rows containing strings (nvarchar), integers and decimal (7,2) fields.
The report is getting all rows in the result set, but the string fields as defined in the SQL are 1) rendering in the report as numbers, and 2) showing as empty. The non-string fields render fine. I tried reformatting the report field to string, but only the Number tab appears in the formatting dialog. I also tried converting the SQL field result into an unbound string field, as well as tried the ToText function, but the results were the same. I suspect the field appears empty because of the formatting issue.
How can I get CR Basic for VS2008 to render a string (nvarchar) field as a string?Try placing the field inside a formula field or inside a text field. That should cause the field to be shown no matter what type of data it is. If the data is still not showing, then perhaps it is not being returned properly.
Things to check:
-Are you connecting directly to the tables - or are you connecting to a stored procedure? If you are connecting to a stored procedure and you are using Temp Tables, then make sure you add the line "SETNOCOUNT ON" to your stored proc.
-Run SQL profiler - see what query is being made, then try running that exact same query through the SQL admin console (Or some other utility that lets you run SQL queries)
Thanks
Shawn -
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 -
Hello everybody,
I want to map the content of an Idoc to one String field, but I don't know how to do this. Can anybody help me?
Best regards
MartinHello everybody,
thanks for your advices, but I have a general problem. My Mapping is IDOC to StringField. But when I start testing the Message Mapping by loading an IDOC as XML-File, I have no values when I display the Queue. I did the mapping as mentioned in the Blog.
What is my error?
Thanks and best regards,
Martin -
Impossible to get a String field with GetFieldID !!!!!!
Hi, I write here my classes and explain my problem :
------------------------- Class Lexicon.java ---------------------------
package SlpTkJava.JavaCode;
public class Lexicon {
public native void next(SearchReturn search);
static {
System.loadLibrary("slptkjava");
--------------------------- Class SearchReturn.java --------------------
package SlpTkJava.JavaCode;
public class SearchReturn {
public LexItem access;
-------------------------- Class LexItem.java --------------------------
package SlpTkJava.JavaCode;
public class LexItem {
public int lemma;
public String graphy;
--------------------------- File Lexicon.c -----------------------------
* Class: SlpTkJava_JavaCode_Lexicon
* Method: next
* Signature: (LSlpTkJava/JavaCode/SearchReturn;)V
JNIEXPORT void JNICALL Java_SlpTkJava_JavaCode_Lexicon_next(JNIEnv *env,
jobject obj,
jobject search){
jfieldID accessFID, graphyFID, lemmaFID;
jclass searchReturnCls, lexItemCls;
jobject access;
searchReturnCls = (*env)->FindClass(env, "SlpTkJava/JavaCode/SearchReturn");
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
accessFID = (*env)->GetFieldID(env, searchReturnCls, "access", "LSlpTkJava/JavaCode/LexItem;");
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
access = (*env)->GetObjectField(env, search, accessFID);
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
lexItemCls = (*env)->FindClass(env, "SlpTkJava/JavaCode/LexItem");
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
lemmaFID = (*env)->GetFieldID(env, lexItemCls, "lemma", "I");
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "LJava/lang/String;");
if ((*env)->ExceptionOccurred(env)){
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
When I run this function in a testFile, I get this exception :
Exception in thread "main" java.lang.NoSuchFieldError: graphy
at SlpTkJava.JavaCode.Lexicon.next(Native Method)
at TestLexicon.main(TestLexicon.java:58)
I can't understand because the system can load the int field from the "access" object and not the String field !
I can precise that I'm on Solaris.
Please help me it's urgent !
Thank you.
ZiguneI think your problem is:
graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "LJava/lang/String;");
should be
graphyFID = (*env)->GetFieldID(env, lexItemCls, "graphy", "Ljava/lang/String;");
i.e. java/lang/String - java is lower case.
Maybe you are looking for
-
Multiple values in a single cell in report !!
Hello, I want to display multiple values in a single cell, each value separated by comma. Ex: I have Employee and Department. If a employee works for many departments, all the Department names should be displayed in the same cell in the report. Pleas
-
My ipad says it has 149 photos on it, but I can't find them. Any ideas where they might be?
-
BTE For CJ37. CJ34, CJ38 - Budget document post
What is the BTE for CJ37. CJ34, CJ38 - Budget document post. How to find BTE for those transaction in PS.
-
Using analytic function in a view
Hello to all Sorry If I use this thread sql not merge using analytic functions for my question, From example you write and from Tom explain is not possible create a view on analytic function? Thanks and sorry again
-
I setup a netlet that uses port 80 and some app specific ports for two different netlets. If I click on one (say webapp1), I will get the correct content for webapp1. I close webapp1. The next one (say webapp2) I will sometimes get the previous web s