cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical Mapping question

pi_consultant1
Participant
0 Kudos

Dear friend,

I've a question about graphical mapping in PI.

I get the below values in a field that can occur 0...unbounded on the source side. I have to create a XML node if the value 46 occurs else I shouldn't create the XML node.

Can you please help me with this issue,

Kind regards,

John

Accepted Solutions (1)

Accepted Solutions (1)

pi_consultant1
Participant
0 Kudos

Maybe this will help to explain my scenario...

The field marked on the source can have values 220 and 46. If value 46 occur I shouldn't create XML node Reading, else Ive to create it...

former_member184720
Active Contributor
0 Kudos

Then i think you should the second option (sort function).. try and confirm if that doesn;t work..

pi_consultant1
Participant
0 Kudos

Hi Hareesh,

I almost got it... My solution looks like this:

If I dont have 46's than I get the right result but if I have 46's I get an error...

The output of the mapping if I get 46's is this:

Which is right one in my opinion. But I still get the following error...

Register/ns0:Reading. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

I dont quite understand it, Reading is an optional field why the mapping still requires a value?

Any halp would be appreciate it,

Regards,

John

former_member184720
Active Contributor
0 Kudos

Hi - Why are you using copy value? Are you sure it's working?

If you don't raise the context i'm sure it always returns the suppress

Former Member
0 Kudos

Hello,

Change context of quantity field and set it to some higher parent node (right click and select context) and then check?

BTW, i am not sure why u want to use Copy Value function?

Thanks

Amit Srivastava

pi_consultant1
Participant
0 Kudos

Hi,

46 is always in the 2nd context change so I check whether 46 exists there or not. If it exists it shouldnt create Readings and if it doesn't exist it must create the Readings...

So what should I do?

pi_consultant1
Participant
0 Kudos

Hi Amit,

I did that and I still get the same error!

Any other idea?

Kind regards,

John

Former Member
0 Kudos

Hello,

It seems that u want to create target node if source value is anything other than 46? right?

So why don't u use below mapping?

Input (change its context)-----

                   ------------equals ----Not ---If without Else (Constant() -Then) ----Target Node

Constant(46)------

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

just use the remove context before the copy value?

i'm not sure why you wanted to use copy value but you can defiently use if without else as suggested earlier..

pi_consultant1
Participant
0 Kudos

Hi,

Thats right!

Is this what you mean?

I dont get the result I want. Did I do something wrong?

Regards,

John

former_member184720
Active Contributor
0 Kudos

Hi - Can you confirm the below?

1)I see that you can have multiple Quantity_Type_ID's(QTI).

So if you have 5 QTI's

220

46

31

200

500

Do you want to create readings for the other 4 or you don't want to create at all.

2) I see that you are testing with multiple 46's in the input queue.

Assume if your input is like that

220

220

46

220

220

46

What the expected output? Do you want the readings to be created or not.

Harish
Active Contributor
0 Kudos

Hi John,

try to use If without else in place of Ifs without else. Please do not check the keep suppress option.

regards,

Harish

Muniyappan
Active Contributor
0 Kudos

Hi,

Can you please share the input and output xml?

It will help us to understand your requirement clearly.

Regards,

Muni

former_member184720
Active Contributor
0 Kudos

Let me know if this is what you are looking for

But your target node occurence is 0..1 so if there is no 46 and if you have any other values, i'm not sure how you want to handle it.

Please provide with sample input and expected output so that we can suggest you.

Former Member
0 Kudos

Hello,

>>Is this what you mean?

Yes. So above mapping will make sure that records are created if value of a field is not equal to 46.

>>I dont get the result I want. Did I do something wrong?

What exactly u are expecting in output?

Thanks

Amit Srivastava

pi_consultant1
Participant
0 Kudos

HI Hareesh,

Thank you so much. Thats exactly what I needed

And for another Node if the value 46 does occure I have to create that Node, it would be a small change in the UDF?

Thank you again,

Regards,

John

Answers (5)

Answers (5)

pi_consultant1
Participant
0 Kudos

Thank you all for your replies,

I dont think thats exactly what I want. This is what I want:

If 46 occurs on the source side I shouldn't create a XML node on the target side...

So in above example I get value 46 so I shouldn't create the XML node <Line></Line> and if 46 doesn't occur I should create the XML Node <Line></Line>

Regards,

John

former_member184720
Active Contributor
0 Kudos

Just add a NOT

Message was edited by: Hareesh Gampa

former_member191435
Contributor
0 Kudos

Hi John

Use boolean  NOT function after equlas in the hareesh mapping...

or

Source Field    

                 remove context

                                                 equlaS(Text function)          Not ( BOOLEAN)      CreateIF      target Field

                         46

It should work

Thanks,

Sreenivas

Former Member
0 Kudos


Hi,

I think this is what you are looking for.

Regards

Venkat

former_member184720
Active Contributor
0 Kudos

If you want to just check for the occurence then Ryan has got you intially..

sort : descending

Former Member
0 Kudos


Hi,

In the above logic use remove context after Ifwithoutelse fn ,then it aptly suits for you.

Regards

Venkat

former_member191435
Contributor
0 Kudos

HI John

Source Field     

                 remove context

                                                 equlaS(Text function)                CreateIF      target Field

                         46

Thanks,

Sreenivas

Former Member
0 Kudos


Hi ,

Sourcefield-->Mapwithdefault-->if withoutelse equals (46)(Map source field to target)-->Targetfield.

Regards

Venkat

former_member184720
Active Contributor
0 Kudos

Hi - I don't think you need to sort and collapseContext.. Have a look at the below screenshots if that is what you are looking for.. (ofcourse above logic works if 46 is the lowest value)

Ryan-Crosby
Active Contributor
0 Kudos

Hi John,

I have assumed from your example that you mean one target node value which is what I was suggesting with my reply.  However if you are meaning for each value of '46' then you would want to take examples from Hareesh or Venkat for the logic.

Regards,

Ryan Crosby

Ryan-Crosby
Active Contributor
0 Kudos

Hi John,

Does this field contain only numerical inputs and is 46 the lowest value?  If so then you could do something like:

  sourceField -> sort (ascending) -> collapseContexts -> ifwithoutelse (and condition checks) -> targetField

Regards,

Ryan Crosby