Need help in clearing string buffer during dynamic VO where clause in oaf
Hi All,
I am dynamically setting where clause in OAF using string buffer, but the issue is when i am executing the vo multiple times so the old data in the string buffer it is not clearing .so every time my where clause adding to the query and it is erroring out, please help me how to clear string buffer class in oaf.
Thnaks
Hi,
Could you please share the code segment for reference. Then we can tell the solution.
Regards,
Tarun
Similar Messages
-
Issue with dynamically setting where clause in OAF
Hi All,
I have a View object having the query below:
SELECT rownum LINENUM,
B.line_id LINE_ID,
B.INVENTORY_ITEM_ID INVITMID ,
B.QUANTITY_DELIVERED PICKQTY
from MTL_TXN_REQUEST_HEADERS A,
MTL_TXN_REQUEST_LINES B
WHERE A.HEADER_ID=B.HEADER_ID
AND A.MOVE_ORDER_TYPE=2
AND 'on'=:1
AND B.TO_SUBINVENTORY_CODE=NVL(:4,B.TO_SUBINVENTORY_CODE)
AND A.request_number=NVL(:5,A.REQUEST_NUMBER)
UNION ALL
SELECT rownum LINENUM,
a.wip_entity_id LINE_ID,
a.INVENTORY_ITEM_ID INVITMID,
a.QUANTITY_ISSUED PICKQTY
FROM WIP_REQUIREMENT_OPERATIONS a,
eam_work_orders_v b
WHERE a.wip_entity_id=b.wip_entity_id
AND 'on'=:2
AND a.ATTRIBUTE2=NVL(:4,a.ATTRIBUTE2)
and b.wip_entity_name=NVL(:6,b.wip_entity_name)
I need to pass dynamically a condition to my where clause that i can handle it by defining two bind parameters in the vo query and can pass it but the problem is the bind variable contains a string like 1311,13112,14445 that i need to pass for a field such as B.line_id in the first query and b.wip_entity_id in the second query so when i am trying by passing the string as one value it is working fine but for value separetd by comma it is giving prob.
so i tried by passing dynamic where clause but it is everytime executing for first clause only how i can pass dynamically both the queries.
vo.setWhereClause("LINE_ID in "+wherclause);
please help me out
Thnaks
DebHi Gaurav,
Thnaks for the reply i tried belwo way u suggested but the query is executing multiple times and i am not getting the correct data as expected.
public void processPOData (String wherclause)
OAViewObject vo = this.getXXDPECONTAINLINESVO1();
String query =vo.getQuery();
String newwhereclause ="LINE_ID = "+wherclause;
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("SELECT * FROM (");
stringbuffer.append(query);
stringbuffer.append(") where ");
stringbuffer.append(newwhereclause);
ViewDefImpl viewdefimpl = getXXDPECONTAINLINESVO1().getViewDefinition();
viewdefimpl.setQuery(stringbuffer.toString());
vo.reset();
vo.clearCache();
vo.executeQuery();
System.out.println("where clause:"+wherclause);
in my log file the query is forming like below:
SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM ( SELECT * FROM ( SELECT rownum LINENUM,
B.line_id LINE_ID,
B.INVENTORY_ITEM_ID INVITMID ,
B.QUANTITY_DELIVERED PICKQTY ,
B.TO_SUBINVENTORY_CODE UNLOADINGPNT,
A.REQUEST_NUMBER RRNUM,
NULL WORKORDNUM,
NULL DTRNUM,
A.description,
A.FROM_SUBINVENTORY_CODE FROM_SUB,
A.TO_SUBINVENTORY_CODE TO_SUB,
NULL SOURCE
from MTL_TXN_REQUEST_HEADERS A,
MTL_TXN_REQUEST_LINES B
WHERE A.HEADER_ID=B.HEADER_ID
AND A.MOVE_ORDER_TYPE=2
UNION ALL
SELECT rownum LINENUM,
a.wip_entity_id LINE_ID,
a.INVENTORY_ITEM_ID INVITMID,
a.QUANTITY_ISSUED PICKQTY,
a.ATTRIBUTE2 UNLOADINGPNT,
NULL RRNUM,
b.WIP_ENTITY_NAME WORKORDNUM,
NULL DTRNUM,
b.description,
NULL FROM_SUB,
NULL TO_SUB,
b.source SOURCE
FROM WIP_REQUIREMENT_OPERATIONS a,
eam_work_orders_v b
WHERE a.wip_entity_id=b.wip_entity_id ) )) where LINE_ID = 30026) where LINE_ID = 30026) where LINE_ID = 30026
But in my page i am getting all the data instead of only for line 30026, please help me out -
Need help with writing a query with dynamic FROM clause
Hi Folks,
I need help with an query that should generate the "FROM" clause dynamically.
My main query is as follows
select DT_SKEY, count(*)
from *???*
where DT_SKEY between 20110601 and 20110719
group by DT_SKEY
having count(*) = 0
order by 1; The "from" clause of the above query should be generated as below
select 'Schema_Name'||'.'||TABLE_NAME
from dba_tables
where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
Any pointers will be appreciated.
Thanks
rogers42Hi,
rogers42 wrote:
Hi Folks,
I need help with an query that should generate the "FROM" clause dynamically.
My main query is as follows
select DT_SKEY, count(*)
from *???*
where DT_SKEY between 20110601 and 20110719
group by DT_SKEY
having count(*) = 0
order by 1; The "from" clause of the above query should be generated as below
select 'Schema_Name'||'.'||TABLE_NAME
from dba_tables
where OWNER = 'Schema_Name'
Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
-- Preliminary Query:
COLUMN my_table_name_col NEW_VALUE my_table_name
SELECT table_name AS my_table_name_col
FROM all_tables
WHERE owner = 'SCOTT'
AND table_name LIKE 'E%';
-- Main Query:
SELECT COUNT (*) AS cnt
FROM scott.&my_table_name
;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
Edited by: Frank Kulash on Aug 11, 2011 2:30 PM -
I need help trying to activate my new phone online where do i go??
i need help trying to activate my new phone online where do i go??
Log in to your MyVerizon (verizonwireless.com) and on the Overview page scroll down to I WANT TO... in the third column of boxes, under DEVICE, the 3rd one down is "Activate or Switch Device". Click on that and follow the instructions. If there is an issue, it will instruct you to call customer service or you will be connected to customer service automatically. Let us know if this works...
-
I have the following schema:
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="CountryRiskService"
targetNamespace="CountryRiskService"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="CountryRiskParameters">
<xs:complexType>
<xs:sequence>
<xs:element name="countryId" type="xs:int" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="catA" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I am passing this into my Logical Data Service, what I want to do is create a dynamic XQuery where clause if the catA field is populated, ignore it if it isn’t, so basically, I want to be able to create a dynamic query based on the parameters requested, so I have the following XQUERY:
declare function tns:getCountries($countryRiskInput as element(ns7:CountryRiskParameters)) as element(ns0:CountryRiskInfo)* {
for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
where $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA
I really thought that DSP would be able to handle this on the fly since the element is optional but if I don’t populate it, I get nothing back, the idea is I want to increase the number of elements in my schema so my consumers have the ability to filter the results they want, so above, I don’t want the second where clause if catA isn't specified, any ideas how to accomplish this?Simply add the disjunction of the input being empty.
for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
where ( $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA or empty( $countryRiskInput/ns4:catA )
But suppose you have 27 different elements that you might want to filter on - the xquery gets long and ugly. You might want to looking into using FilterXQuery. Visit http://edocs.bea.com/aldsp/docs25/, search on FilterXQuery, look for the tutorial.
If your queries get more complicated, you would do well to look into generating ad hoc queries. (edocs as well). -
ok guys i need help anyone with my ipod it froze during an update now it will not work at all i ahve put it into the recovery mode or dfu and it will not reset it self it comes up with an error message 1603 the number is and says the ipod cannot be reset anyone please help me i have tryed everything googled you tubed everything
Error 1604
This error is often related to USB timing. Try changing USB ports, using a different dock connector to USB cable, and other available USB troubleshooting steps (troubleshooting USB connections. If you are using a dock, bypass it and connect directly to the white Apple USB dock connector cable. If the issue persists on a known-good computer, the device may need service.
If the issue is not resolved by USB isolation troubleshooting, and another computer is not available, try these steps to resolve the issue:
Connect the device to iTunes, confirm that the device is in Recovery Mode. If it's not in Recovery Mode,put it into Recovery Mode.
Restore and wait for the error.
When prompted, click OK.
Close and reopen iTunes while the device remains connected.
The device should now be recognized in Recovery Mode again.
Try to restore again.
If the steps above do not resolve the issue, try restoring using a known-good USB cable, computer, and network connection.
Error 1600, 1601, 1602
Error 1603
Follow the steps listed above for Error 1604. Also, discard the .ipsw file, open iTunes and attempt to download the update again. See the steps under Advanced Steps > Rename, move, or delete the iOS software file (.ipsw) below for file locations.If you do not want to remove the IPSW in the original user, try restoring in a new administrator user. If the issue remains, Eliminate third-party security software conflicts. -
Need help in the String Format method
really need help in string.Format method. I would like to show the s in two digit numbers.
for example:
if s is below 10 then display *0s*
the expecting result is 01,02,03.. 09,10,11....
I tried this method, somehow i got the errors msg. pls advise. thx.
public void setDisplay(String s) {
String tmpSS=String.format("%02d",s);
this.ss.setText(tmpSS);
Edited by: bluesailormoon on May 19, 2008 10:30 AMApparently, you expect the string to consist of one or two digits. If that's true, you could do this:String tmpSS = (s.length() == 1) ? ("0" + s) : s; or this: String tmpSS = String.format("%02d", Integer.parseInt(s));
-
Need help in handling string of characters
Hi,
I am trying to scan string and separate different text based on business logic. For example:
String = 'My bus comes at 999 F Street at 8 am'
Now I need to scan the string and break the sentence into multiple words like:
- First occurrence of number which is 999 goes into var1 variable.
- Last occurrence of number which is 8 goes into var2 variable.
I am wondering if this can be achieve with regular expression of any oracle internal function.
Thanks,
Edited by: skas on Jun 6, 2013 10:34 PMnkvkashyap wrote:
or you can even try like this...
with data(str) as
(select 'My bus comes at 999 F Street at 8 am' from dual),
data1 as
(select regexp_replace(str, '[^[:digit:]]+', ' ') a from data)
select regexp_substr(a,'[^ ]+',1,1) var1,regexp_substr(a,'[^ ]+',1,2) var2 from data1;
Output:
var1 var2
999 8
No need to make this complicated ;)
SQL> with data(str) as
2 (
3 select 'My bus comes at 999 F Street at 8 am'
4 from dual
5 )
6 select regexp_sUBsTR(str, '\d+') VAR1,
7 regexp_sUBSTR(str, '\d+',1,2) VAR2
8 from data;
VAR V
999 8Edited by: jeneesh on Jun 7, 2013 11:11 AM
Missed David's post.. This is the same as his post.. -
Re: [(forte-users) Need help w/SQL to Informix using anarray in WHERE c
Bob.
That syntax isn't know Forte, used Dynamic SQL and coding
it dynamically. And the SQL statement exceed 255 bytes, divide in 2 or more
sentences (NameListCity1, NameListCity2, NalmeListCountry1, ...)
Try with:
NameListCity = 'city1','city2','city3'...
NalmeListCountry = 'country1','country2','country3',...
WHERE
city in (:NameListCity) and
country_code in (:NameListCountry)
Bye.
"Briggs, Bob" <Bob.Briggsmarriott.com> wrote:
I'm trying to invoke a query to Informix to select rows that match any of
the city / country pairs that exist in an array that is passed into the
method. The SQL itself seems to be OK however it appears that Forte is
having a problem in parsing the Select statement when it gets to the WHERE
clause. The resulting exception shows the SQL string formatted properly up
to the WHERE clause which ends like "WHERE city". Does anyone know of a way
to make this type of query work in a single invocation? I'm trying not to
issue multiple queries as would be the case if I used Dynamic SQL and coding
it dynamically with multiple OR statements is not really an option since the
overall length of the SQL statement cannot exceed 256 bytes. I have included
an example of the code below, any insight would be greatly appreciated.
SQL SELECT address1 tnAddress, city tnCity, state tnState, zipcode
tnZipcode,
hotel_code tnHotel_Code, name tnHotelName, product_code
tnProduct_code, loc_type tnLoc_Type,
phone tnPhone, country_code tnCountry
INTO
:po_aboLocator
FROM
Hotel
WHERE
city in :pi_aboNickNameList[*].sCityName and
country_code in :pi_aboNickNameList[*].sCountryCode
ON SESSION getDBSession();
Thank you very much,
Bob
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comBob.
That syntax isn't know Forte, used Dynamic SQL and coding
it dynamically. And the SQL statement exceed 255 bytes, divide in 2 or more
sentences (NameListCity1, NameListCity2, NalmeListCountry1, ...)
Try with:
NameListCity = 'city1','city2','city3'...
NalmeListCountry = 'country1','country2','country3',...
WHERE
city in (:NameListCity) and
country_code in (:NameListCountry)
Bye.
"Briggs, Bob" <Bob.Briggsmarriott.com> wrote:
I'm trying to invoke a query to Informix to select rows that match any of
the city / country pairs that exist in an array that is passed into the
method. The SQL itself seems to be OK however it appears that Forte is
having a problem in parsing the Select statement when it gets to the WHERE
clause. The resulting exception shows the SQL string formatted properly up
to the WHERE clause which ends like "WHERE city". Does anyone know of a way
to make this type of query work in a single invocation? I'm trying not to
issue multiple queries as would be the case if I used Dynamic SQL and coding
it dynamically with multiple OR statements is not really an option since the
overall length of the SQL statement cannot exceed 256 bytes. I have included
an example of the code below, any insight would be greatly appreciated.
SQL SELECT address1 tnAddress, city tnCity, state tnState, zipcode
tnZipcode,
hotel_code tnHotel_Code, name tnHotelName, product_code
tnProduct_code, loc_type tnLoc_Type,
phone tnPhone, country_code tnCountry
INTO
:po_aboLocator
FROM
Hotel
WHERE
city in :pi_aboNickNameList[*].sCityName and
country_code in :pi_aboNickNameList[*].sCountryCode
ON SESSION getDBSession();
Thank you very much,
Bob
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com -
Adding filter conditions dynamically in WHERE clause -dynamic SQL help
Here I have a simple condition but very complicated query. Basically, I have to put a filter condition in my where clause. "Location" comes to the stored procedure as parameter. Plus there are other parameters as well.
If location = "all", I can run the query simply and get the result. But when Location = "CA", which is just a subset of "ALL" then I am having hard time putting one -- AND statement in WHERE clause.
This query is designed for location = 'ALL'
open cv for
'Select col1, col2, col3, Col4
from t1, t2, t3
WHERE condition1
AND condition2
AND condition3'
AND location = location_id --- This should only run if location IS NOT ALL
I have written a dynamic query but it doesn't work for that part. Any ideas will be appreciated. Thanks,From what I understood
If location = 'ALL' then
fetch all the records
Else
add extra filter location_id = <supplied location id>
End If
If this is the condition the following logic should solve your issue.
open cv for
'Select col1, col2, col3, Col4
from t1, t2, t3
WHERE condition1
AND condition2
AND condition3'
AND ((location_id = location_id and location = 'ALL') or (location_id = location))Regards
Raj -
Hi,
I have the following query in a SQL Query (Pl/Sql Function Body Returning Sql Query) report:
DECLARE
q VARCHAR2(32767); -- query
w VARCHAR2(4000) ; -- where clause
we VARCHAR2(1) := 'N'; -- identifies if where clause exists
BEGIN
q:= 'SELECT "OSP_ID",' ||
' "OSP_NUMBER",'||
' "PROPOSAL_TITLE",'||
' "PROPOSAL_TYPE",'||
' "AGENCY_TYPE_CODE",'||
' "AGENCY_TYPE",'||
' "AGENCY_CODE",'||
' "AGENCY_NAME",'||
' "AGENCY_ABBREVIATION",'||
' "SPONSOR_CODE",'||
' "SPONSOR_NAME",'||
' "PI_NAME",'||
' "PI_EMP_NUMBER",'||
' "PI_PERS_ID" '||
' FROM "PROPOSAL_V" ';
IF :P25_OSP_NUMBER != '-All-'
THEN
w := ' OSP_NUMBER = :P25_OSP_NUMBER ';
we := 'Y';
END IF;
IF :P25_PROPOSAL_TYPE != '-1'
THEN
IF we = 'Y'
THEN
w := w || ' AND PROPOSAL_TYPE = :P25_PROPOSAL_TYPE ';
ELSE
w := ' PROPOSAL_TYPE = :P25_PROPOSAL_TYPE ';
we := 'Y';
END IF;
END IF;
IF we = 'Y'
THEN q := q || ' WHERE '|| w;
END IF;
RETURN q;
END;
What I need is to change the ' OSP_NUMBER = :P25_OSP_NUMBER ';
to ' OSP_NUMBER LIKE '%'||:P25_OSP_NUMBER'%'|| ';
But I'm getting errors when I do like above.
Can somebody please help...
Thanks in advance
- PradeepFirst of all, get rid of that silly "where exists" variable, just add a where clause like where 1=1 to the query and keep adding dynamic clauses with AND clause as needed.
Try
q := q||'and OSP_NUMBER LIKE ''%'''||:P25_OSP_NUMBER||'''%'''; -
How to dynamically build where clause in Linq
Hello everyone,
Oracle DB:11gR2
Oracle Client: 11.2.0.3.0 (ODP.NET)
Oracle Developer Tools for Visual Studio
VS 2010 (C#)
In a Windows Form, we need to query the data based on the values of dropdown listboxes, which user will select.
Let's say, two combox, one is for Department and one is for Salary
Department:
-1 All
10 Department 1
20 Department 2
30 Department 3
Salary:
-1 All
1 < 20000
2 20000 to 50000
3 50000 to 100000
4 > 100000
Here is C# code to query data:
using (var myEDMctx = new HREntities())
var LINQrslt = from emp in myEDMctx.EMPLOYEES
select emp;
The default values for both combox should be All.
How to write the dynamic where clause for this LINQ?
Thanks in advance!!!There is nothing Oracle-specific about dynamic LINQ queries. Dynamic LINQ queries are handled all the same way, no matter which data source you use. Microsoft describes how to use Dynamic LINQ here:
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
http://weblogs.asp.net/davidfowler/archive/2010/08/19/dynamic-linq-part-2-evolution.aspx -
Dynamically setting where clause parameter before the page load
Hi Experts,
I do have the following requirement.
I am working on jsf page in ADF10.1.3.3. I have a View Object which displays the results on the screen. Can someone provide me some example where I can dynamically set the where clause parameter to my Query in VO before the Page Load happens(By Overriding the Prepare Model) and display results on screen.
ThanksHi,
Thanks for yor advice.
I need to write the method in Prepare Model method when the page loads and not in AM.
Here in the page there is no action as such.
On the Page load we need to directly set the Where Clause on the VO.
Provide me some examples if any.
Thanks -
Need Help with a String Binary Tree
Hi, I need the code to build a binary tree with string values as the nodes....i also need the code to insert, find, delete, print the nodes in the binarry tree
plssss... someone pls help me on this
here is my code now:
// TreeApp.java
// demonstrates binary tree
// to run this program: C>java TreeApp
import java.io.*; // for I/O
import java.util.*; // for Stack class
import java.lang.Integer; // for parseInt()
class Node
//public int iData; // data item (key)
public String iData;
public double dData; // data item
public Node leftChild; // this node's left child
public Node rightChild; // this node's right child
public void displayNode() // display ourself
System.out.print('{');
System.out.print(iData);
System.out.print(", ");
System.out.print(dData);
System.out.print("} ");
} // end class Node
class Tree
private Node root; // first node of tree
public Tree() // constructor
{ root = null; } // no nodes in tree yet
public Node find(int key) // find node with given key
{ // (assumes non-empty tree)
Node current = root; // start at root
while(current.iData != key) // while no match,
if(key < current.iData) // go left?
current = current.leftChild;
else // or go right?
current = current.rightChild;
if(current == null) // if no child,
return null; // didn't find it
return current; // found it
} // end find()
public Node recfind(int key, Node cur)
if (cur == null) return null;
else if (key < cur.iData) return(recfind(key, cur.leftChild));
else if (key > cur.iData) return (recfind(key, cur.rightChild));
else return(cur);
public Node find2(int key)
return recfind(key, root);
public void insert(int id, double dd)
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
if(root==null) // no node in root
root = newNode;
else // root occupied
Node current = root; // start at root
Node parent;
while(true) // (exits internally)
parent = current;
if(id < current.iData) // go left?
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
parent.leftChild = newNode;
return;
} // end if go left
else // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
parent.rightChild = newNode;
return;
} // end else go right
} // end while
} // end else not root
} // end insert()
public void insert(String id, double dd)
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
if(root==null) // no node in root
root = newNode;
else // root occupied
Node current = root; // start at root
Node parent;
while(true) // (exits internally)
parent = current;
//if(id < current.iData) // go left?
if(id.compareTo(current.iData)>0)
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
parent.leftChild = newNode;
return;
} // end if go left
else // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
parent.rightChild = newNode;
return;
} // end else go right
} // end while
} // end else not root
} // end insert()
public Node betterinsert(int id, double dd)
// No duplicates allowed
Node return_val = null;
if(root==null) { // no node in root
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
root = newNode;
return_val = root;
else // root occupied
Node current = root; // start at root
Node parent;
while(current != null)
parent = current;
if(id < current.iData) // go left?
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
return_val = newNode;
parent.leftChild = newNode;
} // end if go left
else if (id > current.iData) // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
return_val = newNode;
parent.rightChild = newNode;
} // end else go right
else current = null; // duplicate found
} // end while
} // end else not root
return return_val;
} // end insert()
public boolean delete(int key) // delete node with given key
if (root == null) return false;
Node current = root;
Node parent = root;
boolean isLeftChild = true;
while(current.iData != key) // search for node
parent = current;
if(key < current.iData) // go left?
isLeftChild = true;
current = current.leftChild;
else // or go right?
isLeftChild = false;
current = current.rightChild;
if(current == null)
return false; // didn't find it
} // end while
// found node to delete
// if no children, simply delete it
if(current.leftChild==null &&
current.rightChild==null)
if(current == root) // if root,
root = null; // tree is empty
else if(isLeftChild)
parent.leftChild = null; // disconnect
else // from parent
parent.rightChild = null;
// if no right child, replace with left subtree
else if(current.rightChild==null)
if(current == root)
root = current.leftChild;
else if(isLeftChild)
parent.leftChild = current.leftChild;
else
parent.rightChild = current.leftChild;
// if no left child, replace with right subtree
else if(current.leftChild==null)
if(current == root)
root = current.rightChild;
else if(isLeftChild)
parent.leftChild = current.rightChild;
else
parent.rightChild = current.rightChild;
else // two children, so replace with inorder successor
// get successor of node to delete (current)
Node successor = getSuccessor(current);
// connect parent of current to successor instead
if(current == root)
root = successor;
else if(isLeftChild)
parent.leftChild = successor;
else
parent.rightChild = successor;
// connect successor to current's left child
successor.leftChild = current.leftChild;
// successor.rightChild = current.rightChild; done in getSucessor
} // end else two children
return true;
} // end delete()
// returns node with next-highest value after delNode
// goes to right child, then right child's left descendents
private Node getSuccessor(Node delNode)
Node successorParent = delNode;
Node successor = delNode;
Node current = delNode.rightChild; // go to right child
while(current != null) // until no more
{ // left children,
successorParent = successor;
successor = current;
current = current.leftChild; // go to left child
// if successor not
if(successor != delNode.rightChild) // right child,
{ // make connections
successorParent.leftChild = successor.rightChild;
successor.rightChild = delNode.rightChild;
return successor;
public void traverse(int traverseType)
switch(traverseType)
case 1: System.out.print("\nPreorder traversal: ");
preOrder(root);
break;
case 2: System.out.print("\nInorder traversal: ");
inOrder(root);
break;
case 3: System.out.print("\nPostorder traversal: ");
postOrder(root);
break;
System.out.println();
private void preOrder(Node localRoot)
if(localRoot != null)
localRoot.displayNode();
preOrder(localRoot.leftChild);
preOrder(localRoot.rightChild);
private void inOrder(Node localRoot)
if(localRoot != null)
inOrder(localRoot.leftChild);
localRoot.displayNode();
inOrder(localRoot.rightChild);
private void postOrder(Node localRoot)
if(localRoot != null)
postOrder(localRoot.leftChild);
postOrder(localRoot.rightChild);
localRoot.displayNode();
public void displayTree()
Stack globalStack = new Stack();
globalStack.push(root);
int nBlanks = 32;
boolean isRowEmpty = false;
System.out.println(
while(isRowEmpty==false)
Stack localStack = new Stack();
isRowEmpty = true;
for(int j=0; j<nBlanks; j++)
System.out.print(' ');
while(globalStack.isEmpty()==false)
Node temp = (Node)globalStack.pop();
if(temp != null)
System.out.print(temp.iData);
localStack.push(temp.leftChild);
localStack.push(temp.rightChild);
if(temp.leftChild != null ||
temp.rightChild != null)
isRowEmpty = false;
else
System.out.print("--");
localStack.push(null);
localStack.push(null);
for(int j=0; j<nBlanks*2-2; j++)
System.out.print(' ');
} // end while globalStack not empty
System.out.println();
nBlanks /= 2;
while(localStack.isEmpty()==false)
globalStack.push( localStack.pop() );
} // end while isRowEmpty is false
System.out.println(
} // end displayTree()
} // end class Tree
class TreeApp
public static void main(String[] args) throws IOException
int value;
double val1;
String Line,Term;
BufferedReader input;
input = new BufferedReader (new FileReader ("one.txt"));
Tree theTree = new Tree();
val1=0.1;
while ((Line = input.readLine()) != null)
Term=Line;
//val1=Integer.parseInt{Term};
val1=val1+1;
//theTree.insert(Line, val1+0.1);
val1++;
System.out.println(Line);
System.out.println(val1);
theTree.insert(50, 1.5);
theTree.insert(25, 1.2);
theTree.insert(75, 1.7);
theTree.insert(12, 1.5);
theTree.insert(37, 1.2);
theTree.insert(43, 1.7);
theTree.insert(30, 1.5);
theTree.insert(33, 1.2);
theTree.insert(87, 1.7);
theTree.insert(93, 1.5);
theTree.insert(97, 1.5);
theTree.insert(50, 1.5);
theTree.insert(25, 1.2);
theTree.insert(75, 1.7);
theTree.insert(12, 1.5);
theTree.insert(37, 1.2);
theTree.insert(43, 1.7);
theTree.insert(30, 1.5);
theTree.insert(33, 1.2);
theTree.insert(87, 1.7);
theTree.insert(93, 1.5);
theTree.insert(97, 1.5);
while(true)
putText("Enter first letter of ");
putText("show, insert, find, delete, or traverse: ");
int choice = getChar();
switch(choice)
case 's':
theTree.displayTree();
break;
case 'i':
putText("Enter value to insert: ");
value = getInt();
theTree.insert(value, value + 0.9);
break;
case 'f':
putText("Enter value to find: ");
value = getInt();
Node found = theTree.find(value);
if(found != null)
putText("Found: ");
found.displayNode();
putText("\n");
else
putText("Could not find " + value + '\n');
break;
case 'd':
putText("Enter value to delete: ");
value = getInt();
boolean didDelete = theTree.delete(value);
if(didDelete)
putText("Deleted " + value + '\n');
else
putText("Could not delete " + value + '\n');
break;
case 't':
putText("Enter type 1, 2 or 3: ");
value = getInt();
theTree.traverse(value);
break;
default:
putText("Invalid entry\n");
} // end switch
} // end while
} // end main()
public static void putText(String s)
System.out.print(s);
System.out.flush();
public static String getString() throws IOException
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = br.readLine();
return s;
public static char getChar() throws IOException
String s = getString();
return s.charAt(0);
public static int getInt() throws IOException
String s = getString();
return Integer.parseInt(s);
} // end class TreeAppString str = "Hello";
int index = 0, len = 0;
len = str.length();
while(index < len) {
System.out.println(str.charAt(index));
index++;
} -
Need help on search string in EBS
Hi,
We have a situation where multiple BAI transactions comes with same code, ex: 451 and based on the text in the note to payee they need to be posted to different clearing accounts.
I did config taking advantage of search string and posting rule in tareget field (EBVGINT)
For some reason getting an error message saying " Account symbol in account assignment not replaceable"
For example of CITI in the note to payee, my config is like this :
Created Account symbol CITI, Assigned GL account to account symbol CITI and account modifier as CITI too
Created posting key as CITI and posting rules are posting rule CITI , 40 (debit) post to bank accounting (option 1) for account symbol CITI and 50 (credit) post to bank as account symbol with posting to bank accounting (option 1) document type SA.
In the search string section, created a search string CITI with source (text from note to payee) and target as CITI (posting rule key)
then this searchs tring has been assigned to the company code, house bank, no algorithm, target field as posting rule and no prefix.
Can anybody explain me why i am getting the above error message based on this config ??
Thanks in advance
umaHi Uma,
The search string works this way:
Step 1: You define a search string. The search string should be a unique word or number or a combination which appears in the 88 record of the BAI statement. In the definition:
a. you give a name for the search string
b. a definition or long text
c. the search string - the unique word you want the system to search for in the 88 record. Please note that the search string you enter here should appear exactly in the same way in your bank statement.
d. you map this search string to a Posting rule or cost center or whatever you want to replace in the next step.
Step 2. Here you tell the system how this mapped information (in (d) above) is to be used. The mapped information could be used as a posting rule, as cost center, as profit center or in any way you want if you define your own logic.
The usage could be specific to a House bank, Account ID, Company code, BAI code combination or you can leave it as generic so that it will be used for all House Bank and Account ID in all company code.
But I would advise you to keep it very specific otherwise the results would not be what you want to be.
To answer your question: Also, do i need to add the entries in transaction type and assign them to the external transaction and posting rule ?
It is not required. But if you have assigned a posting rule under the Transaction type, the configuration in search string will override it. So you really don't need the assignment of posting rule under transaction type, but I would advise you to do it because if the system does not find your search string, then it will take this assignment as default.
Hope I made myself clear.
Kalyan
Maybe you are looking for
-
Hi! I can't upgrade my iTunes 10.3.1.55 on my Windows XP 2002 SP3 to the latest version of iTunes. Got the message: "A problem has occured with the Windows Installer-package. A program needed for this installation could not be run." What to do?
-
Error - Material cost estimate with quantity structure
Hello Gurus! Can anyone please help with the following problem: Im trying to do the material cost estimate with quantity structure, but the system is throwing back the message " There is no exchange rate for exchange rate type P on 1.01.2008: CHF -
-
How to access a file via Applet and JavaScript
I want to copy one file on the client machine from one place to another place from a Java Bean. To do this I created an applet and a Java Bean as follows: import java.applet.*; public class FileUtils extends Applet { public void copyFile(String s
-
Hi, I've this problem using BW 7.0: When I try to load some data from a table, the system find a greek character (µ) and it stop the data loading. The error's message is this: "Record 982 :0UNIT : Data record 982 ('0CSQA0787 '): Version 'µM ' is not
-
Like exporting and importing a page
hello, As the steps serian to follow to export a page of an application, soon to concern it in another application it gives an error me: This page was exported from a different application or from an application in different workspace. Page cannot be