cancel
Showing results for 
Search instead for 
Did you mean: 

Take the minimum of all existing tags

Former Member
0 Kudos

Hi All,

I have a conversion rule in the mapping which is as mentioned below

The source sield should be mapped to the target field,but should take the minimum of the existing tag of the source,that is,

Source->Target

Take the minimum of the existing tags of the Source.

The Source may be occurring for n number of times ,I need to take the minimum of all the existing tags.

Can you please help me on this?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

if you source occurs N times, then isnt the minimum always N-(N-1) ?

i.e isnt it always 0 or 1?

Else, do elaborate more.

Former Member
0 Kudos

H Shabarish,

Thanks for the reply.

The conversion rule is that the Source may occur for N number of times,butI need to map the minimum value of the source field to the target field.

Can I use any node function or I need to write any UDF for that?

Thanks in advance

former_member200962
Active Contributor
0 Kudos
Can I use any node function or I need to write any UDF for that?

Node functions wont be helpful, you need to wirte a UDF.

Shabarish_Nair
Active Contributor
0 Kudos

there is no node function.

write a UDF with the formula of N-(N-1).

You can use count function to get the value of N (maximum occurrence)

some help - http://wiki.sdn.sap.com/wiki/display/XI/CountofRecords-%27Countontheeasiestway+through%27

Former Member
0 Kudos

Hi Abhishek and Shabarish,

Thanks for the replies.

Can you please provide me the UDF?

I'll be thankful to you.

Thanks in advance

Former Member
0 Kudos

Hi,

Can you explain your senario with example.

Shweta.

Former Member
0 Kudos

Hi Shwetambari,

Thanks for the reply.

The mapping requirement is like

The the minimum value of the source field is supposed to be mapped with the target field.

The source can occur for N number of times,among those N number of times I need to map the minimum value of the source field to the target field.

I need to write UDF for this .Can you please help me in providing the UDF ?

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Swetha,

use count function to count how many times your source element occured,it gives interger value,then take this one as a input to your UDF and do your logic. i dont think logic difficult.

i am not clear your requirement

suppose your source element occured 10 times then what you want to do.

Regards,

Raj

Former Member
0 Kudos

Hi,

U have some source structure and u want to map to the target field with a value with, the lowest occurence of all fields from the source rt?

If yes, then use the count functions for all the fields and pass it to UDF.

The UDF will give the o/p as lowest number...

The logic here is simple..

If my understanding is correct... let us know.. will provide the UDF for this..

Babu

Former Member
0 Kudos

Hi Raja and hibabu ,

Thanks for the reply.

The mapping requirement is like

The the minimum value of the source field is supposed to be mapped with the target field.

The source can occur for N number of times,among those N number of times I need to map the minimum value of the source field to the target field.

Actually,I need to map the smallest value of the source field with the target field.

I need to write UDF for this .Can you please help me in providing the UDF ?I have never written any UDF.

Thanks in advance.

Former Member
0 Kudos

Hi,

Before going for UDF let me conform this.

1. U have some values coming in source fields. Out of all these values from u source u want to choose the smallest of them and map to the target corresponding field.

ABC is a field and u get values like 123,890,012... u should map 012 now to target..

Am i rt?

If s no need UDF... u can do using node functions.

2. U have from source different fields coming in different occurences... u want to get the lowest occurence of any field. and u want to map this lowest occurence number to target???

ABC coming 5 times.

DEF coming 3 times.

U want to map 3 to target field.

If s u can do it by small UDF.

Please conform which one above exactly u require...

If both not please describe the scenario.. little clear

Babu

Former Member
0 Kudos

Thanks hibabu for your reply.

ABC is a field and u get values like 123,890,012... u should map 012 now to target..

Yes you are right.

Can you please provide me the UDF for this?

Thanks in advance.

Former Member
0 Kudos

Hi Shwetha,

No UDF required for this. U can easily do this srom simple functions.

Source field(Change context to message type)> Sort(Lexographical, Ascending)>Remove context>CollapseContext>TargetField.

From source field change the context(right clich and context to message type)

Sort it lexographically along ascending.

Remove the context..

Collapse context..

Now map to the target field...

If still nt solved let us know..

Babu

Former Member
0 Kudos

Thanks hibabu for your reply.

Answers (1)

Answers (1)

Former Member
0 Kudos

answered