on 05-23-2008 2:42 PM
Hi XI Gurus,
I hav to create a UDF.This is an IDOC - XI - FILE seerio. In this senerio is I have an IDOc whose 7th segment contains a field. This field can store values in between 0 - 9. On the other hand I have a file structure in my left hand side from Messge mapping prespective , which contains 9 similar sized fields.
Now the logic is if the field in the segment of the idoc has value say '3', then the file structure in the left hand side would have 3 in the field no 3 and all other fields 1, 2, 4, 5, 6, 7, 8, 9 would be zero.
Can u guys suggest some logic for this???
Thanks in advance !
Poits would be rewarded.
Arnab
Your requirement does not need any UDF, a simple if then else will help.
As you have clearly mentioned that the target has nine fields, so for the first field you define a constant and check if the input value equalS constant 1, if yes then pass input value else pass zero.
Similarly change the constant value for second field on the target side to 2 and do a similar if then else.
regards
sameer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1) Write folowing UDF
Type : Context
Input Value : field(segment containing field)
code :
for(int i = 0;i<field;i++)
{
if((i == 6)&&( field<i>.equals("3")))
{
result.addValue("true");
}
}
use ifWithOutElse standard function(Keeps == true)
2) Node file field 3 do following mapping
use ifWithOutElse standard function(Keeps == true)
field>UDF>ifWithOutElse(for 2nd value use constant contains value 3 )-->field 3
3) For all other nodes (1, 2, 4, 5, 6, 7, 8, 9 )
field>UDF>ifWithOutElse(for 2nd value use constant contains value 0 )-->field 3
Regards,
Rohit
Reward points if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mohd,
Select the Queue option for getting individual nodes
public void test(String[] a,ResultList result,Container container){
if (a<i> == 7) { //This is for selecting the node
for(i=0;i<10;i++){ //This is for collecting the correct value
ifIi==3){
write what ever u have to done
}
else{
write the exceptional condition
}
}
}
Dont to Reward points if this helps
Regards
Pragathi.
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do it using the existing Boolean unctions in Graphical Mapping.
Check the segment field value with a constant(0-9) and map it accordingly with every field on file structure side Using if else then .
Thanks,
Vijaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
I don't think you need to go for UDF for this activity.
Source Field --->If Else(Verify if value is "1" else pass 0) ---> Field1
Similarly you can apply it for other fields also.
But as you had said * IDOc whose 7th segment contains a field*...and the IDOC have multiple occurance for the same segment and have to always refer 7th Segment then you need below code to be used in UDF.
Pass to UDF as
Source Segment ---> A
Field of Segment ---> B
Cache parameter as Queue
Copy paste below source code
if(Integer.parseInt(B[7]) == "1")
result.addValue(B[7]);
else
result.addValue(B[7]);
Similarly you have apply this logic for all the fields with modifying the value of UDF
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the Standard Mapping function go to the Conversion.
and use "FixValues"
On the left hand side define 1 to 9 and on Right hand side define 0 for all and 3 for 3.
Other way to do is you can go to Boolean functions and use "if".
Gaurav Jain
**Points if answer is useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.