cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping query for context change without UDF

Former Member
0 Kudos

Hi,

My requirement is as below:

Input queues are

4319, 4319,4320,4321,4321

M1,M1,M1,M2,M2,M2

Required output is

4319,4320,CC,4321

COntext change is to be inserted when there is a change in value in second queue.

regards, Anirudh.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Suppose you have two parameters a and b:

a - 4319 queue

b - M queue

Your going to use two FormatByExamples:

The last one take two paraters:

First Parameter:


a->removeContext->SplitByvalue[ValueChange]->CollapsContext ----------------------------------------------------> 

Second Parameter:


b->removeContext --------------------------> 
                                             FormatByexample -> CollapsContext->RemoveConext -> SplitByValue[Value Change]----->
a->removeContext->SplitByvalue[ValueChange]->

It should work this time.

Liang

Edited by: Liang Ji on Mar 13, 2009 4:15 PM

Former Member
0 Kudos

Hi Liang,

It is working now .

Former Member
0 Kudos

Great, Actually you can remove "removeContext" after "CollapsContext", since "CollapsContext" has already removed the context, so the "removeContext" does not take any effect.

Regards.

Liang

Answers (4)

Answers (4)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

You may use the mapping below:

input1 is the input with M1, M2

input2 is the input with numbers



input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> removeContext --> substring (2..6) --> formatByExample (1) --> Target
input2-->removeContext--> /


input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> removeContext --> substring (0..2) --> splitByValue:ValueChanged -->formatByExample (2)
input2-->removeContext--> /

The code is too long without UDF, but it will work

Hope this helps,

Edited by: Mark Dihiansan on Mar 13, 2009 3:38 PM

Edited by: Mark Dihiansan on Mar 13, 2009 3:42 PM

Former Member
0 Kudos

Mark,

This one is also giving the same output...

4319,4320,4321.

I want a context change inserted between 4320,4321

4319,4320,CC,4321

regards, Anirudh

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Have you tried using the formatByExample as specified?


input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (2..6) --> formatByExample (1) --> Target
input2-->removeContext--> / 
 
 
input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (0..2) --> splitByValue:ValueChanged -->formatByExample (2)
input2-->removeContext--> / 

code explanation

input1 and input 2 when concatted outputs M12319,M12319,M12320,M22321,M22321,M22321

The upper part of the code does this: M12319,M12320,M22321, when you use the substring it outputs now 2319,2320,2321

The lower part of the code does this: M12319,M12320,M22321, when you use the substring it outputs

M1,M1,M2, then you use splitByValue. The output is now M1,M1,CC,M2.

When you input the code from the upper part and lower part into a formatByExample node, the output becomes

2319,2320,CC,2321

Hope this helps,

Former Member
0 Kudos

Apply Split by value on value change on second queue

then

ApplyFormat by example on 1st queue (use second queue as formatting example)

and then finally

Apply Collapse context on first queue.

Former Member
0 Kudos

requirement is

4319 M1

4319 M1

4320 M1

4321 M2

4321 M2

4321 M2

output shoud be

4319

4320

4321

there should be a context change between 4320 and 4321

as 4319 and 4320 belong to same M1 and 4321 belong to M2.

I am able to generate queue 4319,4320,4321.

but I am not able to insert CC between 4320 and 4321.

I want to do it without UDF.

regards, Anirudh.

Former Member
0 Kudos

Suppose you have two parameters a and b:


a->removeContext------------------------------->
                                                 FormatByexample --> UDF -->
b->removeContext -> SplitByvalue[ValueChange]-->

UDF, Context type


   result.addValue(a[0]);
  for (int i =1; i < a.length; i++)
   if (a<i>!=a[i-1])
     result.addvalue(a<i>);

Regards.

Liang

Former Member
0 Kudos

Hi,

Try using the SplitByValue with Value Changed option.

Regards

Madhu

Former Member
0 Kudos

Thanks for your reply...

that creates 4319,4320,4321

without context change

what I want is CC only at one place

4319,4320,CC,4321

regards, Anirudh