cancel
Showing results for 
Search instead for 
Did you mean: 

third value in the context

Former Member
0 Kudos

Small query in graphical mapping... value occurs in source four times... the sequence is dynamic.. but I need only one particular occurrence in output..

<Details>

<City>singapore</City>

<Code>1234<Code>

<City>malaysia</City>

<Code>1236<Code>

<City>bangkok</City>

<Code>1235<Code>

<City>jakarta</City>

<Code>1237<Code>

</Details>


Output only get value for


<City>bangkok</City>

<Code>1235<Code>


UDF is required? With remove context I am getting only first value...



Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Lalrem,

                Please try this mapping. I have used standard functions available in graphical mapping within esr.

output

with change in occurrence as per your  post

-----------------------------------------------------------------

Regards

Anupam

former_member186851
Active Contributor
0 Kudos

Additionally you can try with UDF 5 in the below link.just change i-1 to the value you require.

Former Member
0 Kudos

Thanks Anupam.. but copyvalue(2) makes position static.. right?

the value I am looking for can be in any context....want to suppress all other values...

anupam_ghosh2
Active Contributor
0 Kudos

Hi Lalrem,

                 Can you try this mapping

output

Regards

Anupam

Former Member
0 Kudos

My mistake that I gave u a wrong input structure.. the correct structure is details has )// unbounded occurence

<Header>

<Details>                                                    

<City>singapore</City>

<Code>1234<Code>

</Details>

<Details>

<City>malaysia</City>

<Code>1236<Code>

</Details>

<City>bangkok</City>

<Code>1235<Code>

<Details>

<City>jakarta</City>

<Code>1237<Code>

</Details>

</Header>


There is a context change after every Detail tab and If I use remove context and if condition I get only first value in the context.....I want the particular context where value of city is "bangkok"


Expected Target is only one value...


<Header><Details><CityCode>bangkok1235<CityCode> <Details></Header>



anupam_ghosh2
Active Contributor
0 Kudos

Thanks for providing the complete information.

can you please try this mapping

when you are mapping to "Details"(target) node set context of "City" node and "Code" node to "DeTails" (source) as shown below

similarly when you are mapping to header node in target , change the context of the same nodes to the Header node (in source).

The constant value is "bangkok1235"

the output

-----------------

Regards

Anupam

Former Member
0 Kudos

Thanks again anupam... I tried this but facing an issue as value "NA" has to go if the input does not have city as bangkok and code is  1235.. also due to this the nodes header and Details are always 1..1...

Now if the input values are as mentioned then citycode should be concatenated value of city and code..

the challenge is that there are many context and we have to pick up only the context where city is bangkok and cod eis 1235...

is this possible in graphical or we need queue /context udf?

anupam_ghosh2
Active Contributor
0 Kudos

Hi Lalrem,

               Please try this mapping

set the context of City and Code to "header" node. In the sort function double click and set following properties "case insensitive" and "ascending".

output

--------------

Regards

Anupam

Answers (3)

Answers (3)

juan_vasquez2
Active Participant
0 Kudos

Hello Lalrem.


Yo need to right click on the element and then change the context une level up,


In the immage there is a sample, you neet to click the second row.


Then your UDF receive all the elements, not just the first







on the udf definition you need to use "All values of a context"







regards


Juan

former_member190293
Active Contributor
0 Kudos

Hi Lalrem!

You can do it using standard functions "Index" and "IfWithoutElse".

Regards, Evgeniy.

former_member190293
Active Contributor
0 Kudos

If City->Index(1,1)=3 Then City

If City->Index(1,1)=3 Then Code

Regards, Evgeniy.

former_member237514
Participant
0 Kudos

Hi Lalrem Singh,

Based on city or code you can put the condition through Boolean functions.

then you will get result .