Substring in EL Expression
Hi All,
I have an attribute and the value of this attribute is getting calculated at run time
e.g. the attribute is ABC and value is a.b.c.d
i need sub-string a.b.c in the el expression.
i need something like -- value="#{fn:substring(0,(bindings.BkDealNumberTran.inputValue).lastIndexOf('.'))}"..but this is not working
How will i do that?
jdev- 11.1.1.6.0
Thanks in advance
Priya
HI Priya,
Alternate option other than EL, You can create a transient attribute which is a calculated one and it will have the sub string of the value and you can use that value in your page.
N.
Similar Messages
-
How to fetch substring using regular expression
Hi,
I am new to using regular expression and would like to know some basic details of how to use them in Java.
I have a String example= "http://www.google.com/foobar.html#*q*=database&aq=f&aqi=g10&fp=c9fe100d9e542c1e" and would like to get the value of "q" parameter (in bold) using regular expression in java.
For the same example, when we tried using javascript:
match = example.match("/^http:\/\/(?:(?!mail\.)[^\.]+?\.)?google\.[^\?#]+(?:.*[\?#&](?:as_q|q)=([^&]+))?/i}");
document.write('
' + match);
We are getting the output as: http://www.google.com/foobar.html#q=database,*database* where the bold text is the value of "q" parameter.
In Java we are trying to get the value of the q parameter separately or atleast resembles the output given by JavaScript. Please help me resolving this issue.
Regards
PraveenBalusC wrote:
Regex is a cumbersome solution for fixed patterns like URL's. String#substring() in combination with String#indexOf would most likely already suffice.I usually agree, although, in this case, finding the exact parameter might be difficult without a small regex, perhaps:
"\\wq=\\s*"in conjunction with Pattern/Matcher, used similarly to an indexOf() to find the start of the parameter value.
Winston -
Question on Substring or Regular Expression
Experts,
I have values is column similar to this:
Remarks:
IHCIS 651216 K6
KORE 657526
COR SWITX 658999 K6 ADHOC
I need to pull out the number starting with "6" (it always starts with 6, and it is always six characters). I then need to set the value of another column to that substring.
Update table x
set p_code = "Query returning the substring value"
I've used substring before but I don't know how to search for the "6" since it is in different locations for each row.
Any help is greatly appreciated.
RichHi,
Here is an example using "SUBSTR':
SQL> select substr('IHCIS 651216 K6', instr('IHCIS 651216 K6', '6') , 6) from dual;
SUBSTR
651216 -
Searching for a substring using Regular Expression
I have a lengthy String similar to repetetion of the one below
String str="<option value='116813070'>Something1</option><option value='ABCDEF' selected>Something 2</option>"I need to search for the Sub string "<option value='ABCDEF' selected>" (need to get the starting index of sub string) and but the value ABCDEF can be anything numberic with varying length.
Is there any way i can do it using regular expressions(I have no other options than regular expression)?
thanks in advance.If you go through the tutorial then you will find this on the second page:
import java.io.Console;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class RegexTestHarness {
public static void main(String[] args){
Console console = System.console();
if (console == null) {
System.err.println("No console.");
System.exit(1);
while (true) {
Pattern pattern =
Pattern.compile(console.readLine("%nEnter your regex: "));
Matcher matcher =
pattern.matcher(console.readLine("Enter input string to search: "));
boolean found = false;
while (matcher.find()) {
console.format("I found the text \"%s\" starting at " +
"index %d and ending at index %d.%n",
matcher.group(), matcher.start(), matcher.end());
found = true;
if(!found){
console.format("No match found.%n");
}It's does everything you need and a bit more. Adapt it to your needs then write a regular expression. Then if you have problems by all means come back and post them up here, but first at least attempt to solve it yourself. -
SUBSTR or regular expression needed
Hello,
I have the below example:
CREATE TABLE "ARCHITECT"."TEST_DD"
( "TABLE_NAME" VARCHAR2(100),
"APPLICATION_NAME" VARCHAR2(100),
"COLUMN_NAME" VARCHAR2(100),
"COLUMN_DESCRIPTION" VARCHAR2(2000)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MYTABLESPACE"
i want to have the below result
CREATE TABLE "ARCHITECT"."TEST_DD"
( "TABLE_NAME" VARCHAR2(100),
"APPLICATION_NAME" VARCHAR2(100),
"COLUMN_NAME" VARCHAR2(100),
"COLUMN_DESCRIPTION" VARCHAR2(2000)
That is mean i want to cut every think after PCTFREE, the above create table is just and example, i may have any create table statement with the PCTFREE keyword
Please can i have your helpmodify the transform parameters
SQL> begin
2 dbms_metadata.set_transform_param(dbms_metadata.session_transform,'STORAGE',false);
3 dbms_metadata.set_transform_param(dbms_metadata.session_transform,'TABLESPACE',false);
4 dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SEGMENT_ATTRIBUTES', false);
5 end;
6 /
PL/SQL procedure successfully completed.
SQL>
SQL> select dbms_metadata.get_ddl ('TABLE', 'EMP')
2 from dual
3
SQL> /
DBMS_METADATA.GET_DDL('TABLE','EMP')
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0) NOT NULL ENABLE,
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4,0),
"HIREDATE" DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0)
SQL> -
Substring on Dimension and Detail coming from SAP connection
Hi,
I am able to use @Select to create new dimension object by sourcing the existing dimension.
<EXPRESSION>@Select(class\dimension)</EXPRESSION>
Then I tried to do a substring over this
<EXPRESSION>Substr(@Select(class\dimension);4;10)</EXPRESSION>
This object parses successfully in designer, but in Web Intelligence it throws an error.
I just want to know whether substring is supported in OLAP universes?
Thanks
RaghuHi guys,
perhaps just taking a look at the note would help. The note explains what functionality is supported.
Ingo -
I am develping an JAVA application which will query the database and retrieve a text set. I need to know how i shld retrieve an exact line from it which i am sure will be present in the result set.
(eg) If my query returns the following text,
"Let us define some important terms related to Systems & software.
A system consists of people, machines or technology, and methods or processes, organized to accomplish a set of specific functions.The total man hours needed for this is 22hrs."
I want to get only the line "The total man hours needed for this is 22hrs" and display on screen.But the 22 hrs will change to anything depending upon the query . I need to take a sentence which starts like "The total man hours needed for this is ....."
I tried using 'like %'.............But it gives the entire text as the result which is not desired.
Help me out.Why do you want to do that in the database? You asked the question on a Java forum, so I will give you a Java answer. Use String.indexOf and String.substring or regular expressions to get the part that you want.
Kaj -
Error in getting Long data type from Table
Hi All,
I have one table say xx_long. In this table one column is having Long data type.
Now I want this values will get in to the PL/SQL variable. I taken variable data type as long but it is showing error "ORA-00997: illegal use of LONG datatype".
Sample code with which I tried:
declare
a long;
begin
select slno into a from xx_long where slno = 100;
dbms_output.put_line('Value:'||a);
end;
Please help me on this.
Thanks in advance.
Regards,
HariLONG columns cannot appear in certain parts of SQL statements:
WHERE clauses, GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or with the DISTINCT operator in SELECT statements
The UNIQUE operator of a SELECT statement
The column list of a CREATE CLUSTER statement
The CLUSTER clause of a CREATE MATERIALIZED VIEW statement
SQL functions (such as SUBSTR or INSTR)
Expressions or conditions
SELECT lists of queries containing GROUP BY clauses
SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or MINUS set operators
SELECT lists of CREATE TABLE ... AS SELECT statements
SELECT lists in subqueries in INSERT statements -
URGENT: Parse Logical Operator.
Hi there:
I'm having some difficulties to parse some conditoional operator. My requirements is:
Constants value: int a=1,b=2,c=3
Input/Given value: 2
conditional operator expression: d=(a|b|c)&d
Expected result method:false
Summary: I like to receive a boolean from any conditional operator expressions defined, which check against Input/Given value.
Note: The expression are various from time to time, based on user's setup, the method is smart enough to return boolean based on any expression.
Let me know if you have any concerns.
Thanks a million,
selenaHi Guys:
I have modified your program to cater the "(" or ")" precedence. My techniques are:
For eg : formula = (a|b|c)&d
1. I substring the those expression with "(" and close with ")".
2. Then, i store the substring value into a list.
3. Inside the list will have 2 rows: (a|b|c), x&d (note: x is the input value store in the hashtable)
4. Therefore basically, the first row (a|b|c) will return a true boolean, then i will store inside result list, and same goes to the result of x&d, which is false.I will get the last operand to store inside the list as well.
5. The result list will have 3 rows with
true
false
Question here:
How can parse the rows in a single if statement ? I was tried to retrieve out and form a string, but i can't do that ....
p/s my code maybe lousy, but pls guide me along the away, again i wish to learn from you :-).
Again, duke dollars will be awarded when the solutions is firm.
Thanks a millions,
selena
import java.util.List;
import java.util.ArrayList;
public class Parser
public static HashMap symbol_table = new HashMap();
public Expression parseList(List expList)
ExpressionImpl e = new ExpressionImpl();
StringBuffer strBuffer = new StringBuffer();
List listFlag = new ArrayList();
boolean result = false;
String s = new String();
String x = "";
if( expList != null){
for(int y=0;y<expList.size();y++){
s = (String)expList.get(y);
System.out.println("==> s: "+s);
if(s.length()==2){
s = "x"+s;
System.out.println("==> after s: "+s);
e.oper1 = String.valueOf(s.charAt(0));
System.out.println("==> e.oper1: "+e.oper1);
if (s.length() == 1){
return e;
}else if (s.length() > 2){
e.operant = String.valueOf(s.charAt(1));
System.out.println("==> e.operant: "+e.operant); e.tail = recursiveParse(s.substring(2));
System.out.println("==> AFTER e.operant: "+e.operant);
try{
System.out.println(e.eval(2));
result = e.eval(2);
}catch(Exception ex){
ex.printStackTrace();
if(s.length() == 3){
listFlag.add(e.operant);
listFlag.add(Boolean.valueOf(result));
System.out.println("==> s.length(): "+s.length()); System.out.println("==> e.tail: "+e.tail);
}//end for
}//end if
if(listFlag !=null){
for(int y=0;y<listFlag.size();y++){
if(y==1){
String operand = (String)listFlag.get(y);
System.out.println("operand: "+operand);
}else{
if(y==0){
boolean temp1 = ((Boolean)listFlag.get(y)).booleanValue();
System.out.println("temp1: "+temp1);
}else{
boolean temp2 = ((Boolean)listFlag.get(y)).booleanValue();
System.out.println("temp2: "+temp2);
}//end for
System.out.println("result: "+temp1 && temp2);
/* if(temp1 operand temp2){
return e;
}//end method
public Expression recursiveParse(String s)
ExpressionImpl e = new ExpressionImpl();
e.oper1 = String.valueOf(s.charAt(0));
if (s.length() == 1){
return e;
}else if (s.length() > 2)
e.operant = String.valueOf(s.charAt(1));
e.tail = recursiveParse(s.substring(2));
}else
throw new IllegalArgumentException("invalid input " + s);
return e;
public static void main(String[] args) throws Exception
Parser p = new Parser();
Parser.symbol_table.put("a", new Integer(1));
Parser.symbol_table.put("b", new Integer(2));
Parser.symbol_table.put("c", new Integer(3));
Parser.symbol_table.put("d", new Integer(4));
Parser.symbol_table.put("x", new Integer(2));
//The formula
//Expression e = p.parse("(a|b|c)&d");
//Split the String if found brackets and add into list
String s= "(a|b|c)&d";
String str = new String(s);
int startIndex = str.indexOf("(");
System.out.println("starting index with ( ==> "+startIndex);
int endIndex = str.indexOf(")");
System.out.println("endding index with ) ==> "+endIndex);
String startString = str.substring(startIndex, endIndex+1);
String endString = str.substring(endIndex+1, s.length());
String firstSplit = s.substring(1,(startString.length())-1);
System.out.println("1st split bracket value ==> "+firstSplit);
System.out.println("endString ==> "+endString);
System.out.println("endString length==> "+endString.length());
List formulaStr = new ArrayList();
formulaStr.add(firstSplit);
formulaStr.add(endString);
Expression e = p.parseList(formulaStr);
//5.To evaluate the value of "2"
//System.out.println(e.eval(2));
public class ExpressionImpl implements Expression
public String oper1;
public String operant;
public Expression tail;
/* (non-Javadoc)
* @see parser.Expression#eval()
public boolean eval(int value) throws Exception
int val1 = getValue(oper1); //Get the value of "a"/"b"/"c"/"d"
if (null == tail)
System.out.println(val1 + ":" + value);
return (val1 == value);
else
if (OR.equals(operant))
return (val1 == value || tail.eval(value));
else if (AND.equals(operant))
return (val1 == value && tail.eval(value));
else
throw new Exception("unsupported operant " + operant);
private int getValue(String operator) throws Exception
Integer temp = ((Integer)Parser.symbol_table.get(operator));
/*if (null == temp)
throw new Exception("symbol not found " + operator);
return temp.intValue();
public String toString()
if (null == operant) return oper1;
return oper1 + operant + tail.toString();
public interface Expression{
String OR = "|";
String AND = "&";
String START_BRACKET="(";
String CLOSE_BRACKET=")";
public boolean eval(int value) throws Exception; -
Using substring in the XPATH expression for Receiver Determination
Hello, I need a little help please. In my receiver determination, I have a condition and I need to do a "not like" check. Basically, if the first three positions of the source field does not start with a specific code, then I need to execute the condition. The condition editor does not support a "not like" operand, so I went to the XPATH expression editor. I tried to used the XPATH substring function to get the first three characters and then do a "not equal" operand, but it doesn't appear to work. There are not any runtime errors, but the condition is not executing. Any ideas on this? Does the XPATH expression support the substring function?
Hi Jesse,
Can you please explain what is the meaning of http:// in the statement
/p1:PRODUCT/MATNRhttp://not(substring(.,string-length(.) - 2) = '123')
Please explein, I am having same issue. It is not working here.In My case it is
/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,\"D\"))]
also tried with
/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,'D'))]
Thanks in advance! -
Xpath expression substring or contains
Hi ,
I have this inbound source message
<?xml version="1.0" encoding="UTF-8" ?>
- <rfc:Z_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
- <TO_DATA>
- <item>
<LINE>000012E3 ABCD 3I 20070911164941</LINE>
</item>
</TO_DATA>
</rfc:Z_RFC>
and two inbound interfaces
condition is , if "ABCD" exists in the LINE field(type string) then the corresponding Interface mapping should execute.
I know the exact location of "ABCD occurence so I can use either contains or substring functions.
I tried /P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)="ABCD"] EX no right operand
/P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)]= "ABCD" with right operand
substring((/P1:Z_RFC/TO_DATA/item/LINE),X,Y) = "ABCD"
similarly I tried around with <b>"contains"</b> function too.
but not able to apply exactly, I tried with different options looking at different blogs in SDN.
so how should be the Xpath expression ?
thank you.
Babuyes,
I have two different interface mappings in interface determination.
I have same sender RFC interface(outbound) and two different target interfaces and so why I have two different interface mapping,MMs.
sender and reciever systems are same in both cases.
.................condition1--interface mapping1--
sender -
|-- |--
Receiver
.................condition2--interface mapping2--
>>>two dfferent interfaces one when the condition satisfies and other when the condition doens'tmacth...
I know why you are asking this,if we have one interface map and two target interfaces then we need to go for enhanced interface determination.
and need not to be just "substring" or "contains" function ,just any function will do.
so any suggestion about the above scenario in ASCII diagram?
thank you.
Babu -
How to do substring with Expression Builder
Hi,
I only execute a substring with Expression Builder, this is possible?
thanxHi!
With Expression Builder it is not possible as the EL by default does not have such function.
But you may:
1. Use JSTL 1.2 functions like "${fn:trim(' MYSTRING '}"
2. Write your own function and TagLib - see on net
Also, you may write a custom Map implementation and expose it in some backing bean to make it available in EL without need to create TagLib (as #{mybean.trim[' some string ']"). But this way is much complex if you need more than singe parameter for your function...
Regards,
PaKo -
Regular expression for 2nd occurance of a substring in a string
Hi,
1)
i want to find the second occurrence of a substring in a string with regular expression so that i can modify that only.
Ex: i have a string like ---> axe,afn,sdk,jdi,afn,mki,mki
in this i want the second occurance of afn and change that one only...
which regular expression i have to use...
Note that ...i have to use regular expression only....no string manipulation methods...(strictly)
2)
How can i apply the multiple regular expressions multiple times on a single string ..i.e in the above instance i have to apply the same 2nd occurrence logic for
substring mki also. for this i have to use a single regular expression string that contains validations for both the sub strings mki and afn.
Thanks in advance,
Venkatjavafreak666 wrote:
Hi,
1)
i want to find the second occurrence of a substring in a string with regular expression so that i can modify that only.
Ex: i have a string like ---> axe,afn,sdk,jdi,afn,mki,mki
in this i want the second occurance of afn and change that one only...
which regular expression i have to use...
Note that ...i have to use regular expression only....no string manipulation methods...(strictly)
2)
How can i apply the multiple regular expressions multiple times on a single string ..i.e in the above instance i have to apply the same 2nd occurrence logic for
substring mki also. for this i have to use a single regular expression string that contains validations for both the sub strings mki and afn.
Thanks in advance,
VenkatWhat do you mean by using a regex to get the index of a second substring? There is not method in Java which uses regex to et the index of a substring.
There are various indexOf(...) methods for this:
String text = "axe,afn,sdk,jdi,afn,mki,mki";
String target = "afn";
int second = text.indexOf(target, text.indexOf(target)+1);
System.out.println("second="+second);Of course you can find the index of a group like this:
Matcher m = Pattern.compile(target+".*?("+target+")").matcher(text);
System.out.println(m.find() ? "index="+m.start(1) : "nothing found");but there is not single method that handles this: you'll have to call the find() and then the start(...) method on the Matcher instance, so the indexOf(...) approach is the favourable one, IMO. -
Regular expression to get substring from string
Hi,
I’m having the following problem:
SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field','.*ir-(.*)-01.*’)FROM dual
[\CODE]
This is the select that I have with a java expression!
In java I’m able to do find the right expression to retrieve what I want, but I don’t know how to adapt this for oracle!
In oracle I was trying to do something like this:
NVL(SUBSTR(REGEXP_SUBSTR(CONCAT(';', list),';ir-[^01;]+'),LENGTH(';ir-')+1,LENGTH(REGEXP_SUBSTR(CONCAT(';',list),';ir-[^01;]+'))), ' ') AS result
[\CODE]
But it doesn’t work because “ir” can repeat in other parameters.
“ir-something-01” only appears once.
Is it in oracle a logic similar to result groups in oracle?
best regards,
Ricardo Tomásrctomas wrote:
Hi,
In java I’m able to do find the right expression to retrieve what I wantWell, would be nice to tell us what that right expression would be :). Anyway, is this what you are looking for:
SQL> SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field',';ir-([^;]*)-01')
2 from dual
3 /
REGEXP_SUBSTR(';FIR
;ir-second field-01
SQL> SY. -
Adf expression builder substring function
Hello,
I'm new to adf and I want to make substring using expression builder. I've tried #{fn:substr(bindings.getSysdate.result,1,5)} but doesn't work and I didn't find on the net.
Please help.
Thank youHi,
the JSTL function is called fn:substring and - as Timo mentions - you need to add
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
to the jsp:root tag of the JSPX page
This here then worked for me:
#{fn:substring(bindings.employeeName.inputValue,1,3)}
Frank
Maybe you are looking for
-
Can you share/lend books that have bought from iBook with others users?
Can you share/lend books that have you have bought from iBook with other iPad users?
-
ORA-01007 - variable not in select list error in pl\sql code
Hi, When I tried to run this program I am getting below error: ORA-01007 - variable not in select list.Please help to resolve. Code: create or replace procedure "XX_BPM_DATA_P" (P_PROCESS_ID IN VARCHAR2) is TYPE l_entity_type IS TABLE OF xx_BPM_data.
-
Really need to show an image in this applet...
Hi, I need to display an image in my applet as a sort of "Start Screen" like you get on games. But I'm damned if I can get it to work, my tutor provided the unifinished shell of a program, and it seems that I need to display this image before any...
-
Iphone not charging and continuously restarting when connected
Last night I let my iphone 4 run down to 2% charge. I plugged it into the charger (china one) and it would come up with the electricity symbol, but not be charging. I then connected it to my genuine apple charger and the same thing happened. It then
-
Hi Experts, I got a doubt regarding the concept of 'Row Migration'. From http://www.akadia.com/services/ora_chained_rows.html : Migrate a row when an update to that row would cause it to not fit on the block anymore (with all of the other data that e