cancel
Showing results for 
Search instead for 
Did you mean: 

RFC -> XI -> JDBC(mapping only the last row of a record)

Former Member
0 Kudos

Hello all,

in a mapping response from an oracle base after a RFC call with a select statement, i have the following response :

<StatementSelect_response>(cardinality 0..1)

<row1>(cardinality 0..unbounded)

<field1>1</field1>

<field2>2</field2>

</row1>

<row2>

<field1>3</field1>

<field2>4</field2>

</row2>

</statement>

i have to map those fields in a RFC_response like :

<RFC_response>(0..1)

<field1>

<field2>

</rfc _response>

Problem : I only need to send back to the rfc_response the last records of my StatementSelect_response in order to have the following message :

<RFC_response>

<field1>3

<field2>4

</rfc _response>

How can i select only the last row of my records plz ?

Thanks by advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I will try on next monday and will do a feedback.

Thanks for the first answers...

Former Member
0 Kudos

Hi,

I paste the code in my UDF but it gives an error :

_.java:65: ')' expected

result.addValue(""a(a.length-1)"");

^

1 error

Can you tell me why please ? Do i need to import specific librairies ?

Edited by: Jean-Philippe PAIN on Jan 21, 2008 10:15 AM

aashish_sinha
Active Contributor
0 Kudos

Hi,

>>>>> _.java:65: ')' expected result.addValue(""a(a.length-1)"");

Can you please check that if u missing a "," (Comma) thr.. or xcheck in above n below lines of this if you missing some bracket or some semi colon. if no

check out if you are providing the correct parameters to the addValue.

It should be like this

public void addValue(java.lang.String key,

double val,

java.lang.String comment)

. I hope you giving the two parameters.

regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

I 'm novice in Java so it's a little bit unclear for me. My function is :

public void LastRow(String[] a,ResultList result,Container container){

Result.addValue(""a(a.length-1)"");

}

I don't see a missing comma or else...

VijayKonam
Active Contributor
0 Kudos

Hi,

public void LastRow(String[] a,ResultList result,Container container){

int len = a.length;

Result.addValue(a\[len-1\]);

}

Edited by: VJ on Jan 21, 2008 3:51 PM

justin_santhanam
Active Contributor
0 Kudos

Jean,

you must not write the code like result.addValue(""a(a.length-1)"");

instead

result.addValue(""a[]"");

inside the [] write a.length-1

The formatting in the forum doesn't allow me to paste the actual code.

raj.

Edited by: Raj on Jan 21, 2008 11:31 AM

justin_santhanam
Active Contributor
0 Kudos

>

> Hi,

>

> public void LastRow(String[] a,ResultList result,Container container){

>

> int len = a.length();

> Result.addValue(a\[len-1\]);

>

> }

VJ,

Please don't confuse him. If you want to update the thread, let me leave it aside.Coz it shouldn't cause him trouble. Can u check a.length() is correct? it has to be a.length, isn't it?

We all here to help others, not under any motivation of compete..

Sorry, if I hurt you..

raj.

VijayKonam
Active Contributor
0 Kudos

Hi Raj,

Me too not a Java expert either. Obviously everyone tries to help but not to confuse any one. Then again, supplying well compiled code to the people will stop them thinking. Their problem will get solved, but next time they will have to come to the forum again.

The mistake was not intentional though. Thanks for pointing out.

VJ

Former Member
0 Kudos

i've used raj's code and it works fine.

Thanks both of you :p.

Edited by: Jean-Philippe PAIN on Jan 23, 2008 4:18 PM

Edited by: Jean-Philippe PAIN on Jan 23, 2008 4:19 PM

Answers (2)

Answers (2)

justin_santhanam
Active Contributor
0 Kudos

Jean,

Follow the logic.

field1(source)- removecontext- udf- field1(Target)

field2(source)- removecontext- udf- field2(Target)

UDF code (input variable a, type queue)

result.addValue(""a(a.length-1)"");

The above should work.

raj.

VijayKonam
Active Contributor
0 Kudos

Write a UDF caching the whole Q of each element by removing contexts. Take only the last values and return them as output..!!

VJ

Former Member
0 Kudos

For that I beleive you have to go for Java Mapping. So the Java code will except the database resp. and it counts the no. of records and take only last and map it to the target.

thanks

farooq