cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding the Mapping ...!

Former Member
0 Kudos

Hi ,

I have a requirement for one of the Interfaces . the Input Structure is given below

<Material_Classification>

<Characteristic_Name>CUBE_PRICE</Characteristic_Name>

<Characteristic_Value>FAX 2033</Characteristic_Value>

</Material_Classification>

<Material_Classification>

<Characteristic_Name>CLUB_STATE</Characteristic_Name>

<Characteristic_Value>FRANCE</Characteristic_Value>

</Material_Classification>

</Material_Record>

</MT_MDMMaterialData>

As per the requirement if the Characteristic_Name endswith Value "STATE" then Output value (Characterstic value ==StateIndictor ) Ie "France" else should give a blank value to the stateindictor if Characteristic_Name not ends with Value STATE..

I used the If else then conditon to satstify the above requirement but the problem is in my mapping if i run the above test code

the Output i am getting is empty value . ie (StateIndictor==Empty Value) ie the if statement is checking the first leve "Characterstic Name " and sending the blank value as output instead of moving to the next Level where Chracterstic Name has a STATE value ...

can any one suggest me a better solution to get the result .

Regards,

Aziz khan ,

Accepted Solutions (0)

Answers (1)

Answers (1)

RKothari
Contributor
0 Kudos

Hi,

There could be context problem. Check by adding SplitByValue(Each) after the condition. Also check if Name and Value fields are in the same context.

-Rahul

Former Member
0 Kudos

Hi Rahul,

Let me know how to use that Splitbyvalue(Each) in the mapping along with the ifelsethen condition ...!

Regards,

Aziz khan .

RKothari
Contributor
0 Kudos

After If Then Else condition add node function SplitByValue(each).

Source field ---> IfElse function --> SplitByValue(Each Value) --> target field

Former Member
0 Kudos

I tried using the below UDF to satisfy the above requirement . let me know if My Syntax is correct with regard to the above requirement which i had explained .

while(var1.!endsWith("STATE"))
Input variable is classification Name

{

if(var1.endsWith("STATE"))

{

return true;

}

}

Let me know

Regards,

Aziz khan

Former Member
0 Kudos

I used the same . but still i am getting the same empty value as the Output .

Can i use the UDF for the same to fullfill the requirements ...!

Regards,

Aziz khan ,

RKothari
Contributor
0 Kudos

Yes, you can use UDF.

Try the below code.

Select Cache option of UDF as context

Var1 is characterstic name and var2 is char value.

for(int i=0;i<var1.length;i++)
{
if(var1<i>.endsWith("STATE"))
{
result.addValue(var2<i>);
}
else
{
result.addValue("");
}
}

Former Member
0 Kudos

Hi,

I guess, in the output u want something like this:

<Target>

<StateIndictor></StateIndictor>

</Target>

<Target>

<StateIndictor>FRANCE</StateIndictor>

</Target>

There is no need to creta a UDF, but still u need to use go with this:

Execution type: All values of a context, Input: a, b

if(a[0].endsWith("state"))

{

result.addValue(b[0]);

}

else

{

result.addValue("");

}

mapping:

Characteristic_Name

-


UDF----


StateIndictor

Characteristic_Value

Thanks

Amit

Former Member
0 Kudos

Thanks for the UDF ...!

but the UDF explains about the Length of the Var1 ie Charaterstic_Name

let me explain you my requirement ..!

INPUT Stracture

<Source>

<Material_Claffication>

<Charaterstic_Name>East_Cut</Charaterstic_Name>

<Charaterstic_Value>France</Charaterstic_Value>

</Material_Claffication>

<Material_Claffication>

<Charaterstic_Name>East_STATE</Charaterstic_Name>

<Charaterstic_Value>England</Charaterstic_Value>

</Material_Claffication>

</Source

according to Requirement the Target Stracture should be

<Target>

<StateIndictor></StateIndictor>

</Target>

<Target>

<StateIndictor>England</StateIndictor>

</Target>

But i am getting the Below Output as per my mapping useing the iFelsethen Condition along with EndsIf

<Target>

<StateIndictor></StateIndictor>

</Target>

<Target>

<StateIndictor></StateIndictor>

</Target>

The StateIndictor as Blank ....My if else statement is not able to check the second Charaterstic_Name condtion which endswith Value "STATE" to get the Output as "England" ....

Charaterstic_Name has 0..unbounded as occurence ..!

Let me know how to achive this ..Required target ..using UDF or any other means ..!

Regards,

Aziz khan

RKothari
Contributor
0 Kudos

>>but the UDF explains about the Length of the Var1 ie Charaterstic_Name

var1.length counts the number of Characterstic_Name nodes in UDF.

Have tried the UDF in ur mapping??? is it showing the same result as you are getting using GUI functions ?

Former Member
0 Kudos

Hi Rahul,

when i tried that UDF . it is showing Error in the UDF Part as "Return Type expected kind of Error ...!

RKothari
Contributor
0 Kudos

As suggested earlier, have you selected advanced option i.e. Select Cache option of UDF as context??

The udf is working for me

Former Member
0 Kudos

Hey All,

The Problem got solved . thank you so much for your help .

Regards,

Aziz khan