cancel
Showing results for 
Search instead for 
Did you mean: 

Statistic count in context

Former Member
0 Kudos

Hello,

For one mapping, I have to know the number of context with value in a sub context.

Have a look on  my example.

<Context_1>

    <VALUE_CONTEXT_1>"1"</VALUE_CONTEXT_1>

    <Context_2>

        <vALUE_Context_2>"1"</vALUE_Context_2>

     </Context_2>

     <Context_2>

        <vALUE_Context_2>"2"</vALUE_Context_2>

    </Context_2>

     <Context_2>

        <vALUE_Context_2>"3"</vALUE_Context_2>

    </Context_2>

</Context_1>

<Context_1>

    <VALUE_CONTEXT_1>"2"</VALUE_CONTEXT_1>

</Context_1>

<Context_1>

    <VALUE_CONTEXT_1>"3"</VALUE_CONTEXT_1>

    <Context_2>

        <vALUE_Context_2>"4"</vALUE_Context_2>

     </Context_2>

     <Context_2>

        <vALUE_Context_2>"5"</vALUE_Context_2>

    </Context_2>

     <Context_2>

        <vALUE_Context_2>"6"</vALUE_Context_2>

    </Context_2>

    <Context_2>

        <vALUE_Context_2>"7"</vALUE_Context_2>

    </Context_2>

</Context_1>

My problem, is that I want to know the number of Context_1 with Context_2

In my example, the result would be 2

Thanks a lot for you help.

JC

Accepted Solutions (1)

Accepted Solutions (1)

JaySchwendemann
Active Contributor
0 Kudos

Did you try the "count" function? You should be able to map "Contex_2" to your destination field having the context of "Context_2" set to "Context_1". Sorry if that sounds confusing due to all the contexts 🙂 Please have a look at the attached image.

HTH

Cheers

Jens

Former Member
0 Kudos

Hello Jens,

Hello Rajesh,

I have used the count in statistical, but I don't have the right result.

Context_1 ------> Count   = 3

Context_2 ------> Count = 3  

                                     0

                                     3

Context_2 ------> Count = 6  (when I'm on Highest context)

But I need that the value would be equal 2

Thanks a lot

JC

former_member184681
Active Contributor
0 Kudos

Hi JC,

Try with: Context_2 -> collapseContexts -> count. This should give you the expected result.

Regards,

Greg

Former Member
0 Kudos

Hello Greg,

I had already try this, but my result is not the one expected :

Like you see, I have 3 and I need to have 2.

Case = Context_1

Line = Context_2

Thanks a lot.

JC

former_member184681
Active Contributor
0 Kudos

Dear JC,

Try with the following modification then:

Line -> exists -> createIf -> collapseContexts -> count

Regards,

Greg

Former Member
0 Kudos

Thanks Greg,

Now it's working.

Many to thanks to everyone for your help.

JC

Answers (2)

Answers (2)

ambrish_mishra
Active Contributor
0 Kudos

Hi JC,

Here is how you will get the result:

Hope it helps!

Ambrish

Former Member
0 Kudos

Hello Ambrish,

I have tried your solution, and like the Greg's one, my result is 3 instead of 2.

Thanks for your help.

JC

JaySchwendemann
Active Contributor
0 Kudos

Hi JC,

Couldn't reassemble Ambrish's solution, but it should be close. I'm on PI 7.0 so I'm not sure if it a limitation of that version that I'm not able to pull two arrows from one source.

Anyways: I did this which resulted in output "2". Maybe this image explains better. Please try.

Cheers

Message was edited by: Jens Schwendemann (could not rebuild Ambrish's solution, but should be close)

ambrish_mishra
Active Contributor
0 Kudos

Hi JC,

I had done a quick prototype on the system with your example and it worked perfectly. Gives a count 2. let me give you the test case I used. Here are the screenshots:

Mapping with source data type:

test case similar to yours:

Hope it is clear.

Ambrish

Former Member
0 Kudos

Hi,

Did you tried using the counter functionality ?

check that out...that will suffice for your requirement...

HTH

Rajesh