cancel
Showing results for 
Search instead for 
Did you mean: 

Validating file in PI

Former Member
0 Kudos

Hi Folks,

In my scenario. PI will be getting a file in following format.

Header

Item

Item

Header

Item

Item

End Records

PI have to check if 'End Record' exists in the file. If not, then Alert need to be triggered. I am not sure how the scenario can be handled without using BPM.

Please help me if anybody is aware of the scenario.

Thanks & Regards,

Punit

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

there are two ways to do this;

1. Use FCC, convert to XML and then in RD check if the trailer node exist - thus you can stop the further execution. But raising alerts would be tricky and hence you would have to call a simple mapping just to trigger the alert

2. Use a module to do your validation and raise alerts within the module itself (its a bit complex, i wouldn't recommend this)

Former Member
0 Kudos

Hi Shabrish,

Thanks for replying.

With reference to point 1, what mapping I need to do for trigerring alert.

Thanks,

Punit

former_member200962
Active Contributor
0 Kudos

Check blog# 4077 for this .... or can even search in SDN it has many references.

Regards,

Abhishek.

Answers (2)

Answers (2)

shweta_walaskar2
Contributor
0 Kudos

Hi Punit,

You can create a UDF for throwing runtime exception when input string "false" is received.

Then use exists function to check if End Record exists and pass the outcome of exists to UDF.

If it doesn't exist,mapping will throw a Runtime exception and if Alert configuration is there,an alert will be raised.

Please excuse,if I have not understood the requirement correctly.

Thanks.

Regards,

Shweta

Former Member
0 Kudos

Hi Shweta,

Thanks for replying.

How can we trigger exception in UDF? What is the command is used for raising exception?

Thanks,

Punit

former_member200962
Active Contributor
0 Kudos

UDF is not required in your case also not recommended....it will be better if you use Receiver Determination itself to check for the existence of the field and to raise any alert.

I am suggesting Receiver Determination because it will avoid processing the message till the Mapping step, for performance perspective.

Regards,

Abhishek.

shweta_walaskar2
Contributor
0 Kudos

Hi Abhishek,

Thanks.I just mentioned how I handled such a requirement.

You are right,handling it at Receiver Determination level would be good so as not to reach Message Mapping level.

I had to check if a field in Excel is blank(when we converted this Excel into XML,then this blank is replaced by " in XML)

In such case,I had to raise an exception.

So I created a UDF:

public String throwErrorOnInvalidValue(String a,Container container){

if(a.equals("\""))

throw new RuntimeException("Invalid Value: Value should be numeric");

else

return a;

Regards,

Shweta

former_member200962
Active Contributor
0 Kudos

You can check it in Receiver Determination (in the Condition Editor) and then mark the processing as error so that an alert can be raised (only if you have creatde and configured an alert category).....do you want the processing to stop if the field is not found?

Former Member
0 Kudos

Hi Abhishekh,

Thanks for reply.

Yes, I have to stop the processing if field is not found.

Thanks,

Punit