User defined func: Unavble to merge two arrays in result list
Hi
I am trying to merge two arrays on the basis of "FEE" element in the input file;
Actually there is an Attribute Name and Value pair array coming in the input file which has 5 pairs already(Notification + 100 , oversize + 8 etc.) see example below;
<m0:Fees>ZB9</m0:Fees>
<m:Attribute>
<m0:Attributename>NOTIFICATION</m0:Attributename>
<m0:Attributevalue>100</m0:Attributevalue>
</m:Attribute>
<m:Attribute>
<m0:Attributename>OVERSIZE</m0:Attributename>
<m0:Attributevalue>8</m0:Attributevalue>
</m:Attribute>
<m:Attribute>
<m0:Attributename>OVERWEIGHT</m0:Attributename>
<m0:Attributevalue>108</m0:Attributevalue>
</m:Attribute>
<m:Attribute>
<m0:Attributename>SIGNATURE</m0:Attributename>
<m0:Attributevalue>294</m0:Attributevalue>
</m:Attribute>
<m:Attribute>
<m0:Attributename>RTS</m0:Attributename>
<m0:Attributevalue>8</m0:Attributevalue>
</m:Attribute>
The condition is:
CASE 1. If the FEE doesn't exist in the file then only the Atrribute Name and Value in added to the Array
CASE 2 If FEE exist then add all the Atrribute Name and Value pairs as well as in the last index of Array add String "Fee" in Attributename and String "ZB9" in Attributevalue.
CASE 1 is working fine.
but in CASE 2 even if i m taking an output array of length Attributename +1 and Attributevalue +1 and trying to add "Fee" and "ZB9" respectively, it never happens.
Please have a look at the code below;
//write your code here
public void ud_Attributename(String[] Fees,String[] Attributename,ResultList result,Container container){
String attribute_copy[]=new String[Attributename.length+1];
String attribute_name[]=new String[Attributename.length];
String array_copy1[]=new String[Attributename.length+1];
//int len =Attributename.length;
if(Fees[0]!=null)
if(Fees[0].equals("ZB0"))
Fees[0]="01";
else if(Fees[0].equals("ZB5"))
Fees[0]="02";
else if(Fees[0].equals("ZB6"))
Fees[0]="03";
else if(Fees[0].equals("ZB9"))
Fees[0]="04";
try{
if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04"))
for(int x=0;x<=Attributename.length;x++)
if(x==Attributename.length)
array_copy1[x]="Fee";
else{
array_copy1[x]=Attributename[x];
result.addValue(array_copy1[x]);
else
for(int i=0;i<=len;i++)
attribute_name<i>=Attributename[i+1];
result.addValue(attribute_name<i>);
}catch(Exception e)
{e.printStackTrace();}
Same way i've used for Attributevalue.
But the result is
<ATTRIBUTEPAIR>
<PAIR>
<NAME>NOTIFICATION</NAME>
<VALUE>04</VALUE>
</PAIR>
<PAIR>
<NAME>OVERSIZE</NAME>
<VALUE>8</VALUE>
</PAIR>
<PAIR>
<NAME>OVERWEIGHT</NAME>
<VALUE>108</VALUE>
</PAIR>
<PAIR>
<NAME>SIGNATURE</NAME>
<VALUE>294</VALUE>
</PAIR>
<PAIR>
<NAME>RTS</NAME>
<VALUE>8</VALUE>
</PAIR>
</ATTRIBUTEPAIR>
Please suggest where i am wrong. ur help is very much appreciated.
Thnks in advance
this is i am doing now
//write your code here
String attribute_copy[]=new String[Attributename.length+1];
String attribute_name[]=new String[Attributename.length];
String attribute_name1[]={"Fee"};
//String[] Attributename.copyTo(attribute_name1,0);
//String[] attribute_name1 = (String[]) Attributename.Clone();
//String fees;
String array_copy1[]=new String[Attributename.length];
int len =Attributename.length;
for(int y=0;y<len;y++){
array_copy1[y]=Attributename[y];
if(Fees[0]!=null)
if(Fees[0].equals("ZB0"))
Fees[0]="01";
else if(Fees[0].equals("ZB5"))
Fees[0]="02";
else if(Fees[0].equals("ZB6"))
Fees[0]="03";
else if(Fees[0].equals("ZB9"))
Fees[0]="04";
else if(Fees[0].equals("ZA1"))
Fees[0]="05";
else if(Fees[0].equals("ZA2"))
Fees[0]="06";
try{
if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04")||(Fees[0]=="05")||(Fees[0]=="06"))
int j=0;
for(int a=0;a<=len;a++)
if(j==0&&attribute_copy[j]==null)
attribute_copy[j]="Fee";
else
//int b=-1;
for(int i=0;i<=len;i++)
if(i==j)
//i=i-1;
attribute_copy[j]=array_copy1[i-1];
break;
else{
continue;}
result.addValue(attribute_copy[j]);
j+=1;
else
for(int i=0;i<=len;i++)
attribute_name<i>=Attributename[i+1];
result.addValue(attribute_name<i>);
}catch(Exception e)
{e.printStackTrace();}
and the result in queue is
SUPPRESS
[FEE]
[NOTIFICATION]
[NOTIFICATION]
[OVERSIZE]
[OVERSIZE]
[OVERWEIGHT]
[OVERWEIGHT]
[SIGNATURE]
[SIGNATURE]
[RTS]
[RTS]
but in the output i m getting
<ATTRIBUTEPAIR>
<REF_HANDLE>0001</REF_HANDLE>
<PAIR>
<NAME>Fee</NAME>
<VALUE>04</VALUE>
</PAIR>
<PAIR>
<NAME>OVERSIZE</NAME>
<VALUE>8</VALUE>
</PAIR>
<PAIR>
<NAME>OVERWEIGHT</NAME>
<VALUE>108</VALUE>
</PAIR>
<PAIR>
<NAME>SIGNATURE</NAME>
<VALUE>294</VALUE>
</PAIR>
<PAIR>
<NAME>RTS</NAME>
<VALUE>8</VALUE>
</PAIR>
</ATTRIBUTEPAIR>
Notification is missing.
Similar Messages
-
Looking for simple algor. for merging two arrays
Do anyone have a simple algorithm for merging two arrays where both arrays can be null or length=0
class Merger
private int[] arr;
public Merger(int[] pa, int[] pb) {
arr = new int[pa.length + pb.length];
for (int x=0; x < pa.length; x++) {
arr[x] = pa[x];
for (int x=0; x < pb.length; x++) {
arr[x+pa.length] = pb[x];
public int[] getArray() {
return arr;
public class MergeMaker
public static void main(String[] args) {
int[] a = { 1, 2, 3 };
int[] b = { 7, 8, 9 };
Merger m = new Merger(a, b);
int[] c = m.getArray();
for (int x=0; x < c.length; x++) {
System.out.println(c[x]);
}Mark -
Anonymous user can't access WPC pages in TREX search result list
An anonymous user can use TREX service to enter query string in search iView and to get the list of results.
But when he tries to open a page (web_paragraph or web_article ) generated by WPC (by clicking on the page link in result list) a logon screen appears in a popup window.
The URL of the window is /irj/servlet/prt/prtroot/... rather than irj/go/km/u2026 .
How to work around this?
At the same time he can see Word, Excel documents and XML Forms (News).
We use light framework.Hi
You need to change PCD Permission for the objects the anonymous used.
And change the parametrer Authentication Scheme to Anonymous.
Good Luck
Eduardo Grilo -
User defined funcs in a Servlet
I am invoking a servlet from a java program. Some data is being sent to the servlet. I want to manipulate that data in servlet. The data sent from java program is received in doGet(). Now to manipulate the data can I write member functions inside a class within the servlet, create an object of that class and invoke the mem Funcs ?
I am invoking a servlet from a java program. Some
data is being sent to the servlet. I want to
manipulate that data in servlet. The data sent from
java program is received in doGet(). Now to
manipulate the data can I write member functions
inside a class within the servlet, create an object
of that class and invoke the mem Funcs ?Have that class outside the servlet. You can also store the object by binding it to a scope and reuse it within a jsp.
ram. -
User defined function error in Labview mathscript
I m Labview 2011 user. I had a problem when i use a user defined func in mathscript.
I have used it well, but it doent work suddenly. It looks like below.
function name turned to grey color suddenly. Plz help me.The last time I dealt with this, it was very confusing. If I remember correctly, there were 3 different places that I had to set the correct search path for the .m file:
1) Tools>Options>MathScript
2) In the Project, right-click on My Computer and select Properties>MathScript
3) Tools>MathScript Window>File>LabVIEW MathScript Properties
The documentation seems to indicate that at least 1 and 2 should be the same and 3 only applies to that window, but like I said, last time I did this I remember having to change all three.
Good luck!
Chris
Certified LabVIEW Architect
Certified TestStand Architect -
Accessing container element in the User Defined Function
Hi All,
I am accessing a container element in the user defined function.
But it is not working. Actually i want to split a message(1800 records) into a batch of 200.
But it goes in a infinite loop.
Please can you tell me where i am wrong.
Smita
The code is :
public void SplitMsg(String[] a,ResultList result,Container container){
Object container1;
String counter;
int i,j=0;
container1 = container.getParameter("value");
if( container1 == null){
counter = "0";
else {
counter = container.toString();
j = Integer.valueOf(counter).intValue();
for ( i = j ; i <= j + 199 ; i++){
if ( i >= a.length){
container.setParameter("value","9999999");
break;
result.addValue(a<i>);
j += 200;
counter = Integer.toString(j);
container.setParameter("value", counter);Here is another way to accomplish what you wanted.
For the target mapping, use this sequence for mapping
Source element -> removeContext -> Your User-defined Function -> Target Element
When defining User-Defined Function, select "Cache Queue" option.
Since you are using removeContext before calling the UserDefined function, your input to the user defined function will be a String array without ResultList.CC.
Now manipulate the array the way you want it, and build the ResultList result.
After every 200 records, use method
void addContextChange().
This will insert the ResultList.CC at the appropriate places.
Use Display Queue in the Mapping Editor to see the debug values. -
Hi All,
How do I create User Defined Choose From LIst in user defined form?
Regards,
Siva Kumarhi ,
There is no direct way to create a user defined CFL.
There are two ways of creating user defined CFL.
One way is to assign a default CFL for your field, and catch the event after the the CFL Loads and reload the matrix with your user defined table and can use the CFL as usual.
The other way is to catch the key_down event of your field and check whether the charpressed is tab key or not.
Create a user defined form with a matrix filled with your defined table and keep a choose button and send the selected value to your field .
In these ways you can create a User defined CFL ...
Hope this helps you
Regards,
Jagadeesh.v -
Dear all
class IntArray {
private int data[];
public IntArray (int d[]) {
data=d;
How to merge two array with method:
public IntArray merge(IntArray b)
I try to find out the length of IntArray with b.length but unsucced.Does this help?
public class FileMerge {
public static void main(String args[]){
int []File1 = {3, 7, 8, 11, 15};
System.out.println();
System.out.print("File 1 is "+File1.length+":");
for (int i=0; i <File1.length; i++) System.out.print(" "+File1[ i ]);
int []File2 = {2, 6, 8, 12};
System.out.println();
System.out.print("File 2 is "+File2.length+":");
for (int i=0; i <File2.length; i++) System.out.print(" "+File2[ i ]);
// merge one from one file then one from the other
int j = 0;
int []File3 = new int[File1.length + File2.length];
for (int i=0; i <File3.length; i++){
if(i < File2.length) File3[j++]=File2[ i ];
if(i < File1.length) File3[j++]=File1[ i ];
System.out.println();
System.out.print("File 3 is "+File3.length+":");
for (int i=0; i <File3.length; i++) System.out.print(" "+File3[ i ]);
// merge all of File1 then all of File2 after this
for (int i=0; i <File1.length; i++){
File3[i] = File1;
for (int i=0; i <File2.length; i++){
File3[File2.length+i+1] = File2[i];
System.out.println();
System.out.print("File 3 is "+File3.length+":");
for (int i=0; i <File3.length; i++) System.out.print(" "+File3[ i ]);
// sort it with built in function
java.util.Arrays.sort(File3);
System.out.println();
System.out.print("File 3 sorted is "+File3.length+":");
for (int i=0; i <File3.length; i++) System.out.print(" "+File3[ i ]);
// re-merge
j = 0;
File3 = new int[File1.length + File2.length];
for (int i=0; i <File3.length; i++){
if(i < File2.length) File3[j++]=File2[ i ];
if(i < File1.length) File3[j++]=File1[ i ];
// bubble sort it
for(int i=0; i <File3.length-1; i++) {
for(j=i+1; j <File3.length; j++) {
if(File3[i] < File3[j]){
int temp = File3[i];
File3[i] = File3[j];
File3[j] = temp;
} // and print it
System.out.println();
System.out.print("File 3 reverse sorted is "+File3.length+":");
for (int i=0; i <File3.length; i++) System.out.print(" "+File3[ i ]);
} // main
} // end class -
OIM user defined field in process form
I am trying to create a user defined field (UDF) in a process form. The UDF would be a drop down list of values for the status field.
I've tried to do this by going to the Administration list, and double clicking on User Defined Field Definition. Then selecting the Form Designer. I can add a column but I cannot add values to the drop down. I know I'm probably doing this wrong.
How do I add a UDF drop down and its values to a process form?
Thanks!1. Create lookup table for the drop down contents.
2.In the process form--->go to the properties tab-->select the User defined filed name-->add property--->property Name drop down list -->select lookup code-->in the property value-->provide the lookup table name-->save
Edited by: user13513300 on Feb 24, 2011 1:45 AM -
? Regarding 'SQL user-defined function' execution performance ?
Hi All,
I have an user-defined function in SQL which am using in a SQL select statement and i found that the execution time taken by the user-defined function is 9-10 minutes as a result of which my whole query execution time is affected.
How to i improvise the execution time. Should i do some sort of scheduling for executing the user-defined functions only. Am new to the database world. Your early response with a good suggestion would really be appreciated.
Thanks in Advance.Try to read SQL tuning documents along with TkProf. Then only you will be able to detect the problem.
There is no instant method by which you can solve this problem.
But, you can get idea from this samples.
Tuning:
http://www.dba-oracle.com/art_sql_tune.htm
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:8764517459743
Reading TkProf:
http://www.dbspecialists.com/presentations/use_explain.html
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:920429344869
Regards.
Satyaki De. -
How to retrieve user defined attributes in Prepopulating a request dataset
Hi,
I have created couple of user defined attributes in user profile.
And I am tryting to develop a prepopulate adapter in a request dataset for a resource. I need to prepopulate request dataset based on the values of above said user defined attributes.
I tried to use tcResultSet result=UserOppsIntf.getSelfProfile(); in my pre-populate adapter but it is giving me only the following attributes and it is not giving any of my user defined attributes.
Users.Manager Key
Users.Manager Login
Users.Manager First Name
Users.Manager Last Name
Users.Password Warning Date
usr_locale
Users.Key
Users.Password Expired
Users.Middle Name
Users.User ID
Users.Password Expiration Date
Users.Status
Users.Password Warned
Users.Email
Telephone Number
Users.Display Name
usr_timezone
Users.Lock User
Users.Last Name
Users.First Name
MEMBERTYPE
If I use the code userData = usrService.getDetails("User Login", RequesterID, null); then I am getting only the following.
Display Name:
act_key:
Full Name:
usr_key:
User Login:
Last Name:
First Name:
Please let me know how to retrieve all of user defined attribute values in prepopulate adapter for a request dataset.Use below code to get all attributes in user profile including UDF.
OIMInternalClient objOimInternalClient = null;
User user = null;
UserManager usrService = null;
objOimInternalClient = new OIMInternalClient();
if (objOimInternalClient != null) {
try {
objOimInternalClient.loginAsAdmin();
usrService = objOimInternalClient
.getService(UserManager.class);
user = usrService.getDetails("usr_key", strUserKey, null);
endDate = (Date) user.getAttribute("End Date");
} catch (Exception e) {
e.printStackTrace();
} finally {
if (objOimInternalClient != null)
objOimInternalClient.logout();
if (user != null)
user = null;
if (usrService != null)
usrService = null;
In order to see all UDF's in User profile, please create Authorization Policy. -
Writing user defined function the same way as the oracle functions
Hi Guys,
In one of the interviews , I have attended the guy asked me to write a user defined function which will take the column name and list all the values .
For example
Table Name:Employees
Column Name: Employee_Name
Employee_name
Scott
Ivgun
Jack
Shane
The query should be in this fromat
SELECT col_agg(Employee_name) emp_name from Employees;
The output shoulld be
Emp_names
scott,ivgun,jack,shane
Please let me know if this is possible
Any suggestions will be highly appreciated.
Thanks,
RanjanYou could certainly write a user defined aggregate function if you like...
e.g. this function will aggregate strings into a CLOB...
create or replace type clobagg_type as object
text clob,
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number,
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number,
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number,
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number
create or replace type body clobagg_type is
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is
begin
sctx := clobagg_type(null) ;
return ODCIConst.Success ;
end;
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is
begin
self.text := self.text || value ;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is
begin
returnValue := self.text;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is
begin
self.text := self.text || ctx2.text;
return ODCIConst.Success;
end;
end;
create or replace function clobagg(input clob) return clob
deterministic
parallel_enable
aggregate using clobagg_type;
SQL> select trim(',' from clobagg(ename||',')) as enames from emp;
ENAMES
SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (select 'PFL' c1, 0 c2,110 c3 from dual union all
3 select 'LHL', 0 ,111 from dual union all
4 select 'PHL', 1, 111 from dual union all
5 select 'CHL', 2, 111 from dual union all
6 select 'DHL', 0, 112 from dual union all
7 select 'VHL', 1, 112 from dual union all
8 select 'CPHL', 0, 114 from dual union all
9 select 'WDCL', 1, 114 from dual union all
10 select 'AHL' ,2 ,114 from dual union all
11 select 'NFDL', 3, 114 from dual)
12 --
13 -- end of test data
14 --
15 select trim(clobagg(c1||' ')) as c1, c3
16 from (select * from t order by c3, c2)
17 group by c3
18* order by c3
SQL> /
C1 C3
PFL 110
LHL CHL PHL 111
DHL VHL 112
CPHL AHL NFDL WDCL 114Ok, it's more than just a function as it uses an object type linking into the internals of the ODCI... but it does what you ask. :) -
Is it possible to have user defined field in pick and pack manager
HI,
I would like to know whether it is possible to have user defined field in pick and pack manager row level.
Manage user defined field there is only provision for <b>pick list</b> and not for <b>Pick and pack</b>.
Regards
KrishnaThe Pick and Pack Manger doesn't relate to any specific table (nothing saved to the database), so it does not make any sense having a userdefiend field on it. I would guess that you could add a column and bind it to a userdatasource (not a SAP database field), but if this make any sense depends on what you are trying to achive...
-
Data retrieval from columns having user defined type
I was learning abstract types the other day.So I created an abstract type and a table.
create type student_ty as object
(name varchar2(20),roll number);
create table result(
student student_ty,
total number);
I have also inserted some data.But I am having some problems with the rretrieval of data.Suppose I want to select only the roll and name of the student as described in the studen type.So I used the follwing query:-
select student.name from result;
But its not working.But when i'm using something like this:-
select r.total,r.student.name from result r;
It is working perfectly.My question is that is it a rule that oracle enforces to use an alias whenever retrieving values from a user defined datatype?.Please help.
Thanks in advance.Hi,
Good observation. As you can see with your first query, the student is considered by oracle as a alias instead of a user-defined type column which is included in your result's table.
>
select student.name from result;
>That is why in this case, you really need to use an alias or you can just use the complete table name like this:
select result.student.name from resultBut, of course, it is not recommended, using alias is much appropriate.
Cheers. -
AD010003 (create user-defined DI characteristics).
Hi Experts,
How to use the Exit AD010003 (create user-defined DI characteristics).
Can we change the 'Price List (PLTYP)', 'Pricing date(PRSDT)' field values by using this Exit.
Please help me.
Regards,
Bala Virupaksha Rao.Bala,
There is a PDF document you can download via [OSS Note 301117|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=301117] which has some worked examples of RRB user-exits.
PeteA
Maybe you are looking for
-
How do I delete my old user completely?
It's more complicated than just deleting a user. I've just upgraded my Mac to Yose mite and deleted my old User and created a new user. I went to preferences and Users & Groups and I've checked it, i only see my new user as Admin. Though when I shut
-
Hi, After reading thru several posts in different forums, I still have one question: What (the heck) is the purpose of the "SB Audigy 4 24/96" ASIO driver mode? I can't record anything when I select that, in Logic 5 for Windows. With the normal drive
-
Premiere Elements 3.0 -- Q. about transitions
Hello! I don't know if anyone else has the dinosaur that is Elements 3.0 (ha!) but that is what I am currently using. I am putting together a DVD slideshow of old family photos for a Christmas present. Does anyone know if there is a button I can cl
-
Updating Delivery Address in PO
Hi guys, I have successfully created PO using BAPI_PO_CREATE1. After creation of PO, in the same program, I am trying to use BDC to insert data into the field ADRN2 ( under delivery address tab in ME22n ), but I keep getting error message saying tha
-
Loading a CSV file to Sql Server
Hi, How can i load a csv file, which is in a shared location itn osql using bods. Where can i create the data source pointing to csv file