cancel
Showing results for 
Search instead for 
Did you mean: 

Java udf

Former Member
0 Kudos

Hello sdn

I need a java udf for :

If my source field has any value starting with "6904" then i dont need to create the target sgment.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

You can achieve this without using UDF as told by Chirag

Do the following and try

E1EDP01:segment
TDID 69045
E1EDP01:segment
TDID 69048
E1EDP01:segment
TDID 98076
E1EDP01:segment
TDI 98764

For all the TDI nodes set same context

Then use substring(0,4) to get

6904

6904

9807

9876

now use the function Equals -> Constant (6904)

 Source -> Substring (0,4) -> Equals -> Constant(6904) ->Not -> iFWithoutElse -> splitbyvalue -> Target

Thanks

Gaurav

Former Member
0 Kudos

Hello sdn

I dont understand what will be the input to the ifwithout else

if-> ?

then - > ?

in your message above i see your logic but what should be put in the then clause ?

Thanks

Former Member
0 Kudos

HI

In then put the source node TDID again

Source -> Substring (0,4) -> Equals -> Constant(6904) ->Not -> iFWithoutElse (Source node in then) -> splitbyvalue -> Target

Thanks

Gaurav

Former Member
0 Kudos

Hello sdn

Your logic seems correct but it is not working.

It is not splitting with the logic you mentioned above.

Can someone suggest?

Thanks

Former Member
0 Kudos

HI

This works fine i have replicated this to verify. You need to set the context of source node to the parent node as well to make it work fine.

Thanks

Gaurav

Former Member
0 Kudos

I set the contrext to higher level ,even the queues look OK,when i look at split by value in the end ,but i am not getting the required result (desired result is to split at target segment ). IT would be good if i could see some screenshot.

Source

E1EDP01:segment

TDID 69045

E1EDP01:segment

TDID 69048

E1EDP01:segment

TDID 98076

E1EDP01:segment

TDI 98764

Target

P01:segment

For 3rd P01

P01:segment

For 4th P01

Thanks

Edited by: Guest1 guest on Nov 10, 2008 3:05 AM

Former Member
Former Member
0 Kudos

Hi

I tried similar logic but in the end as u had mentioned put the splitbyvalue.

I can try without spiltbyvalue tomorrow ,but i had otherwise same logic as yours.

Another thing i noticed is ,try creating a segment on target side instead of the field which you produced.

Eg: Target structure

PO1 : repeating segment

and see if you can get multiple PO1 segments with your logic. Point is to take a value from source segment which is repeating in nature and on target create a target segment by comparing a source field.

Thanks

Edited by: Guest1 guest on Nov 10, 2008 4:22 AM

Former Member
0 Kudos

Hi

yes you need to use SplitbyValue for your scenario. That screen shot is similar to your requirement but not exactly the case

Can you share what exactly you are facing a problem as a screen shot so that we will also know

Thanks

Gaurav

Former Member
0 Kudos

Hi

I can tell you the source and target structure.

It is a IDOC to file scenario

SOURCE : IDOC

E1EDP01

TDID 690456

E1EDP01

TDID 000012

E1EDP01

TDID 690489

In the above source structure E1EDP01 is an IDOC segment which is repeating in nature and TDID is a field which has the above mentioned values.

TARGET : FILE

P01 : Repeating segment within the target file structure.

P01

Field 1

Field 2

P01

Field 1

Field 2

In the above scenario 2 target segments will be created.

I want 2 target segments by comparing value from a source field. If TDID=6904... then dont create target P01 segment.

Thanks

Former Member
0 Kudos

Hey

Will close thread here as it is getting too long and open another thread.

Thanks

Former Member
0 Kudos

replying the solution in another thred

Former Member
0 Kudos

why do u need java UDF for the same.

u can use the std function,.

input value and constant map it to Equals function and use either create if or ifwithoutelse function.

chirag

Former Member
0 Kudos

Hello sdn

as i mentioned inpu tvalue starts with 6904.

if input value is 69048 ,it should not create target segment. IF input value is 45678 ,it should create target segment.

We need to extract the part 6904 from input value and then do equals and createif.

how to achieve this?

Thanks

Former Member
0 Kudos

then use substring first.

chirag

Former Member
0 Kudos

source comes as a field in repeating segment

Creatif : what does this require as input to not create a segment and what input to create the segment.

Thanks

Former Member
0 Kudos

can u give me one example with the sample data and its output.

u have to use the Std XI fucntion for the same (Equals function and use either create if or ifwithoutelse function and map the output to target element)

chirag

Edited by: Chirag Gohil on Nov 9, 2008 12:44 AM

Former Member
0 Kudos

Source

E1EDP01:segment

TDID 69045

E1EDP01:segment

TDID 69048

E1EDP01:segment

TDID 98076

E1EDP01:segment

TDI 98764

Target

P01:segment

For 3rd P01

P01:segment

For 4th P01

Thanks

Former Member
0 Kudos

First make all the value in one context so ur input will look like

69045

69048

98076

98764

Now use substring which will give output as

6904

6904

9807

9876

Now give this input to Equals Function as one input and use constant (6904)

This will give either false and true output.

Now give the output of Equals function to Not function and this Not output to Ifwithoutelse function and in then give the input value in one context.

Then use splitbyvalue and map it to target field.

chirag

If its true then

Former Member
0 Kudos

Hello sdn

I understand your logic but i am not well aware of java.

Can someone send the code?

Thank you