Skip to Content

Need UDF help

Dear Experts,

I am getting data like below.

<Condition GroupType="AllowableAction" Name="Saleable">false</Condition>

<Condition GroupType="AllowableAction" Name="SaleAmendable">false</Condition>

<Condition GroupType="AllowableAction" Name="SaleCancellable">false</Condition>

<Condition GroupType="AllowableAction" Name="ProductAmendable">true</Condition>

<Condition GroupType="AllowableAction" Name="Contractable">false</Condition>

<Condition GroupType="AllowableAction" Name="CommercialAmendable">true</Condition>

<Condition GroupType="LifeCycleEvent" Name="Contracted">true</Condition>

<Condition GroupType="LifeCycleEvent" Name="Gatekeeper Hold">false</Condition>

<Condition GroupType="LifeCycleEvent" Name="VehicleOrderSold">false</Condition>

<Condition GroupType="LifeCycleEvent" Name="Schedule Hold">false</Condition>

I need to create my target node when <Condition GroupType="LifeCycleEvent" Name="VehicleOrderSold">false</Condition> & <Condition GroupType="LifeCycleEvent" Name="Contracted">true</Condition>

Problem here is Vehicle order Sold will also comes like this

<Condition GroupType="LifeCycleEvent" Name="VehicleOrderSold">true.</Condition>



Source structure Condition is an element and GroupType, Name are the attributes of Condition.


In my UDF i need to take 2 input parameters


1) Name ----> In this attribute " Contracted" & "VehicleOrderSold" will come along with other values


2) Condition---> In this element we will get "true" or false.



I tried to achieve this using node functions but successful. Please help on this regard.


Thanks,

Pavan T

Capture.PNG (31.9 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 28, 2016 at 07:28 AM

    Hi Pavan,

    A simplistic approach, I used to test your requirement was to concatenate the Condition, Name and GroupType values in a single string and compared them with the values that you wanted. Here is the code I used to perform check. Note that var1 is the concatenated values in that order, with the context for the attributes moved to the parent data type of Condition field.

    boolean flag = false;

    for ( int i = 0; i <var1.length; i++)

    {

    if( var1[i].equals("falseVehicleOrderSoldLifeCycleEvent"))

    {

    flag = true;

    }

    }

    if (flag)

    {

    for ( int i = 0; i <var1.length; i++)

    {

    if( var1[i].equals("trueContractedLifeCycleEvent"))

    {

    result.addValue(var2[i]);

    }

    }

    }

    Note: I have returned the var2 value here, which is the Condition field itself.

    Regards,

    Sanjeev

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 28, 2016 at 10:28 AM

    Hi Pavan,

    It looks like a very straight forward requirement which certainly should be resolved through graphical mapping.

    Can your share your graphical mapping . I don't think there is an requirement of UDF here at all.

    Thanks,

    Apu

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Pavan,

      I have done the mapping according to your initial post.

      I need to create my target node when <Condition GroupType="LifeCycleEvent" Name="VehicleOrderSold">false</Condition> & <Condition GroupType="LifeCycleEvent" Name="Contracted">true</Condition>

      According to the above requirement we need to check Name = VahicleOrderSold and Condition = false, i have done exactly same and check the queues below. the last queue after collapseContext we get the required output which is true.

      This is just an example you can change whatever requirement you have.

      Regards,

      Praveen.

      queue1.png (155.9 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.