cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help in writing UDF

Former Member
0 Kudos

Hi all,

i need to write UDF,logic is like this,if i dont get the value from source side then default vaule should be sended to target side.How to write the UDF for this logic.

Regards,

phani

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

No need of udf.

If there is no value no node will be created.

Map it like this

Node--


<b>Exists</b>--


<b>IF</b> node function -


target node.

map the node to the <b>THEN</b> brancH and the constant value to the <b>Else</b> branch of IF condition.

Regards

Santhosh

Former Member
0 Kudos

Hi vasanth,

i mapped Like as u Said.

But When I gave the Value in the Source Field , the value is Coming to target.it is Ok

When i Didn't pass any value to the source Field menas it's not taking the value which i gave in the Constant Function. It is Blank value is coming in the target Field

Please Let me know

Regards

Phani

Former Member
0 Kudos

Hi,

Please Find the Mapping Screenshot Here

http://rapidshare.com/files/50750161/Mapping.JPG.html

Regards

Phani

former_member184543
Active Participant
0 Kudos

Hi

Do not use exist to check this logic if you are providing the source structure with blank value in the structure. Exists only checks if a particular node is present or not..

If you have to map corresponding to blank value in source, then refer to the 2nd solution i.e: compare ur source with space using the text equals function and then process with the if else logic

Thanks

Sanjo

Former Member
0 Kudos

Hi,

We need to Map two Fields to Equals Function. Right ????

What r those Fields i need to mapp here

Please let me know

Regards

Phani

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

one should be the node and the other should be the constant.

Node -


Equals -


IF -


Target Node.

Constant----


|

Regards

Santhosh

santhosh_kumarv
Active Contributor
0 Kudos

constant value should be " ".

Regards

Santhosh

Former Member
0 Kudos

Hi,

Node -


Equals -


IF -


Target Node.

Node----


then

Constant----


Equals

here i Need to mapp ELSE ...

Please let me know

Regards

Phani

Former Member
0 Kudos

Hi,

Please See this Mapping And Suggest me What Fields Should i Replace With Whom

http://rapidshare.com/files/50757285/Mapping1.JPG.html

Regards

Phani

Message was edited by:

phani kumar

santhosh_kumarv
Active Contributor
0 Kudos

Hi Phani,

Tey this Mapping this worked

http://www.flickr.com/photos/11767150@N03/1213074336/

Regards

Santhosh

justin_santhanam
Active Contributor
0 Kudos

Phani,

Do the mapping like below

Test->MapwithDefault->Test

I'm sure it will work.

Best regards,

raj.

santhosh_kumarv
Active Contributor
0 Kudos

This was the test results,

1. When there is an input for the Name node

http://www.flickr.com/photos/11767150@N03/1212254079/

2. When there is no input for the name node the output was filled with the value specified in the constant. Inmy case it was empty.

http://www.flickr.com/photos/11767150@N03/1212269521/

I was not able to see the mapping in the link that u provided...

Regards

Santhosh

Former Member
0 Kudos

Hi Santosh,

Problem has been Resolved By Your Answer.

I am Giving Points

Thanks

Regards

Phani

Former Member
0 Kudos

Hi Santosh,

Can U Explain How this IF Then Else Function will Work here

Regards

Phani

santhosh_kumarv
Active Contributor
0 Kudos

Hi Phani,

Here the IF conditions Checks

<b>IF</b> the node is equal to Empty

if true the node mapped to the <b>THEN</b> will be mapped to the target

if false i.e the node = ' ' then the node mapped to <b>ELSE</b> will be mapped to the target node.

For more information go thru the

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

You can simply use the IF -> EXISTS->THEN->ELSE->MAP WITH DEFAULT function

Regards,

Kumar.

P.S: Reward points if helpful!!!!

prasanthi_chavala
Active Contributor
0 Kudos

Hi Phani,

You can proceed without writing UDF by using the standard functions which are available ie You can check for the existance of the node and value.If it doesnt exists then they u can use mapwithdefault function which is there in the standard functions to map the default value to the target side.

Regards,

Prasanthi.

prateek
Active Contributor
0 Kudos

Are u sure u want a UDF. This can be done using standard functions also. Functions Such as if, constant etc.

Regards,

Prateek

former_member192892
Active Contributor
0 Kudos

Hi phani,

You don't need UDF for it...

You can either check whether the source tag exists using exists function under node functions and then implement an if else logic to pass either the original source tag or a constant value...

Else if you want mapping to occur when input is space, you can do a text equals and again implement an if else logic

Thanks

Varun